Boost logo

Boost Users :

Subject: [Boost-users] [serialization] unable to link on OS X when MACOSX_DEPLOYMENT_TARGET=10.7
From: Pavol Juhas (pavol.juhas_at_[hidden])
Date: 2017-06-26 19:36:16


I'd like to build the boost_serialization library with a compatibility setup
for Mac OS X version 10.7, because I need to use it with Anaconda Python
binaries, which are built for OS X 10.7. The OS X compatibility version can be
set either by passing `-mmacosx-version-min=10.7` as a compile and link option
or by setting environment variable MACOSX_DEPLOYMENT_TARGET=10.7.

If I do so, the boost_serialization library builds without complaints,
however I am not able to link it with my test program. Here are the steps
I take to compile boost_serialization and the test program starting from
a fresh boost 1.64.0 tree:

# --------------------------------------------------------------

$ ./
$ ./b2 -j4 variant=release link=shared --with-serialization stage

# The stage/lib directory now contains libboost_serialization.dylib.
# Use it to build a test program from tarchive.cpp:

$ c++ tarchive.cpp -I. -Lstage/lib -lboost_serialization
Undefined symbols for architecture x86_64:
char, std::char_traits<char> >::init()", referenced from:
char, std::char_traits<char> >::init(unsigned int) in
char, std::char_traits<char> >::save(std::string const&)", referenced
      void boost::archive::save_access::save_primitive<boost::archive::binary_oarchive,
std::string>(boost::archive::binary_oarchive&, std::string const&) in

# --------------------------------------------------------------

The only thing the test program (attached) does is to instantiate the
boost::archive::binary_oarchive class. The procedure above works
fine when MACOSX_DEPLOYMENT_TARGET is set to 10.9 or higher.

Am I missing some option that would fix the failed linking when
building for OS X 10.7? I suppose this could be related to object
visibility options as the serialization library is compiled with
"-fvisibility=hidden" and "-fvisibility-inlines-hidden" options.

Thank you,


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at