簡體   English   中英

如何交叉編譯GCC以生成iOS設備的libgfortran(arm,armv7)?

[英]How can I cross-compile GCC to produce libgfortran for iOS devices (arm, armv7)?

我需要編譯Fortran-77子程序才能在iOS上訪問。 我正在使用GCC和DragonEgg插件,因此我可以將gfortran與LLVM后端一起使用。 我按照這個答案但是在為armv7,armv7s和arm64構建libgfortran時我陷入困境。

  • 我可以單獨構建libgfortran還是總是需要完全編譯GCC套件?
  • 為不同的目標生成此庫的正確方法是什么? 是否可以在此步驟中使用GCC,或者我需要LLVM作為arm * -targets?

使用GCC使用arm-targets構建GCC我得到以下錯誤:

./configure --prefix=/tmp/out --host=arm-apple-darwin --enable-languages=fortran
make
…
make[2]: arm-apple-darwin-ar: No such file or directory
make[2]: *** [libiberty.a] Error 1
make[1]: *** [all-libiberty] Error 2

使用LLVM使用arm-targets構建GCC我遇到配置問題:

export CC="$(xcrun -sdk iphoneos -find clang)"
export CPP="$CC -E"
export CFLAGS="-arch armv7 -arch armv7s -arch arm64 -isysroot $(xcrun --sdk iphoneos --show-sdk-path) -miphoneos-version-min=9.2"
export AR=$(xcrun -sdk iphoneos -find ar)
export RANLIB=$(xcrun -sdk iphoneos -find ranlib)
export CPPFLAGS="-arch armv7 -arch armv7s -arch arm64 -isysroot $(xcrun --sdk iphoneos --show-sdk-path) -miphoneos-version-min=9.2"
export LDFLAGS="-arch armv7 -arch armv7s -arch arm64 -isysroot $(xcrun --sdk iphoneos --show-sdk-path)"

./configure --prefix=/tmp/out --enable-languages=fortran --host=arm-apple-darwin --disable-shared
…
checking how to run the C preprocessor... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -E
configure: error: in `/Users/timo/temp/gcc-4.8.5-build/fixincludes':
configure: error: C preprocessor "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -E" fails sanity check
See `config.log' for more details.
make[1]: *** [configure-fixincludes] Error 1

配置腳本說明了這一點

configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
  • 如果檢測到交叉編譯器是什么意思? 如何正確定義目標平台?
  • LLVM使用-arch armv7等作為目標定義。 使用GCC時什么是結合?

您正在嘗試構建沒有交叉binutils的跨gcc庫。 是一個很好的手冊,用於建立交叉gcc的手臂,你可以遵循它。

如果檢測到交叉編譯器是什么意思? 如何正確定義目標平台?

配置時,還應設置--target=arm-apple-darwin (根據我自己的經驗,我沒有設置--host

make[2]: arm-apple-darwin-ar: No such file or directory

在構建arm交叉編譯器目標庫之前,您應該為此目標構建binutils。

關於llvm什么都不能說。

因此,只需嘗試在上面的鏈接中完成所有步驟。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM