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


Hello,

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:

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

$ export MACOSX_DEPLOYMENT_TARGET=10.7
$ ./bootstrap.sh
$ ./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:
  "boost::archive::basic_binary_oprimitive<boost::archive::binary_oarchive,
char, std::char_traits<char> >::init()", referenced from:
      boost::archive::binary_oarchive_impl<boost::archive::binary_oarchive,
char, std::char_traits<char> >::init(unsigned int) in
tarchive-5e24a9.o
  "boost::archive::basic_binary_oprimitive<boost::archive::binary_oarchive,
char, std::char_traits<char> >::save(std::string const&)", referenced
from:
      void boost::archive::save_access::save_primitive<boost::archive::binary_oarchive,
std::string>(boost::archive::binary_oarchive&, std::string const&) in
tarchive-5e24a9.o
...

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

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,

Pavol




Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net