Boost logo

Boost Users :

Subject: [Boost-users] Boost + Android NDK
From: NuSkooler (nuskooler_at_[hidden])
Date: 2010-05-17 11:54:10


I've searched the archives quite a bit and haven't run into any
answers to this -- if I'm missing something please let me know.

I've been working on getting Boost to work with the Android NDK
(modified "Crystax" version with RTTI & exceptions) under Cygwin. I
now have it working, but what I've come up with seems to be very messy
and a couple of the modifications break the standard Linux build. I'm
hoping someone can provide pointers to clean this up a bit (and/or
this may be useful to anyone out there trying to do the same thing).

Step 1: I had to build bjam.exe under Cygwin. This required the
following simple patch:

--- c:\Unzipped\boost-build\jam_src\expand.c 2007-09-30 23:12:48.000000000 -0600
+++ c:\dev\ghoti\client\external\boost-build\jam_src\expand.c 2010-04-29
14:25:38.322025800 -0600
@@ -749,7 +749,7 @@
     assert(l != 0);
     assert(list_next(l) == 0);
     # ifdef OS_CYGWIN
- assert( !strcmp( l->string, "c:\\foo\\bar" ) );
+ //assert( !strcmp( l->string, "c:\\foo\\bar" ) );
     # else
     assert( !strcmp( l->string, cygpath ) );
     # endif

Step 2: Build Boost under Cygwin against the modified NDK:

user-config.jam - Added this entry:

# Android ARM Linux Compiler
using gcc : arm :
/cygdrive/c/dev/ghoti/client/external/android/android-ndk-r3-crystax/build/prebuilt/windows/arm-eabi-4.4.0/bin/arm-eabi-g++
: \
<cxxflags>-I$NDK_ROOT/build/platforms/android-5/arch-arm/usr/include/ \
<cflags>-nostdlib \
<cxxflags>-DBOOST_THREAD_LINUX \
<cxxflags>-DBOOST_HAS_PTHREADS \
<cxxflags>-pthread \
<cxxflags>-D__arm__ \
<cxxflags>-D_REENTRANT \
<cxxflags>-D_GLIBCXX__PTHREADS \
<cxxflags>-DBOOST_HAS_GETTIMEOFDAY \
<cxxflags>-DBOOST_HAS_THREADS \
<cxxflags>-DANDROID \
<cxxflags>--sysroot=$NDK_ROOT/build/platforms/android-5/arch-arm
<cxxflags>-D__NEW__ \
<cxxflags>-D__SGI_STL_INTERNAL_PAIR_H \
<cxxflags>-fno-short-enums \
<architecture>arm \
<linkflags>-lc \
<linkflags>-nostdlib \
<linkflags>-Wl,-rpath-link=$NDK_ROOT/build/platforms/android-5/arch-arm/usr/lib/
\
<linkflags>-L$NDK_ROOT/build/platforms/android-5/arch-arm/usr/lib/ \
;

Don't need to link in librt:

--- c:\Unzipped\boost_1_42_0\tools\build\v2\tools\gcc.jam 2009-10-28
01:47:51.602868000 -0600
+++ c:\dev\ghoti\client\external\boost_1_42_0\tools\build\v2\tools\gcc.jam 2010-04-30
15:37:39.383973800 -0600
@@ -906,7 +906,8 @@
             case * :
             {
                 option = -pthread ;
- libs = rt ;
+ # BDA:
+ #libs = rt ;
             }
         }

-----

--- c:\Unzipped\boost_1_42_0\tools\build\v2\tools\stlport.jam 2009-05-22
05:36:46.841847000 -0600
+++ c:\dev\ghoti\client\external\boost_1_42_0\tools\build\v2\tools\stlport.jam 2010-04-30
15:30:31.864521000 -0600
@@ -198,7 +198,9 @@

             # name: stlport_<toolset>(_stldebug)?
             local name = stlport ;
- name = $(name)_$(toolset) ;
+ # BDA:
+ #name = $(name)_$(toolset) ;
+
             if [ feature.get-values <runtime-debugging> : $(raw) ] = "on"
             {
                 name = $(name)_stldebug ;

Building:
bjam toolset=gcc-arm target-os=linux stdlib=stlport define=_LITTLE_ENDIAN

Again, all of this seems very messy. Some of it may not even be
necessary. STLPort was something I was messing with; I'm not sure if
it's ultimately required (the patch/stdllib=stlport).

Any pointers greatly appreciated!


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net