GCC Compiling issues with cross compiler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Trying to compile simple hello world C file with a cross compiler and getting the below issues.

C File:

#include<stdio.h>

int main()
{
printf("Hello! This is a test prgoram.\n");
return 0;
}

Error:
/home /zephyr-sdk-0.11.3/x86_64-zephyr-elf/bin/../lib/gcc/x86_64-zephyr-elf/9.2.0/../../../../x86_64-zephyr-elf/bin/ld: /home/syerabol/zephyr-sdk-0.11.3/x86_64-zephyr-elf/x86_64-zephyr-elf/lib/libc.a(lib_a-sbrkr.o): in function `_sbrk_r':
sbrkr.c:(.text._sbrk_r+0x22): undefined reference to `sbrk'
/home/zephyr-sdk-0.11.3/x86_64-zephyr-elf/bin/../lib/gcc/x86_64-zephyr-elf/9.2.0/../../../../x86_64-zephyr-elf/bin/ld: /home/syerabol/zephyr-sdk-0.11.3/x86_64-zephyr-elf/x86_64-zephyr-elf/lib/libc.a(lib_a-writer.o): in function `_write_r':
writer.c:(.text._write_r+0x32): undefined reference to `write'
/home/zephyr-sdk-0.11.3/x86_64-zephyr-elf/bin/../lib/gcc/x86_64-zephyr-elf/9.2.0/../../../../x86_64-zephyr-elf/bin/ld: /home/syerabol/zephyr-sdk-0.11.3/x86_64-zephyr-elf/x86_64-zephyr-elf/lib/libc.a(lib_a-closer.o): in function `_close_r':
closer.c:(.text._close_r+0x1f): undefined reference to `close'
/home/zephyr-sdk-0.11.3/x86_64-zephyr-elf/bin/../lib/gcc/x86_64-zephyr-elf/9.2.0/../../../../x86_64-zephyr-elf/bin/ld: /home/syerabol/zephyr-sdk-0.11.3/x86_64-zephyr-elf/x86_64-zephyr-elf/lib/libc.a(lib_a-lseekr.o): in function `_lseek_r':
lseekr.c:(.text._lseek_r+0x30): undefined reference to `lseek'
/home/zephyr-sdk-0.11.3/x86_64-zephyr-elf/bin/../lib/gcc/x86_64-zephyr-elf/9.2.0/../../../../x86_64-zephyr-elf/bin/ld: /home/syerabol/zephyr-sdk-0.11.3/x86_64-zephyr-elf/x86_64-zephyr-elf/lib/libc.a(lib_a-readr.o): in function `_read_r':
readr.c:(.text._read_r+0x32): undefined reference to `read'
/home/zephyr-sdk-0.11.3/x86_64-zephyr-elf/bin/../lib/gcc/x86_64-zephyr-elf/9.2.0/../../../../x86_64-zephyr-elf/bin/ld: /home/syerabol/zephyr-sdk-0.11.3/x86_64-zephyr-elf/x86_64-zephyr-elf/lib/libc.a(lib_a-fstatr.o): in function `_fstat_r':
fstatr.c:(.text._fstat_r+0x2a): undefined reference to `fstat'
/home/zephyr-sdk-0.11.3/x86_64-zephyr-elf/bin/../lib/gcc/x86_64-zephyr-elf/9.2.0/../../../../x86_64-zephyr-elf/bin/ld: /home/syerabol/zephyr-sdk-0.11.3/x86_64-zephyr-elf/x86_64-zephyr-elf/lib/libc.a(lib_a-isattyr.o): in function `_isatty_r':
isattyr.c:(.text._isatty_r+0x1f): undefined reference to `isatty'
collect2: error: ld returned 1 exit status

Tried below flags but issue is not resolved.

Flags tried
--entry main
-Werror=implicit-function-declaration
--sysroot=/home/zephyr-sdk-0.11.3/x86_64-zephyr-elf/x86_64-zephyr-elf/lib
-isysroot=/home /zephyr-sdk-0.11.3/x86_64-zephyr-elf/x86_64-zephyr-elf/include
-iquote/home/zephyr-sdk-0.11.3/x86_64-zephyr-elf/x86_64-zephyr-elf/include
-L/home/zephyr-sdk-0.11.3/x86_64-zephyr-elf/x86_64-zephyr-elf/lib
-isystem/home/zephyr-sdk-0.11.3/x86_64-zephyr-elf/x86_64-zephyr-elf/include

Any help on how to resolve this issue would be great.

Thank You,
Spoorthy Priya Yerabolu.





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux