使用CodeSourcery交叉编译TinyCC的问题

使用CodeSourcery交叉编译TinyCC的问题

我正在尝试交叉编译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当然是设备不支持生成的二进制文件。我该如何修复它?

答案1

该错误消息表明您想要使用 ARM 编译器为您的平台 (x86/64) 编译代码,但该编译器不起作用。配置脚本未猜测正确的目标(“TCC_TARGET_X86_64”而不是 ARM 目标)。

也许,您需要--cpu=armv7a(或您确切拥有的)选项和/或选项--cross-prefix=arm-none-linux-gnueabi-。之前,运行make clean.

相关内容