ubuntu16.04编译boost for Android(boost 1.65)
生活随笔
收集整理的這篇文章主要介紹了
ubuntu16.04编译boost for Android(boost 1.65)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
下載boost源碼
在官網下載指定版本的源碼
http://www.boost.org/users/history/
編譯boost源碼
1.進入源碼目錄執行./bootstrap.sh生成編譯工具
2.編輯project-config.jam文件,替換如下內容
# define platform name of ndk import os ; if [ os.name ] = CYGWIN || [ os.name ] = NT {androidPlatform = windows-x86_64 ; } else if [ os.name ] = LINUX {androidPlatform = linux-x86_64 ; } else if [ os.name ] = MACOSX {androidPlatform = darwin-x86 ; }# replace with your own ndk path.eg:/usr/ndk/android-ndk-r12b ANDROID_NDK = "/path/to/your/dnk" ;# compile with gcc, you can change compiler to clang or others using gcc : android4.9 : $(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.9/prebuilt/$(androidPlatform)/bin/arm-linux-androideabi-g++ : <archiver>$(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.9/prebuilt/$(androidPlatform)/bin/arm-linux-androideabi-ar <ranlib>$(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.9/prebuilt/$(androidPlatform)/bin/arm-linux-androideabi-ranlib <compileflags>-I$(ANDROID_NDK)/platforms/android-21/arch-arm/usr/include <compileflags>-I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.9/include <compileflags>-I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.9/include/backward <compileflags>-I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include <compileflags>-fexceptions <compileflags>-frtti <compileflags>-fpic <compileflags>-ffunction-sections <compileflags>-funwind-tables <compileflags>-D__ARM_ARCH_5__ <compileflags>-D__ARM_ARCH_5T__ <compileflags>-D__ARM_ARCH_5E__ <compileflags>-D__ARM_ARCH_5TE__ <compileflags>-D__ARM_ARCH_7__ <compileflags>-D__ARM_ARCH_7A__ <compileflags>-Wno-psabi <compileflags>-march=armv7-a <compileflags>-mtune=xscale <compileflags>-mfloat-abi=softfp <compileflags>-marm <compileflags>-mthumb <compileflags>-Os <compileflags>-std=gnu++11 <compileflags>-fomit-frame-pointer <compileflags>-fno-strict-aliasing <compileflags>-finline-limit=64 <compileflags>-Wa,--noexecstack <compileflags>-DANDROID <compileflags>-D__ANDROID__ <compileflags>-D__ARM_EABI__ <compileflags>-DNDEBUG <compileflags>-O2 <compileflags>-g ;# project default compiler project : default-build <toolset>gcc-android4.9 ;# replace with libraries you wanna to build libraries = --with-container --with-coroutine --with-fiber --with-graph --with-graph_parallel --with-log --with-metaparse --with-python --with-test --with-type_erasure --with-atomic --with-date_time --with-program_options --with-chrono --with-context --with-iostreams --with-locale --with-mpi --with-serialization --with-signals --with-timer --with-wave --with-math --with-random --with-exception --with-filesystem --with-thread --with-system --with-regex --with-program_options3、執行以下命令
./b2 toolset=gcc-android4.9 link=static threading=multi target-os=linux --stagedir=android_build
toolset表示指定編譯工具,link表示編譯成靜態庫,threading表示使用多線程編譯,–stagedir表示指定編譯文件生成目錄名
4、將編譯好的boost庫放到指定文件夾下便于引用
sudo ./b2 install --prefix=/your/path/to/install
eg:
sudo ./b2 install --prefix=/usr/boost/android_boost
這樣在使用的時候,可以將該路徑加入到你的代碼中去查找相關的庫等。
參考:https://github.com/teamarkstudio/boost_for_android
總結
以上是生活随笔為你收集整理的ubuntu16.04编译boost for Android(boost 1.65)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 女机械带什么粉饰品比较好?
- 下一篇: 《守卫者浮出水面》定档8月14日 靳东演