Subject: Re: [boost] Ynt: Building Boost (1.60) with Clang and NDK
From: Ben Pope (benpope81_at_[hidden])
Date: 2016-01-07 08:07:06


On Thursday, January 07, 2016 02:21 PM, Fatih Kýralioðlu wrote:
> Ok, I am sharing my build.bat user-config-android.jam file below, from the outputs, clang is using mingw headers, for clang build, is mingw headers really necessary?
>
> build.bat:
>
> set CXXFLAGS="-I%ANDROID_NDK%/platforms/android-9/arch-arm/usr/include -I%ANDROID_NDK%/sources/cxx-stl/gnu-libstdc++/4.9/include -I%ANDROID_NDK%/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include"
> set TOOLSET=gcc-android
>
> b2 --toolset=%TOOLSET% --user-config=./user-config-android.jam cxxflags=%CXXFLAGS% threadapi=pthread --prefix=..\boost_android_arm --builddir=./ target-os=linux --with-date_time --with-filesystem --with-regex --with-log define=BOOST_FILESYSTEM_VERSION=3 --with-program_options --with-signals --with-system --with-thread link=static runtime-link=shared threading=multi install
>
> user-config-android.jam:
>
> androidNDKRoot = android-ndk-r10e ; # put the relevant path

I think you need to put the relevant path there, it should be an
absolute path.

> using clang : android :

This toolset is called clang-android, but you told b2 to use gcc-android.

> $(androidNDKRoot)/toolchains/llvm-3.6/prebuilt/windows-x86_64/bin/clang++ :
> <compileflags>--sysroot=$(androidNDKRoot)/platforms/android-21/arch-arm
> <compileflags>-Os

-Os will be ignored because you specified -O2 below.

> <compileflags>-fno-strict-aliasing
> <compileflags>-O2
> <compileflags>-DNDEBUG
> <compileflags>-g
> <compileflags>-I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.9/include
> <compileflags>-I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include

Remove the above two lines, since you want to use libc++, not libstdc++.
  If clang can't find the libc++ headers, then specify the path to libc++.

> <compileflags>-D__GLIBC__
> <compileflags>-D__ANDROID__
> <compileflags>-D_GLIBCXX__PTHREADS
> <compileflags>-D__arm__
> <compileflags>-D_REENTRANT

Your CXXFLAGS also specify flags for include paths for libstdc++, and
platforms/android-9, but your toolset specifies the sysroot as
platforms/android-21.

You should try invoking b2 again with the correct toolset name and
without any CXXFLAGS, since the toolset specifies them.

Ben