Boost logo

Boost :

Subject: [boost] cross-compiling linux->osx: file was built for archive which is not the architecture being linked (x86_64)
From: Frédéric Bron (frederic.bron_at_[hidden])
Date: 2016-11-08 01:21:21


I am trying to cross-compile for osx from linux using clang.

When I build boost, I use the following:
CC="x86_64-apple-darwin13-clang" CFLAGS="-O2 -DNDEBUG"
CXX="x86_64-apple-darwin13-clang++-libc++" CXXFLAGS="-O2 -DNDEBUG
-std=c++14" AR="x86_64-apple-darwin13-ar"
AS="x86_64-apple-darwin13-as" RANLIB="x86_64-apple-darwin13-ranlib"
./bootstrap.sh --without-icu
--prefix=/softs/usr/darwin13-clang/release/boost --with-toolset=clang

Then I use the following user-config.jam:

using clang : : x86_64-apple-darwin13-clang++-libc++ : <cxxflags>-std=c++14 ;

with the following command:

./b2 -d2 -j8 --layout=system --user-config=user-config.jam
--without-mpi --without-python --without-context --without-coroutine
link=static threading=multi runtime-link=shared target-os=darwin
threadapi=pthread address-model=64 define=BOOST_THREAD_USE_LIB
define=BOOST_LOG_WITHOUT_EVENT_LOG variant=release install

Apart from a few errors, everythings looks fine:

...failed updating 3 targets...
...skipped 3 targets...
...updated 13684 targets...

However, when I link against the static libraries that have been
built, I get this type of messages:

ld: warning: ignoring file
/softs/usr/darwin13-clang/release/boost/lib/libboost_system.a, file
was built for archive which is not the architecture being linked
(x86_64): /softs/usr/darwin13-clang/release/boost/lib/libboost_system.a

I suspect that it is because the wrong ar and ranlib where used
because I find in my log that b2 used "ar" and "ranlib" instead of
"x86_64-apple-darwin13-ar" and "x86_64-apple-darwin13-ranlib".

So I changed my user-config.jam to:

using clang : : x86_64-apple-darwin13-clang++-libc++ :
<cxxflags>-std=c++14 <archiver>x86_64-apple-darwin13-ar
<ranlib>x86_64-apple-darwin13-ranlib ;

but b2 is still using "ar" and "ranlib".

Any idea of what my problem is?

Frédéric


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk