I am trying to compile a hello world program in C on a Linux 64-bit machine. I am using an ARM cross compiler to load my application onto an ARM processor. However, when compiling the code using arm-none-eabi-gcc -o hello hello.c
I get a series of errors:
/home/dico/gcc-arm-none-eabi-4_7-2013q3/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): In function
exit': exit.c:(.text.exit+0x2c): undefined reference to
_exit' /home/dico/gcc-arm-none-eabi-4_7-2013q3/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/libc.a(lib_a-sbrkr.o): In function_sbrk_r': sbrkr.c:(.text._sbrk_r+0x18): undefined reference to
_sbrk' /home/dico/gcc-arm-none-eabi-4_7-2013q3/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/libc.a(lib_a-writer.o): In function_write_r': writer.c:(.text._write_r+0x20): undefined reference to
_write' /home/dico/gcc-arm-none-eabi-4_7-2013q3/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/libc.a(lib_a-closer.o): In function_close_r': closer.c:(.text._close_r+0x18): undefined reference to
_close' /home/dico/gcc-arm-none-eabi-4_7-2013q3/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/libc.a(lib_a-fstatr.o): In function_fstat_r': fstatr.c:(.text._fstat_r+0x1c): undefined reference to
_fstat' /home/dico/gcc-arm-none-eabi-4_7-2013q3/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/libc.a(lib_a-isattyr.o): In function_isatty_r': isattyr.c:(.text._isatty_r+0x18): undefined reference to
_isatty' /home/dico/gcc-arm-none-eabi-4_7-2013q3/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/libc.a(lib_a-lseekr.o): In function_lseek_r': lseekr.c:(.text._lseek_r+0x20): undefined reference to
_lseek' /home/dico/gcc-arm-none-eabi-4_7-2013q3/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/libc.a(lib_a-readr.o): In function_read_r': readr.c:(.text._read_r+0x20): undefined reference to
_read' collect2: error: ld returned 1 exit status
When I try compiling by doing: arm-none-eabi-gcc -c hello.c
, it creates an object code hello.o
which tells me that the compiler runs fine.
Could someone perhaps tell me why my compilation is return such errors please?
UPDATE
I realize now that the C runtime library isn't included in the compilation. Does anyone know of any options I need to include in the compilation or how to link the library to be able to use standard functions such as printf for example?