Arm

使用 CodeSourcery 交叉編譯 TinyCC 的問題

  • May 19, 2017

我正在嘗試使用以下命令交叉編譯homas Preud’homme 的 TinyCC 版本

./configure --cc=arm-none-linux-gnueabi-gcc --prefix=/home/shushant/tinycc/tc

並在執行後顯示以下錯誤消息make install

make: Circular Makefile <- Makefile dependency dropped.
make -C lib native
make[1]: Entering directory `/home/shushant/tinycc/lib' arm-none-linux-gnueabi-gcc -c alloca86_64.S -o x86_64/alloca86_64.o -I..  -Wall -g -O2 -fno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -DTCC_TARGET_X86_64
alloca86_64.S: Assembler messages:
alloca86_64.S:7: Error: expression too complex -- `pop %rdx'
alloca86_64.S:11: Error: ARM register expected -- `mov %rdi,%rax'
alloca86_64.S:13: Error: ARM register expected -- `add $15,%rax'
alloca86_64.S:14: Error: ARM register expected -- `and $-16,%rax'
alloca86_64.S:15: Error: bad instruction `jz p3'
alloca86_64.S:28: Error: ARM register expected -- `sub %rax,%rsp'
alloca86_64.S:29: Error: ARM register expected -- `mov %rsp,%rax'
alloca86_64.S:35: Error: expression too complex -- `push %rdx'
alloca86_64.S:36: Error: bad instruction `ret'
alloca86_64.S:40: Error: junk at end of line, first unrecognized character is `,'
make[1]: *** [x86_64/alloca86_64.o] Error 1
make[1]: Leaving directory `/home/shushant/tinycc/lib'
make: *** [libtcc1.a] Error 2

一些如何成功生成二進製文件但在錯誤的目錄(在根目錄/home/shushant/tinycc)而不是/home/shushant/tinycc/tc當我嘗試在android模擬器上執行時,它的顯示file not found當然生成的二進製文件不受設備支持。我該如何解決?

錯誤消息顯示您想使用不起作用的 ARM 編譯器為您的平台 (x86/64) 編譯程式碼。配置腳本沒有猜到正確的目標(“TCC_TARGET_X86_64”而不是 ARM 目標)。

可能,您需要--cpu=armv7a(或您確切擁有的)選項和/或--cross-prefix=arm-none-linux-gnueabi-選項。之前,執行make clean.

引用自:https://unix.stackexchange.com/questions/101738