Ada*_*dam 8 c linux gcc arm processor
我正在64位Linux机器上用C编译一个hello world程序.我正在使用GCC ARM嵌入式工具链在带有ATMEL AT91SAM9G20处理器的FOX G20 V板上交叉编译我的程序.
在第一次拍摄时,我在编译时遇到了一些错误,因为程序无法识别printf,return等函数(标准C函数).所以我决定在函数之间建立联系,我认为这些函数是在libc.a库中定义的(如果我错了,请纠正我),arm-none-eabi-gcc -o hello hello.c libc.a但是结果仍会导致错误:
libc.a(lib_a-exit.o): In function `exit':
exit.c:(.text.exit+0x16): undefined reference to `_exit'
libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'
libc.a(lib_a-writer.o): In function `_write_r':
writer.c:(.text._write_r+0x10): undefined reference to `_write'
libc.a(lib_a-closer.o): In function `_close_r':
closer.c:(.text._close_r+0xc): undefined reference to `_close'
libc.a(lib_a-fstatr.o): In function `_fstat_r':
fstatr.c:(.text._fstat_r+0xe): undefined reference to `_fstat'
libc.a(lib_a-isattyr.o): In function `_isatty_r':
isattyr.c:(.text._isatty_r+0xc): undefined reference to `_isatty'
libc.a(lib_a-lseekr.o): In function `_lseek_r':
lseekr.c:(.text._lseek_r+0x10): undefined reference to `_lseek'
libc.a(lib_a-readr.o): In function `_read_r':
readr.c:(.text._read_r+0x10): undefined reference to `_read'
collect2: error: ld returned 1 exit status
我真的不确定为什么程序仍然无法识别标准函数,即使我已将库链接到应用程序.如果有人有理由为什么,或解决我如何解决这个问题,我将非常感激.
UPDATE
我从这里下载了glibc库.我已经从syscalls.c我找到的库中编译和创建了一个静态库newlib-2.1.0/libgloss/arm,当我将库链接到我的应用程序代码时,我仍然得到相同的错误.
Ada*_*dam 15
尝试执行此操作:
arm-none-eabi-gcc --specs=rdimon.specs -lgcc -lc -lm -lrdimon -o hello hello.c
您的工具包似乎提供了librdimon.a,这是一个提供基本标准C函数的库.