Reputation: 939
I am making a project in Mac OSX and use the boost compiled libraries (serialisation amongst others). I installed all my dependencies as x86_64 libraries, but now want to make explicitly 32 bit ones (i386) and recompile my project for 32bit users.
I have recompiled by libraries with g++ -m32
where appropriate and then re made 32 bit boost libraries using
./bootstrap.sh link=static
./b2 cflags=-m32 cxxflags=-m32 address-model=32 threading=multi architecture=x86 instruction-set=i686
I then recompile my project by explicitly linking to the 32 bit libraries. So something like
g++ file.cpp /usr/local/lib/boost_i386/libboost_serialization.a -m32 -o executable
where the library is explicitly the 32 bit version verified by using otool
as follows with (partial) output (all list cputype as i386)
otool -hv -arch all libboost_serialization.a
Archive : libboost_serialization.a
libboost_serialization.a(basic_archive.o):
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
MH_MAGIC I386 ALL 0x00 OBJECT 3 1180 SUBSECTIONS_VIA_SYMBOLS
However, when I compile my project (despite most dependencies working fine), it trips up and that symbols are missing for this architecture
Explicitly:
Undefined symbols for architecture i386:
"boost::archive::detail::shared_ptr_helper::shared_ptr_helper()", referenced from:
boost::archive::binary_iarchive::binary_iarchive(std::basic_istream<char, std::char_traits<char> >&, unsigned int)in ccCH1ama.o
"boost::archive::detail::shared_ptr_helper::~shared_ptr_helper()", referenced from:
boost::archive::binary_iarchive::~binary_iarchive()in ccCH1ama.o
boost::archive::binary_iarchive::~binary_iarchive()in ccCH1ama.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
I have explicitly built the 32bit libraries, checked they are in fact 32 bit, and explicitly linked to them, I don't know what else to do. Any ideas?
Upvotes: 0
Views: 152
Reputation: 939
Turns out the header files were boost v1.55 but the i386 libraries used the most current version v1.57. This caused the error. Building the libraries with the older v1.55 to match the headers fixed the problem.
Upvotes: 1