Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Boost iostreams with bzip - unresolved symbols

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.

like image 843
E.K. Avatar asked Oct 18 '12 08:10

E.K.


1 Answers

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.

like image 176
LThode Avatar answered Sep 28 '22 13:09

LThode