Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Share my experience Boost 1.55 on OSX 10.10 Yosemite #105

Open
ZhengRui opened this issue Jun 10, 2015 · 1 comment
Open

Share my experience Boost 1.55 on OSX 10.10 Yosemite #105

ZhengRui opened this issue Jun 10, 2015 · 1 comment

Comments

@ZhengRui
Copy link

Today I have to build Boost-for-Android because it's needed in this project "sh1r0/caffe-android-lib".

My system is OSX 10.10 Yosemite, My Android NDK version is "r10e", after clone this project, I download the "boost_1_55_0.tar.bz2" and put it inside Boost-for-Android folder

cd Boost-for-Android

basically i need to compile part of boost for android-caffe project with this command:

./build-android.sh /Users/ABC/Work/Libs/android-ndk-r10e --boost=1.55.0 --with-libraries=date_time,math,random,thread,system

error:

Undefined or not supported Android NDK version!

fix:
in "build-android.sh" file, after

    "10 (64-bit)"|"10b (64-bit)"|"10c (64-bit)"|"10d (64-bit)")                 
        TOOLCHAIN=${TOOLCHAIN:-arm-linux-androideabi-4.6}                       
        CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/${PlatformOS}-x86_64/bin/arm-linux-androideabi-g++
        TOOLSET=gcc-androidR8e                                                  
        ;;

add

    "10e (64-bit)")                                                                
        TOOLCHAIN=${TOOLCHAIN:-arm-linux-androideabi-4.9}                          
        CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/${PlatformOS}-x86_64/bin/arm-linux-androideabi-g++
        TOOLSET=gcc-androidR8e                                                     
        ;; 

so that it recognize the newest "r10e" NDK version, and in "r10e" NDK, it only contains androideabi-4.8 and androideabi-4.9, there isn't androideabi-4.6 anymore.

error:

In file included from ./boost/date_time/gregorian/greg_month.hpp:12:0,
                 from libs/date_time/src/gregorian/greg_month.cpp:14:
./boost/date_time/constrained_value.hpp:12:21: fatal error: exception: No such file or directory
 #include <exception>
                     ^
compilation terminated.

    "arm-linux-androideabi-g++"  -ftemplate-depth-128 -D__arm__ -D_REENTRANT -D_GLIBCXX__PTHREADS -O3 -finline-functions -Wno-inline -Wall -fexceptions -frtti -fpic -ffunction-sections -funwind-tables -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I/Users/ABC/Work/Libs/android-ndk-r10e/platforms/android-9/arch-arm/usr/include -Wa,--noexecstack -DANDROID -D__ANDROID__ -DNDEBUG -O2 -g -I/Users/ABC/Work/Libs/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.6/include -I/Users/ABC/Work/Libs/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include -fvisibility=hidden -fvisibility-inlines-hidden -fdata-sections -pthread  -DBOOST_ALL_NO_LIB=1 -DBOOST_DATE_TIME_STATIC_LINK -DDATE_TIME_INLINE -DNDEBUG  -I"." -c -o "bin.v2/libs/date_time/build/gcc-androidR8e/release/link-static/target-os-linux/threading-multi/gregorian/greg_month.o" "libs/date_time/src/gregorian/greg_month.cpp"

...failed gcc.compile.c++ bin.v2/libs/date_time/build/gcc-androidR8e/release/link-static/target-os-linux/threading-multi/gregorian/greg_month.o...

fix:
in "configs/user-config-boost-1_55_0.jam", since the "TOOLSET" for "r10e" is "androidR8e" in "build-android.sh" file, so after

# --------------------------------------------------------------------          
using gcc : androidR8e                                                          
:                                                                               
arm-linux-androideabi-g++ 

i change

<compileflags>-I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/include     
<compileflags>-I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include

to be

<compileflags>-I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.9/include     
<compileflags>-I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include

Actually there is no "/Users/ABC/Work/Libs/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.6/include" and "/Users/ABC/Work/Libs/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include" folders, that's why it cannot find exception.hpp.

about "build-android.py" file: "$PROGDIR" is "Boost-for-Android" folder, "$BOOST_DIR" is "boost_1_xx_x" folder, by default every time you run "./build-android.py" it will delete the "boost_1_xx_x" folder and "build" folder, then unzip the "boost_1_xx_x.tar.bz2" again, which is a bit annoying when you are debugging the compilation errors, you can comment line 148-151

#if [ -d "$PROGDIR/$BOOST_DIR" ]; then                                             
    #echo "Cleaning: $BOOST_DIR"                                                   
    #rm -f -r $PROGDIR/$BOOST_DIR                                                  
#fi

then when you run "build-android.py", it will only delete build folder.

Also by default "build-android.py" will copy "configs/user-configboost-1_xx_x.jam" to be "boost_1_xx_x/tools/build/v2/user-config.jam" in line 353 after apply patches to boost, and it actually calls "boost_1_xx_x/tools/build/v2/user-config.jam" file's configurations when it complies. If you comment the line 148-151 as i mentioned above, running "build-android.py" will not copy jam file anymore, so you will need to change "boost_1_xx_x/tools/build/v2/user-config.jam" instead of "configs/user-configboost-1_xx_x.jam" when fix the second type of error.

After all i only built few modules (date_time,math,random,thread,system), and i got stucked in the second type of error for almost a whole day, as i found in "Boost-for-Android/boost_1_55_0/boost" folder there is also "exception.hpp" file and a "exception" folder, at first i thought it was trying to include this header file instead of the "exception.hpp" in NDK folder, so i tried to include "Boost-for-Android/boost_1_55_0/boost" many times but still got the same error untill i found there is no ".../gnu-libstdc++/4.6/..." folders inside NDK.

I still got a "link.jam: No such file or directory" thing, but the compilation finished and seems all the libraries i need are built, hope it works fine in run time.

@ZhengRui ZhengRui changed the title Share my experience Share my experience Boost 1.55 on OSX 10.10 Yosemite Jun 10, 2015
@francoisvdv
Copy link

Thanks for sharing this, has helped me a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants