Opened 12 years ago

Last modified 12 years ago

#4664 new Bugs

libboost_zlib + libboost_iostreams - link error (XCode, MacOSX)

Reported by: nen777w@… Owned by: Jonathan Turkanis
Milestone: To Be Determined Component: iostreams
Version: Boost 1.44.0 Severity: Showstopper
Keywords: Cc:

Description

String for build boost:

sudo bjam toolset=darwin architecture=combined address-model=32 threading=multi link=static runtime-link=static -sNO_COMPRESSION=0 -sNO_ZLIB=0 -sZLIB_SOURCE="../../../../../zlib123" stage

After building I linking this libraries into my application: libboost_iostreams.a libboost_zlib.a

But linker say:

Undefined symbols: "std::bad_alloc::what() const", referenced from: vtable for boost::exception_detail::error_info_injector<std::bad_alloc>in libboost_iostreams.a(zlib.o) vtable for boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::bad_alloc> >in libboost_iostreams.a(zlib.o)

Change History (4)

comment:1 by Vicente Botet <vicente.botet@…>, 12 years ago

"std::bad_alloc::what() const" is part of the standard library. Please check if you are linking with.

comment:2 by anonymous, 12 years ago

Can confirm the problem here, for me this occurs when compiling with gcc 4.2 against the MacOS 10.5 SDK (and MACOSX_DEPLOYMENT_TARGET=10.5).

Linking works if I compile with gcc 4.0, but then another libstdc++ symbol can not be resolved at runtime on MacOS 10.5 (Symbol not found: ZNKSt9exception4whatEv).

This is probably caused by ABI incompatibilites between gcc 4.0 and gcc 4.2, if anyone has any suggestions how to build boost on MacOS 10.5 with gcc 4.2 this would be appreciated.

comment:3 by anonymous, 12 years ago

I got the same error. But I "solved" it in this way: use boost 1.42 rather than 1.44 or 1.45. I use gcc 4.2. I have tried boot 1.44 and 1.45. They both give me a linker error. By 1.45, I got this instead:

boost::iostreams::detail::bzip2_base::check_end(char const*, char const*)", referenced from: boost::iostreams::detail::bzip2_decompressor_impl<std::allocator<char> >::filter(char const*&, char const*, char*&, char*, bool)in main.o ld: symbol(s) not found

Has something changed from 1.42 to 1.44? Anybody know how to let boost 1.45 works with zlib / libbzip2 ?

comment:4 by Walter Warniaha <walter.warniaha@…>, 12 years ago

The 10.5 and 10.6 SDK bad_alloc class differs by the method "what". My guess is that boost is compiling against the 10.6 header files when asked to use the 10.5 SDK.

Note: See TracTickets for help on using tickets.