2014-10-31 85 views
1

我想建立提升iOS开发,我发现一个自动生成脚本github。 大多数图书馆建立良好,我得到了boost.a。我有测试的asio库,它的工作原理。如何建立提升1.56.0升压::上下文对于iPhone(ARM)

但boost :: coroutine构建失败,事实上boost :: context构建失败并出现此错误。

darwin.compile.c++ iphone-build/boost/bin.v2/libs/context/build/darwin-8.1~iphone/release/architecture-arm/link-static/macosx-version-iphone-8.1/target-os-iphone/threading-multi/unsupported.o libs/context/src/unsupported.cpp:7:2: error: "platform not supported" #error "platform not supported" ^ 1 error generated.

"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" "-arch" "armv7" "-arch" "armv7s" "-arch" "arm64" "-fvisibility=hidden" "-fvisibility-inlines-hidden" "-DBOOST_AC_USE_PTHREADS" "-DBOOST_SP_USE_PTHREADS" "-std=c++11" "-stdlib=libc++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -gdwarf-2 -fexceptions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -pthread -arch arm -DBOOST_ALL_NO_LIB=1 -DBOOST_CONTEXT_SOURCE -DNDEBUG -D_LITTLE_ENDIAN -I"." -c -o "iphone-build/boost/bin.v2/libs/context/build/darwin-8.1~iphone/release/architecture-arm/link-static/macosx-version-iphone-8.1/target-os-iphone/threading-multi/unsupported.o" "libs/context/src/unsupported.cpp" ...failed darwin.compile.c++ iphone-build/boost/bin.v2/libs/context/build/darwin-8.1~iphone/release/architecture-arm/link-static/macosx-version-iphone-8.1/target-os-iphone/threading-multi/unsupported.o...

和升压::方面的要求说我们应该 指定在bjam的命令行某些附加属性:目标-OS,ABI,二进制格式,结构和地址模型。 更改脚本的bjam命令行建立从

./bjam -j16 --build-dir=iphone-build -sBOOST_BUILD_USER_CONFIG=$BOOST_SRC/tools/build/example/user-config.jam --stagedir=iphone-build/stage --prefix=$PREFIXDIR toolset=darwin architecture=arm target-os=iphonemacosx-version=iphone-${IPHONE_SDKVERSION} define=_LITTLE_ENDIAN link=static stage > "${LOG}" 2>&1

./bjam -j16 --build-dir=iphone-build -sBOOST_BUILD_USER_CONFIG=$BOOST_SRC/tools/build/example/user-config.jam --stagedir=iphone-build/stage --prefix=$PREFIXDIR toolset=darwin abi=aapcs binary-format=mach-o address-model=32 architecture=arm target-os=iphone macosx-version=iphone-${IPHONE_SDKVERSION} define=_LITTLE_ENDIAN link=static stage > "${LOG}" 2>&1

现在的编译器做正确的事情,但我得到了另一个错误

darwin.compile.asm iphone-build/boost/bin.v2/libs/context/build/darwin-8.1~iphone/release/abi-aapcs/address-model-32/architecture-arm/link-static/macosx-version-iphone-8.1/target-os-iphone/threading-multi/asm/jump_arm_aapcs_macho_gas.o libs/context/src/asm/jump_arm_aapcs_macho_gas.S:94:11: error: invalid operand for instruction pop v1 ^

