在android ndk中使用Boost与windows
Using Boost in android ndk with windows
我正在尝试在Eclipse和Windows中使用Android ndk的boost库。我试着遵循这个教程
我被cygwin中的"bjam"命令卡住了。
bjam--没有python--没有序列化工具集=gcc-android4.4.3链接=静态运行时链接=静态目标os=linux--stagedir=android
错误:找不到bjam命令。
什么是bjam?此外,我使用了增强1.53沿着ndk r8e。有人能帮我做这个吗?
Android NDK不再依赖Cygwin,因此您可以在Windows命令提示符(cmd
)中使用NDK构建Boost。
为了使Boost.Build
找到NDK,编辑boosttoolsbuildv2user-config.jam
文件并附加以下文本:
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
;
当然,你必须把NDK的正确位置放在你的电脑上,而不是c:/android-ndk-r8e
。
此外,您可以选择更新的平台API,而不是android-9
。
还要注意,NDK提供了几个工具链,上面的设置指向gcc-4.7。如果您更喜欢使用其他工具链构建boost,请将arm-linux-androideabi-4.7
更改为相关路径。
将配置放入user-config.jam后,将cmd
、cd
打开到Boost所在的目录,然后调用bootstrap
。然后像这样调用b2
(例如):
b2 --without-python --without-serialization threading=multi link=static runtime-link=static toolset=gcc-android target-os=linux threadapi=pthread --stagedir=android stage
更新:截至2015年11月,较旧的NDK工具链似乎与较新的Boost版本存在问题,导致编译器崩溃,因此请考虑使用较新的编译器。要做到这一点,只需将上面脚本中每出现4.7次更改为4.9次。此外,值得使用更新的Android API进行编译(例如andoid-9->andoid-16左右)。
- 如何在 Linux for Windows 上通过 MinGW 构建静态 ICU 的 Boost
- CMake 在 Windows 上的自定义位置上找不到 Boost
- 在 Julia 中使用 boost 库和 Windows 上的 Cxx.jl
- Boost::process on Windows - with MinGW?
- 在 Windows 中使用 boost::p rogram_options 从命令行参数读取 Unicode 字符
- 在Windows 10上使用Visual Studio 2019的Boost 1.71.0库出现错误
- 在 Windows 10 上安装 Boost 时遇到问题
- Build Boost Regex for Windows VS2013
- boost::stacktrace on Windows MSVS 2017
- boost zlib filter 在 Windows 中不起作用
- 如何将Windows GUID转换为boost::uuid?
- C++ Boost:在Windows中对boost::system::generic_category()的未定义引用
- 无法在Windows中找到来自cmake的MySQL和Boost包含/库
- 在 Windows 上使用 Boost python3 和 numpy3 库时,VS2015 中LNK2019未解析的外
- 无法在 Windows 上使用英特尔编译器编译示例 boost::多精度
- 在 Windows 中使用 boost::asio 实现最佳缓冲区大小
- 仅使用boost.datetime在Windows上有错误
- Boost, Windows, and QtCreator
- 简单的客户端/服务器在传输中丢失线路(boost/Windows)
- WinSock.h已经包含了Boost Windows Qt