在Android的NDK与Windows中使用升压 [英] Using Boost in android ndk with windows
问题描述
我想使用boost库的Android NDK在Eclipse中使用Windows。我试图按照本教程
I am trying to use boost library with Android ndk in Eclipse with Windows. I tried to follow this tutorial
我被困在Cygwin中的bjam命令的步骤。
I am stuck in the step with "bjam" command in cygwin.
的bjam --without-蟒蛇--without序列化工具= GCC-android4.4.3链接=静态运行时链接=静态目标-OS = Linux的--stagedir =机器人
bjam --without-python --without-serialization toolset=gcc-android4.4.3 link=static runtime-link=static target-os=linux --stagedir=android
错误:的bjam命令没有发现
Error: bjam command not found.
什么是的bjam?此外,我所用的升压1.53沿NDK R8E。有人可以帮我这个好吗?
What is bjam? Also I used the boost 1.53 along ndk r8e. Can someone help me with this please?
推荐答案
的Android NDK不再依赖于Cygwin的,这样你就可以从Windows命令提示符( CMD $建设加速与NDK C $ C>)。
Android NDK is no longer dependent on Cygwin, so you can build Boost with the NDK from within Windows command prompt (cmd
).
为了使 Boost.Build
找到NDK,编辑升压\工具\编译\ V2 \用户config.jam中
文件并添加以下文本:
In order to make Boost.Build
find the NDK, edit boost\tools\build\v2\user-config.jam
file and append the following text:
import os ;
androidNDKRoot = C:/android-ndk-r8e ; # put the relevant path
using gcc : android :
$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.7/prebuilt/windows/bin/arm-linux-androideabi-g++ :
<compileflags>--sysroot=$(androidNDKRoot)/platforms/android-9/arch-arm
<compileflags>-mthumb
<compileflags>-Os
<compileflags>-fno-strict-aliasing
<compileflags>-O2
<compileflags>-DNDEBUG
<compileflags>-g
<compileflags>-lstdc++
<compileflags>-I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.7/include
<compileflags>-I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi/include
<compileflags>-D__GLIBC__
<compileflags>-D_GLIBCXX__PTHREADS
<compileflags>-D__arm__
<compileflags>-D_REENTRANT
<archiver>$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.7/prebuilt/windows/bin/arm-linux-androideabi-ar
<ranlib>$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.7/prebuilt/windows/bin/arm-linux-androideabi-ranlib
;
当然,不是 C:/ Android的NDK-R8E
你必须把NDK的正确的位置您的PC上。
Certainly, instead of c:/android-ndk-r8e
you have to put the right location of the NDK on your PC.
另外,你可以选择,而不是的android-9
最近平台的API。
Besides, you can select more recent platform API, instead of android-9
.
另外请注意,NDK提供了几个工具链,以及上面的设置指向GCC-4.7。如果preFER打造提升,有一些其他的工具链,变 ARM-Linux的androideabi-4.7
相关路径。
Also note that the NDK supplies several tool-chains, and the above settings point to gcc-4.7. If you prefer to build boost with some other tool-chain, change arm-linux-androideabi-4.7
to the relevant path.
您已经把配置在用户config.jam中后,打开 CMD
,光盘
的目录其中,升压居住,并调用引导
。然后调用 B2
像这样(例如):
After you've put the configuration in user-config.jam, open cmd
, cd
to the directory where Boost resides, and invoke bootstrap
. Then invoke b2
like this (for example):
B2 --without-蟒蛇--without序列化线程=多连杆=静态运行时链接=静态工具= GCC-android的目标OS = Linux的threadapi = pthread的--stagedir =安卓阶段
更新:作为二千〇一十五分之十一,老年NDK工具链似乎有问题与较新版本的加速,导致编译器崩溃,所以请考虑使用较新的编译器。要做到这一点,只是改变每4.7出现在上面的脚本到4.9。此外,它的价值有一个更近的Android API编译(如andoroid-9 - > andoroid-16左右)。
UPDATE: As of 11/2015, older NDK toolchains seem to have issues with the newer Boost versions, causing compiler crash, so consider using a more recent compiler. To do this, just change every 4.7 occurrence in the above script to 4.9. Also, it's worth compiling with a more recent Android API (eg. andoroid-9 -> andoroid-16 or so).
这篇关于在Android的NDK与Windows中使用升压的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!