Quantcast

cross-compilation: building boost on linux targetting osx

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

cross-compilation: building boost on linux targetting osx

Boost - Dev mailing list
Hi,

I am trying to cross-build boost on linux targetting osx.
I am using a cross compiler based on the linux clang 3.8.1 (osxcross).


You can find below the process I use to build boost.

My problem is that apparently b2 cannot find iconv, zlib and bzip2.
Also apprently it says that clang does not support C++11 features
(which is not true):
    - Boost.Config Feature Check: cxx11_auto_declarations : no
    - Boost.Config Feature Check: cxx11_constexpr : no
    - Boost.Config Feature Check: cxx11_defaulted_functions : no
    - Boost.Config Feature Check: cxx11_final : no
    - Boost.Config Feature Check: cxx11_hdr_mutex : no
    - Boost.Config Feature Check: cxx11_hdr_tuple : no
    - Boost.Config Feature Check: cxx11_lambdas : no
    - Boost.Config Feature Check: cxx11_noexcept : no
    - Boost.Config Feature Check: cxx11_nullptr : no
    - Boost.Config Feature Check: cxx11_rvalue_references : no
    - Boost.Config Feature Check: cxx11_template_aliases : no
    - Boost.Config Feature Check: cxx11_thread_local : no
    - Boost.Config Feature Check: cxx11_variadic_templates : no
    - zlib                     : no
    - bzip2                    : no
    - iconv (libc)             : no
    - iconv (separate)         : no
- Boost.Locale needs either iconv or ICU library to be built.

I identified potential issues:

1. I give toolset clang to bootstrap.sh which sets the toolset to
clang in project-config.jam but clang-linux is used:
common.mkdir bin.v2/libs/system/build/clang-linux-3.8.1/release

Should it be clang-darwin instead?

However, if I set it myself to clang-darwin with bootstrap.sh, it says
that clang-darwin toolset does not exist.

By the way, there is nothing about clang in getting started:
http://www.boost.org/doc/libs/1_63_0/more/getting_started/unix-variants.html

2. when looking for the iconv library (same issue with zlib and
bzip2), there are unknown linker options (--start-group or -R) and the
iconv library path I gave to b2 is not given to the compiler/linker.
Here is part of the output in config.log:

clang-linux.compile.c++.without-pth
bin.v2/libs/locale/build/clang-linux-3.8.1/debug/target-os-darwin/has_iconv_libc_obj.o

  "x86_64-apple-darwin13-clang++-libc++" -c -x c++ -std=c++14 -O2
-DNDEBUG -O0 -g -fno-inline -Wall -g -fPIC -m64  -DBOOST_ALL_NO_LIB=1
-DBOOST_LOG_WITHOUT_EVENT_LOG -DBOOST_THREAD_USE_LIB -I"." -o
"bin.v2/libs/locale/build/clang-linux-3.8.1/debug/target-os-darwin/has_iconv_libc_obj.o"
"libs/locale/src/../build/has_iconv.cpp"

    "x86_64-apple-darwin13-clang++-libc++"    -o
"bin.v2/libs/locale/build/clang-linux-3.8.1/debug/target-os-darwin/has_iconv"
-Wl,--start-group
"bin.v2/libs/locale/build/clang-linux-3.8.1/debug/target-os-darwin/has_iconv_libc_obj.o"
 -Wl,-Bstatic  -Wl,-Bdynamic  -Wl,--end-group -g -m64~

ld: unknown option: --start-group

clang-linux.compile.c++.without-pth
bin.v2/libs/locale/build/clang-linux-3.8.1/debug/target-os-darwin/has_iconv_libc_ext.o

  "x86_64-apple-darwin13-clang++-libc++" -c -x c++ -std=c++14 -O2
-DNDEBUG -O0 -g -fno-inline -Wall -g -fPIC -m64  -DBOOST_ALL_NO_LIB=1
-DBOOST_LOG_WITHOUT_EVENT_LOG -DBOOST_THREAD_USE_LIB -I"."
-I"/softs/osx64-clang-3.8.1/release/iconv/include" -o
"bin.v2/libs/locale/build/clang-linux-3.8.1/debug/target-os-darwin/has_iconv_libc_ext.o"
"libs/locale/src/../build/has_iconv.cpp"

    "x86_64-apple-darwin13-clang++-libc++"
