2014-10-31 87 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

希望這有助於!