"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" "-arch" "armv7" "-arch" "armv7s" "-arch" "arm64" "-fvisibility=hidden" "-fvisibility-inlines-hidden" "-DBOOST_AC_USE_PTHREADS" "-DBOOST_SP_USE_PTHREADS" "-std=c++11" "-stdlib=libc++" -x assembler-with-cpp -O3 -finline-functions -Wno-inline -Wall -gdwarf-2 -fexceptions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -arch arm -DBOOST_ALL_NO_LIB=1 -DBOOST_CONTEXT_SOURCE -DNDEBUG -D_LITTLE_ENDIAN -I"." -c -o "iphone-build/boost/bin.v2/libs/context/build/darwin-8.1~iphone/release/abi-aapcs/address-model-32/architecture-arm/link-static/macosx-version-iphone-8.1/target-os-iphone/threading-multi/asm/jump_arm_aapcs_macho_gas.o" "libs/context/src/asm/jump_arm_aapcs_macho_gas.S" `

不仅仅是pop v1,以及大量的其他编译错误,并在阅读铛的交叉编译文档, 我决定将-target arm-macho添加到auto script线213 现在,只有一个错误pop v1和8个警告这样的:

clang: warning: unknown platform, assuming -mfloat-abi=soft clang: warning: argument unused during compilation: '-arch armv7' clang: warning: argument unused during compilation: '-stdlib=libc++' clang: warning: argument unused during compilation: '-arch arm'

我知道一点点的x86 ASM和我读库/上下文/ src目录/ ASM/jump_arm_aapcs_macho_gas.S,似乎那pop v1应该是pop {v1},我不知道ARM asm,无论如何,我只是想做出这个通过并稍后检查错误。

所以我改变库/上下文/ src目录/ ASM/jump_arm_aapcs_macho_gas.S:94 从pop v1pop {v1}并重新构建这个终于能正常工作。

但只是上下文和协程库建立好。如libs/atomic/src/lockpool.cpp其他图书馆失败,错误

libs/atomic/src/lockpool.cpp:15:10: fatal error: 'cstddef' file not found

作为一个虚拟的驴,我出去的技能。

有人可以帮我解答吗?

我应该链接所有引用,但是我的声望小于10.我不能发布超过2个链接。

+0

你可能想试试这个https://gist.github.com/emersonxsu/7188a128c28485b2533e – 2015-07-26 06:22:42

回答

3

我刚刚设法构建Boost.Context(1.59.0),并对来自GitHub的ofxiOSBoost提供的解决方案进行了一些修改。

与针对建筑物Boost.Context原溶液中存在的问题是:

  1. 构建脚本硬编码的达尔文工具集来使用“铛++”,它只能建立纯C++代码,的汇编代码
  2. 正如您已经想到的那样,构建脚本提供的b2命令行不包含构建Boost的所有需求。上下文,即:ABI,地址,型号,结构,二进制格式,这些要求是用来匹配“上下文/编译/ Jamfile.v2”里面的正确组装源文件
  3. 即使在您正确指定所有的要求,你仍然会得到编译错误,这些错误实际上是通过尝试使用硬编码的clang ++来编译程序集源代码而产生的 - btw,你不应该修改原始程序集源代码来看它编译。
  4. 里面上下文/编译/ Jamfile.v2,你必须建立汇编代码直列,而不是使用铛++。幸运的是,相同的文件教你如何建立汇编源代码内嵌里面的一些很好的例子,所以最终铛++只会看到生成的目标文件和工具链其余管道能够愉快地使用它们。

我贴我在Boost.Context的Jamfile下面所做的修改(你应该足够聪明弄清楚在哪里把这些部分):

actions gasarmv7 
{ 
    cpp -x assembler-with-cpp "$(>)" | as -arch armv7 -o "$(<)" 
} 

actions gasarm64 
{ 
    cpp -x assembler-with-cpp "$(>)" | as -arch arm64 -o "$(<)" 
} 

-

# ARM DARWIN 32_64 
alias asm_context_sources 
    : [ make asm/make_arm_aapcs_macho_gas.o : asm/make_arm_aapcs_macho_gas.S : @gasarmv7 ] 
    [ make asm/jump_arm_aapcs_macho_gas.o : asm/jump_arm_aapcs_macho_gas.S : @gasarmv7 ] 
    [ make asm/make_arm64_aapcs_macho_gas.o : asm/make_arm64_aapcs_macho_gas.S : @gasarm64 ] 
    [ make asm/jump_arm64_aapcs_macho_gas.o : asm/jump_arm64_aapcs_macho_gas.S : @gasarm64 ] 
    : <abi>aapcs 
    <address-model>32_64 
    <architecture>arm 
    <binary-format>mach-o 
    <toolset>darwin 
    ; 

下面是对build-libC++的修改sh:

建议使用Boost 1.58.0+,因为它增加了Boost.Context支持吨arm64

BOOST_V1=1.59.0 
BOOST_V2=1_59_0 

-

buildBoostForIPhoneOS() 
{ 
    cd $BOOST_SRC 

    # Install this one so we can copy the includes for the frameworks... 


    set +e  
    echo "------------------" 
    LOG="$LOGDIR/build-iphone-stage.log" 
    echo "Running bjam for iphone-build stage" 
    echo "To see status in realtime check:" 
    echo " ${LOG}" 
    echo "Please stand by..." 
    ./bjam -j${PARALLEL_MAKE} --build-dir=iphone-build -sBOOST_BUILD_USER_CONFIG=$BOOST_SRC/tools/build/example/user-config.jam --stagedir=iphone-build/stage --prefix=$PREFIXDIR --toolset=darwin-${IPHONE_SDKVERSION}~iphone cxxflags="-stdlib=$STDLIB" variant=release linkflags="-stdlib=$STDLIB" architecture=arm address-model=32_64 abi=aapcs binary-format=mach-o target-os=iphone macosx-version=iphone-${IPHONE_SDKVERSION} define=_LITTLE_ENDIAN link=static stage > "${LOG}" 2>&1 
    if [ $? != 0 ]; then 
     tail -n 100 "${LOG}" 
     echo "Problem while Building iphone-build stage - Please check ${LOG}" 
     exit 1 
    else 
     echo "iphone-build stage successful" 
    fi 

    echo "------------------" 
    LOG="$LOGDIR/build-iphone-install.log" 
    echo "Running bjam for iphone-build install" 
    echo "To see status in realtime check:" 
    echo " ${LOG}" 
    echo "Please stand by..." 
    ./bjam -j${PARALLEL_MAKE} --build-dir=iphone-build -sBOOST_BUILD_USER_CONFIG=$BOOST_SRC/tools/build/example/user-config.jam --stagedir=iphone-build/stage --prefix=$PREFIXDIR --toolset=darwin-${IPHONE_SDKVERSION}~iphone cxxflags="-stdlib=$STDLIB" variant=release linkflags="-stdlib=$STDLIB" architecture=arm address-model=32_64 abi=aapcs binary-format=mach-o target-os=iphone macosx-version=iphone-${IPHONE_SDKVERSION} define=_LITTLE_ENDIAN link=static install > "${LOG}" 2>&1 
    if [ $? != 0 ]; then 
     tail -n 100 "${LOG}" 
     echo "Problem while Building iphone-build install - Please check ${LOG}" 
     exit 1 
    else 
     echo "iphone-build install successful" 
    fi 
    doneSection 

    echo "------------------" 
    LOG="$LOGDIR/build-iphone-simulator-build.log" 
    echo "Running bjam for iphone-sim-build " 
    echo "To see status in realtime check:" 
    echo " ${LOG}" 
    echo "Please stand by..." 
    ./bjam -j${PARALLEL_MAKE} --build-dir=iphonesim-build -sBOOST_BUILD_USER_CONFIG=$BOOST_SRC/tools/build/example/user-config.jam --stagedir=iphonesim-build/stage --toolset=darwin-${IPHONE_SDKVERSION}~iphonesim architecture=x86 address-model=32_64 binary-format=mach-o abi=sysv target-os=iphone variant=release macosx-version=iphonesim-${IPHONE_SDKVERSION} link=static stage > "${LOG}" 2>&1 
    if [ $? != 0 ]; then 
     tail -n 100 "${LOG}" 
     echo "Problem while Building iphone-simulator build - Please check ${LOG}" 
     exit 1 
    else 
     echo "iphone-simulator build successful" 
    fi 

    doneSection 
} 

要特别注意上面的B2命令行(要求在那里指定匹配Boost.Context Jamfile.v2变化。

此外,由于原始构建脚本总是尝试下载和解压缩存档,因此您需要将修改保存到某处的Boost.Context Jamfile.v2并重新应用,或者第二次运行(下载,解压缩,并提供有关修补提升至少一次后):

#cleanEverythingReadyToStart #may want to comment if repeatedly running during dev 
#restoreBoost 

#downloadBoost 
#unpackBoost 
#inventMissingHeaders 
prepare 
bootstrapBoost 
#updateBoost 
buildBoostForIPhoneOS 
scrunchAllLibsTogetherInOneLibPerPlatform 
buildIncludes 

#restoreBoost 

#postcleanEverything 

再次,请从https://github.com/danoli3/ofxiOSBoost获得最新版本,并使用升压1.59.0

希望这有助于!