[Boost-users] Boost + Android NDK

820 vistas
Ir al primer mensaje no leído

NuSkooler

no leída,
17 may 2010, 11:54:10 a.m.17/5/2010
para boost...@lists.boost.org
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 mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

--
You received this message because you are subscribed to the Google Groups "BOOST Archives" group.
To post to this group, send email to boost...@googlegroups.com.
To unsubscribe from this group, send email to boost-list+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/boost-list?hl=en.

Felipe Magno de Almeida

no leída,
17 may 2010, 1:13:17 p.m.17/5/2010
para boost...@lists.boost.org

NuSkooler <nusk...@gmail.com> writes:
>

[snip]

> 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!

Are you using the trunk's version of STLPort? The STLPort in trunk has
modifications for use in android. Though it assumes it doesn't have RTTI
and exceptions.
You would need to add -D__ANDROID__ as well, since it is this that
STLPort checks for.
I'm still trying to compile and your email was *very* valuable.
Maybe creating a android.jam in the tools/ dir in boost.build would be
better.

Regards,
--
Felipe Magno de Almeida

Felipe Magno de Almeida

no leída,
18 may 2010, 6:41:41 a.m.18/5/2010
para boost...@lists.boost.org
On Mon, May 17, 2010 at 2:13 PM, Felipe Magno de Almeida
<felipe....@tqtvd.com> wrote:
>
> NuSkooler <nusk...@gmail.com> writes:
>>

[snip]

>> 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!

You don't need STLPort. The Crystax NDK already has a full STL.
My user-config.jam looks like this now:

using gcc : androidcrystax :
/opt/android-ndk-crystax/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/arm-eabi-g++
:
<cxxflags>-D_LITTLE_ENDIAN
<cxxflags>-I/opt/android-ndk-crystax/build/platforms/android-5/arch-arm/usr/include/
<cflags>-nostdlib
<cxxflags>-fPIC
#<cxxflags>-mthumb-interwork
<cxxflags>-ffunction-sections
<cxxflags>-funwind-tables
<cxxflags>-fstack-protector
<cxxflags>-DBOOST_THREAD_LINUX
<cxxflags>-DBOOST_HAS_PTHREADS
<cxxflags>-D__arm__
<cxxflags>-D_REENTRANT
<cxxflags>-D_GLIBCXX__PTHREADS
#<cxxflags>-DBOOST_HAS_GETTIMEOFDAY
#<cxxflags>-DBOOST_HAS_THREADS
<cxxflags>-DANDROID
<cxxflags>-D__ANDROID__
<cxxflags>--sysroot=/opt/android-ndk-crystax/build/platforms/android-5/arch-arm
#<cxxflags>-D_NEW
#<cxxflags>-D__SGI_STL_INTERNAL_PAIR_H
<cxxflags>-fno-short-enums
<cxxflags>-D__ARM_ARCH_5__
<cxxflags>-D__ARM_ARCH_5T__
<cxxflags>-D__ARM_ARCH_5E__
<cxxflags>-D__ARM_ARCH_5TE__
<cxxflags>-march=armv5te
<cxxflags>-mtune=xscale
<cxxflags>-msoft-float
<cxxflags>-mthumb
<cxxflags>-fomit-frame-pointer
<cxxflags>-fno-strict-aliasing
<architecture>arm
<linkflags>-lc
<linkflags>-nostdlib
<linkflags>-Wl,-rpath-link=/opt/android-ndk-crystax/build/platforms/android-5/arch-arm/usr/lib/
<linkflags>-L/opt/android-ndk-crystax/build/platforms/android-5/arch-arm/usr/lib/
<linkflags>/opt/android-ndk-crystax/build/prebuilt/linux-x86/arm-eabi-4.4.0/arm-eabi/lib/libsupc++.a
<linkflags>/opt/android-ndk-crystax/build/prebuilt/linux-x86/arm-eabi-4.4.0/arm-eabi/lib/libstdc++.a
<linkflags>/opt/android-ndk-crystax/build/prebuilt/linux-x86/arm-eabi-4.4.0/lib/gcc/arm-eabi/4.4.0/libgcc.a
<linkflags>/opt/android-ndk-crystax/build/platforms/android-5/arch-arm/usr/lib/libc.so
<linkflags>/opt/android-ndk-crystax/build/platforms/android-5/arch-arm/usr/lib/libm.so
<linkflags>-Wl,--no-undefined
<linkflags>-Wl,--whole-archive
<linkflags>-Wl,--no-whole-archive
<linkflags>-Wl,-shared,-Bsymbolic
;

Some modifications should go to tools/gcc.jam though

[snip]
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos