编译使用arm-none-eabi-gcc libc。一个错误

时间:2021-08-03 06:01:38

I am trying to compile for ARM Cortex M3, and get this error when building a Hello World program.

我正在尝试编译ARM皮质M3,在构建Hello World程序时得到这个错误。

Have tried to build using --specs=rdimon.specs, which allows the program to compile, but it is then "Killed" by the target platform.

尝试过使用——spec =rdimon。spec允许程序编译,但随后被目标平台“杀死”。

$ gcc-arm-none-eabi-5_2-2015q4/bin/arm-none-eabi-gcc test.c -o 

test/Users/user/Desktop/gcc-arm-none-eabi-5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): In function `exit':
exit.c:(.text.exit+0x2c): undefined reference to `_exit'
/Users/user/Desktop/gcc-arm-none-eabi-5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text._sbrk_r+0x18): undefined reference to `_sbrk'
/Users/user/Desktop/gcc-arm-none-eabi-5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/libc.a(lib_a-writer.o): In function `_write_r':
writer.c:(.text._write_r+0x24): undefined reference to `_write'
/Users/user/Desktop/gcc-arm-none-eabi-5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/libc.a(lib_a-closer.o): In function `_close_r':
closer.c:(.text._close_r+0x18): undefined reference to `_close'
/Users/user/Desktop/gcc-arm-none-eabi-5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/libc.a(lib_a-lseekr.o): In function `_lseek_r':
lseekr.c:(.text._lseek_r+0x24): undefined reference to `_lseek'
/Users/user/Desktop/gcc-arm-none-eabi-5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/libc.a(lib_a-readr.o): In function `_read_r':
readr.c:(.text._read_r+0x24): undefined reference to `_read'
/Users/user/Desktop/gcc-arm-none-eabi-5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/libc.a(lib_a-fstatr.o): In function `_fstat_r':
fstatr.c:(.text._fstat_r+0x20): undefined reference to `_fstat'
/Users/user/Desktop/gcc-arm-none-eabi-5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/libc.a(lib_a-isattyr.o): In function `_isatty_r':
isattyr.c:(.text._isatty_r+0x18): undefined reference to `_isatty'
collect2: error: ld returned 1 exit status

1 个解决方案

#1


1  

This error means that the standard functions are not defined. You can try to compile with the -ffreestanding option (see What is ffreestanding option in gcc?).

这个错误意味着没有定义标准函数。您可以尝试使用-ffreestanding选项进行编译(参见在gcc中什么是ffreestanding选项?)

#1


1  

This error means that the standard functions are not defined. You can try to compile with the -ffreestanding option (see What is ffreestanding option in gcc?).

这个错误意味着没有定义标准函数。您可以尝试使用-ffreestanding选项进行编译(参见在gcc中什么是ffreestanding选项?)