ios boost编译

本文介绍了如何在iOS项目中编译Boost库,特别是针对iOS 7.1及更高版本。首先,从指定链接下载boost_1.56.0,然后在终端中进行一系列配置,包括修改user-config.jam文件以支持模拟器和真机编译。使用./bootstrap.sh初始化,设置SDK_VERSION,最后运行bjam命令进行编译。注意,编译过程可能会产生警告,但最终会生成所需的静态库。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

        最近项目中用到了c++一些底层文件,但是这些底层文件需要c++的boost库的支持。因此自己在网上参考了许多资料,整合一些有关boost库的编译过程。

        首先编译库最低适配ios7.1,编译的boost库为boost_1.56.0为最新的,http://sourceforge.net/projects/boost/files/boost/1.56.0/(建议用这个地址下的比较快)

       【温馨提醒:升级到Xcode4.3和iOS SDK5.1之后,开发环境最大的区别是SDK的目录由Developer/Platform/xx变成了Applications/Xcode.app/Contents/Developer/Platform/xxx


        解压下载好的boost_1.56zip文件(一般本人喜欢放到桌面上),打开控制台

         cd: ~/boost_1_56_0的目录下面

         cd:   tools/build/example  (老版本是在tools/build/v2下)

         open user-config.jam

         #模拟器编译

         using darwin : 7.1~iphonesim
: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 -DBOOST_SP_USE_PTHREADS              -DBOOST_THREAD_DONT_USE_ATOMIC -std=c++11 -stdlib=libc++
: <striper> <root>/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer
: <architecture>x86 <target-os>iphone
;

          #真机编译添加

using darwin : 7.1~iphone
: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch armv7 -arch armv7s -arch arm64 -DBOOST_SP_USE_PTHREADS -std=c++11 -stdlib=libc++
: <striper> <root>/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
: <architecture>arm <target-os>iphone


     保存然后返回到 cd: ~/boost_1_56_0下面

     终端输入:./bootstrap.sh

     此时在同一级目录下面出现文件project-config.jam  该文件是对b2 和 bjam两个文件的配置信息。

     终端输入:export SDK_VERSION="7.1"

     终端输入:(模拟器版本)。。。。。。。。。。。。

                         (真机版本)./bjam link=static threading=multi variant=release address-model=$bitlevel toolset=darwin runtime-link=static

     敲击回车开始编译,时间会有点长,编译过程中会有很多的警告,会等到你想要的结果的。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值