Boost logo

Boost :

Subject: Re: [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-09 02:53:29


I have rerun manually ar and ranlib with the correct binaries
(x86_64-apple-darwin13-...) and it works.
How can I do that automatically with b2?
Kind regards,
Frédéri

2016-11-08 7:21 GMT+01:00 Frédéric Bron <frederic.bron_at_[hidden]>:
> 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

-- 
Frédéric Bron
-----------------------------------------------------------
Frédéric Bron (frederic.bron_at_[hidden])
Villa des 4 chemins, Centre Hospitalier, BP 208
38506 Voiron Cedex
tél. fixe : +33 4 76 67 17 27, tél. port.: +33 6 67 02 77 35

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