-L"/softs/osx64-clang-3.8.1/release/iconv/lib" -Wl,-R
-Wl,"/softs/osx64-clang-3.8.1/release/iconv/lib" -Wl,-rpath-link
-Wl,"/softs/osx64-clang-3.8.1/release/iconv/lib" -o
"bin.v2/libs/locale/build/clang-linux-3.8.1/debug/target-os-darwin/has_external_iconv"
-Wl,--start-group
"bin.v2/libs/locale/build/clang-linux-3.8.1/debug/target-os-darwin/has_iconv_libc_ext.o"
 -Wl,-Bstatic  -Wl,-Bdynamic -liconv -Wl,--end-group -g -m64~

ld: unknown option: -R


Any idea?

Frédéric


Currently, I am using the following commands to build boost:

CC="x86_64-apple-darwin13-clang" CFLAGS="-O2 -DNDEBUG"
CXX="x86_64-apple-darwin13-clang++-libc++" CXXFLAGS="-O2 -DNDEBUG
-std=c++14" CPPFLAGS="-I/softs/osx64-clang-3.8.1/release/iconv/include
-I/softs/osx64-clang-3.8.1/release/bzip2/include
-I/softs/osx64-clang-3.8.1/release/zlib/include"
LDFLAGS="-L/softs/osx64-clang-3.8.1/release/iconv/lib
-L/softs/osx64-clang-3.8.1/release/bzip2/lib
-L/softs/osx64-clang-3.8.1/release/zlib/lib"
AR="x86_64-apple-darwin13-ar" AS="x86_64-apple-darwin13-as"
RANLIB="x86_64-apple-darwin13-ranlib" ./bootstrap.sh --without-icu
--prefix=/softs/osx64-clang-3.8.1/release/boost --with-toolset=clang

then I write a user-config.jam:

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

and run b2:

CC="x86_64-apple-darwin13-clang" CFLAGS="-O2 -DNDEBUG"
CXX="x86_64-apple-darwin13-clang++-libc++" CXXFLAGS="-O2 -DNDEBUG
-std=c++14" CPPFLAGS="-I/softs/osx64-clang-3.8.1/release/iconv/include
-I/softs/osx64-clang-3.8.1/release/bzip2/include
-I/softs/osx64-clang-3.8.1/release/zlib/include"
LDFLAGS="-L/softs/osx64-clang-3.8.1/release/iconv/lib
-L/softs/osx64-clang-3.8.1/release/bzip2/lib
-L/softs/osx64-clang-3.8.1/release/zlib/lib"
AR="x86_64-apple-darwin13-ar" AS="x86_64-apple-darwin13-as"
RANLIB="x86_64-apple-darwin13-ranlib" ./b2 -d2 -j8
boost.locale.iconv=on boost.locale.icu=off boost.locale.std=off
-sICONV_PATH=/softs/osx64-clang-3.8.1/release/iconv
-sBZIP2_INCLUDE=/softs/osx64-clang-3.8.1/release/bzip2/include
-sBZIP2_LIBPATH=/softs/osx64-clang-3.8.1/release/bzip2/lib
-sZLIB_INCLUDE=/softs/osx64-clang-3.8.1/release/zlib/include
-sZLIB_LIBPATH=/softs/osx64-clang-3.8.1/release/zlib/lib
--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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cross-compilation: building boost on linux targetting osx

Boost - Dev mailing list
"Frédéric Bronvia Boost" wrote:
> I am trying to cross-build boost on linux targetting osx.
> I am using a cross compiler based on the linux clang 3.8.1 (osxcross).
...
> I identified potential issues:
>
> 1. I give toolset clang to bootstrap.sh which sets the toolset to
> clang in project-config.jam but clang-linux is used:
> common.mkdir bin.v2/libs/system/build/clang-linux-3.8.1/release
>
> Should it be clang-darwin instead?

bootstrap.sh builds b2 and the set of toolsets used for this is completely
different than the one Boost.Build has. It needs to be a host native
toolset.

> Currently, I am using the following commands to build boost:
...
> and run b2:
>
> CC="x86_64-apple-darwin13-clang" CFLAGS="-O2 -DNDEBUG"
> CXX="x86_64-apple-darwin13-clang++-libc++" CXXFLAGS="-O2 -DNDEBUG
> -std=c++14"

To my knowledge these environment variables aren't used by Boost.Build.
Aren't they typically used by make, which isn't involved here? Why not put
all the compiler flags in user-config.jam? You can use <linkflags> for the
linker flags. Use quotes like this to reduce repetition:
<cxxflags>"-x -y -z".

> ./b2 -d2

This should make b2 print the full command-line of each command. Have you
compared that to what you expect?

> boost.locale.iconv=on boost.locale.icu=off boost.locale.std=off

I have never seen these before. Where are they described?

Regards,

Niklas Angare
 



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Loading...