Boost iostreams with bzip - unresolved symbols
Asked Answered
B

1

14

My project was using an older version of Boost's iostreams w/ bzip2. I'm now trying to upgrade to Boost 1.51. At first I did not compile with bzip so obviously I got the linker yelling about libboost_bzip2-vc100-mt-sgd-1_51.lib being missing. I then followed these instructions (and added the static flag) to compile this file.

However, running the linker now returns a bunch of symbols missing:

>error LNK2001: unresolved external symbol "protected: __thiscall boost::iostreams::detail::bzip2_base::~bzip2_base(void)" (??1bzip2_base@detail@iostreams@boost@@IAE@XZ)
>error LNK2001: unresolved external symbol "protected: __thiscall boost::iostreams::detail::bzip2_base::bzip2_base(struct boost::iostreams::bzip2_params const &)" (??0bzip2_base@detail@iostreams@boost@@IAE@ABUbzip2_params@23@@Z)
>error LNK2001: unresolved external symbol "int const boost::iostreams::bzip2::stream_end" (?stream_end@bzip2@iostreams@boost@@3HB)
...

Any ideas how come the lib doesn't contain all this code? What am I missing? I'm using VS2010 on Windows.


Edit: Got it!

Had an old version of libboost_iostreams-vc100-mt-sgd-1_51.lib that was compiled without the bzip. What I'm still not sure about is this: For my original compilation I used:

>b2 --with-iostreams -sBZIP2_SOURCE=D:\Work\external\bzip2-1.0.6 -sZLIB_SOURCE=d:\work\external\zlib-1.2.3 runtime-link=static

This produced the following files:

libboost_bzip2-vc100-mt-s-1_51.lib
libboost_bzip2-vc100-mt-sgd-1_51.lib

For the "correct" compilation (that solved the problem) I used:

>b2 --with-iostreams -sBZIP2_SOURCE=D:\Work\external\bzip2-1.0.6 runtime-link=static

I.e. simply removed the zlib, as it was unnecessary for me. It produced:

libboost_bzip2-vc100-mt-s-1_51.lib
libboost_bzip2-vc100-mt-sgd-1_51.lib
libboost_iostreams-vc100-mt-s-1_51.lib
libboost_iostreams-vc100-mt-sgd-1_51.lib

How come the iostreams libs were not produced on the original compilation? Very odd.

Thanks.

Bellhop answered 18/10, 2012 at 8:44 Comment(5)
Instead of editing your question with the solution, put it as a proper answer and accept it.Vistula
Tried to, but because I only registered a little while ago apparently I don't have enough reputation to answer my own questions...Bellhop
@Bellhop try to login to some more StackOverflow sites to get reputation boost.Mahaliamahan
@Bellhop try self-answering now -- the limitation on self-answers by low-rep users is only an eight-hour delay (spam control), not a permanent restriction.Hilmahilt
Be glad this fixed your errors - I have the libboost_iostreams lib file and I still get the errors...Faubert
H
1

From E.K.'s answer-in-question:

Had an old version of libboost_iostreams-vc100-mt-sgd-1_51.lib that was compiled without the bzip. What I'm still not sure about is this: For my original compilation I used:

>b2 --with-iostreams -sBZIP2_SOURCE=D:\Work\external\bzip2-1.0.6 -sZLIB_SOURCE=d:\work\external\zlib-1.2.3 runtime-link=static

This produced the following files:

libboost_bzip2-vc100-mt-s-1_51.lib
libboost_bzip2-vc100-mt-sgd-1_51.lib

For the "correct" compilation (that solved the problem) I used:

>b2 --with-iostreams -sBZIP2_SOURCE=D:\Work\external\bzip2-1.0.6 runtime-link=static

I.e. simply removed the zlib, as it was unnecessary for me. It produced:

libboost_bzip2-vc100-mt-s-1_51.lib
libboost_bzip2-vc100-mt-sgd-1_51.lib
libboost_iostreams-vc100-mt-s-1_51.lib
libboost_iostreams-vc100-mt-sgd-1_51.lib

How come the iostreams libs were not produced on the original compilation? Very odd.

Hilmahilt answered 18/10, 2012 at 8:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.