Linux下交叉编译环境配置及boost库的配置
2018-01-18 15:28
597 查看
一:首先安装好NDK。
1.1NDK下载地址:
https://developer.android.com/ndk/index.html
1.2下载后的配置方式参考下文:
http://blog.sina.com.cn/s/blog_4a0a39c30101q1u4.html
二:配置boost库的交叉编译
2.1 boost库下载地址
http://www.boost.org/users/download/
2.2 下载后的配置方式:
2.2.1. 解压boost压缩包
2.2.2 进入目录执行./bootstrap.sh, 此时形成bjam文件和project-config.jam
2.2.3. 编辑project-config.jam, 仅修改using gcc这行。因为我使用的是,所以将其改以下即可:
using gcc : arm : arm-linux-androideabi-g++ ; (注意空格)
2.2.4. 执行./bjam 或者 ./bjam stage –layout=tagged –build-type=complete (好像是后者生成的库文件更多)
2.2.5. 形成的静态和动态库文件就在stage目录下.
2.2.6 编写一个测试文档
test.cpp
2.2.7 编译该测试文档;输入指令
至此如果编译成功,说明boost库的交叉编译环境下的配置成功了
1.1NDK下载地址:
https://developer.android.com/ndk/index.html
1.2下载后的配置方式参考下文:
http://blog.sina.com.cn/s/blog_4a0a39c30101q1u4.html
二:配置boost库的交叉编译
2.1 boost库下载地址
http://www.boost.org/users/download/
2.2 下载后的配置方式:
2.2.1. 解压boost压缩包
2.2.2 进入目录执行./bootstrap.sh, 此时形成bjam文件和project-config.jam
2.2.3. 编辑project-config.jam, 仅修改using gcc这行。因为我使用的是,所以将其改以下即可:
using gcc : arm : arm-linux-androideabi-g++ ; (注意空格)
2.2.4. 执行./bjam 或者 ./bjam stage –layout=tagged –build-type=complete (好像是后者生成的库文件更多)
2.2.5. 形成的静态和动态库文件就在stage目录下.
2.2.6 编写一个测试文档
test.cpp
#include <boost/thread.hpp> #include <iostream> void wait(int seconds) { boost::this_thread::sleep(boost::posix_time::seconds(seconds)); } void thread() { for (int i = 0; i < 5; ++i) { wait(1); std::cout << i << std::endl; } } int main() { boost::thread t(thread); t.join(); }
2.2.7 编译该测试文档;输入指令
arm-linux-androideabi-gcc -I path/to/boost_1_66_0 test.cpp -o test -L~/boost/stage/lib/ -lboost_system -lboost_thread
至此如果编译成功,说明boost库的交叉编译环境下的配置成功了
相关文章推荐
- 在linux上配置arm交叉编译虚拟环境
- Openwrt 交叉编译环境的配置 linux
- 嵌入式linux的交叉编译环境配置
- Linux arm-linux交叉编译环境的配置
- Linux + Eclipse 配置交叉编译环境
- arm_linux 交叉编译环境配置
- 在linux 上编译生成windows上运行的exe程序,交叉编译环境的配置( 平台:gentoo linux)
- 嵌入式Linux交叉编译环境配置
- Linux下配置交叉编译环境,配置编译内核及uboot安装
- Ubuntu,TQ2440,arm-linux,Qt交叉编译环境配置
- 配置 arm-linux-gcc 交叉编译环境
- Ubuntu配置安装ARM Linux交叉编译环境完整流程
- Linux + Eclipse 配置交叉编译环境
- arm-linux交叉编译环境的配置
- 配置linux交叉编译环境
- Linux 交叉编译环境详细配置
- Linux 交叉编译环境详细配置
- Arm-Linux(树莓派)交叉编译环境的配置
- Linux + Eclipse 配置交叉编译环境
- cmake 配置arm-linux-gcc 交叉编译环境