I have a problem about cross compile.
#include <stdio.h>
int main()
{
printf("hello\n");
return 0;
}
this is a simple hello world code I used.
I'm using arm-none-eabi-g++, downloaded from mentor graphics. Here is the error. I don't know what lib is missed.
/home/kang/Utils/arm-2013.05/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/bin/ld: warning: cannot find entry symbol _start; defaulting to 00008018
/home/kang/Utils/arm-2013.05/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/libc.a(lib_a-abort.o): In function `abort':
abort.c:(.text+0x10): undefined reference to `_exit'
/home/kang/Utils/arm-2013.05/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/libc.a(lib_a-signalr.o): In function `_kill_r':
signalr.c:(.text+0x1c): undefined reference to `_kill'
/home/kang/Utils/arm-2013.05/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/libc.a(lib_a-signalr.o): In function `_getpid_r':
signalr.c:(.text+0x44): undefined reference to `_getpid'
/home/kang/Utils/arm-2013.05/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text+0x18): undefined reference to `_sbrk'
/home/kang/Utils/arm-2013.05/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/libc.a(lib_a-writer.o): In function `_write_r':
writer.c:(.text+0x20): undefined reference to `_write'
/home/kang/Utils/arm-2013.05/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/libc.a(lib_a-closer.o): In function `_close_r':
closer.c:(.text+0x18): undefined reference to `_close'
/home/kang/Utils/arm-2013.05/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/libc.a(lib_a-fstatr.o): In function `_fstat_r':
fstatr.c:(.text+0x1c): undefined reference to `_fstat'
/home/kang/Utils/arm-2013.05/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/libc.a(lib_a-isattyr.o): In function `_isatty_r':
isattyr.c:(.text+0x18): undefined reference to `_isatty'
/home/kang/Utils/arm-2013.05/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/libc.a(lib_a-lseekr.o): In function `_lseek_r':
lseekr.c:(.text+0x20): undefined reference to `_lseek'
/home/kang/Utils/arm-2013.05/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/libc.a(lib_a-readr.o): In function `_read_r':
readr.c:(.text+0x20): undefined reference to `_read'
collect2: error: ld returned 1 exit status
and this is compiler version.
$ arm-linux-gnueabi-g++ -v
Using built-in specs. COLLECT_GCC=/home/kang/Utils/arm-2013.05/bin/arm-none-eabi-g++ COLLECT_LTO_WRAPPER=/home/kang/Utils/arm-2013.05/bin/../libexec/gcc/arm-none-eabi/4.7.3/lto-wrapper Target: arm-none-eabi Configured with: /scratch/jbrown/2013.05-arm-eabi-release/src/gcc-4.7-2013.05/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-eabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --enable-extra-sgxxlite-multilibs --with-gnu-as --with-gnu-ld --with-specs='%{save-temps: -fverbose-asm} -D__CS_SOURCERYGXX_MAJ__=2013 -D__CS_SOURCERYGXX_MIN__=5 -D__CS_SOURCERYGXX_REV__=23 %{O2:%{!fno-remove-local-statics: -fremove-local-statics}} %{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}' --enable-languages=c,c++ --disable-shared --enable-lto --with-newlib --with-pkgversion='Sourcery CodeBench Lite 2013.05-23' --with-bugurl=https://sourcery.mentor.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-headers=yes --with-sysroot=/opt/codesourcery/arm-none-eabi --with-build-sysroot=/scratch/jbrown/2013.05-arm-eabi-release/install/arm-none-eabi --with-gmp=/scratch/jbrown/2013.05-arm-eabi-release/obj/pkg-2013.05-23-arm-none-eabi/arm-2013.05-23-arm-none-eabi.extras/host-libs-i686-pc-linux-gnu/usr --with-mpfr=/scratch/jbrown/2013.05-arm-eabi-release/obj/pkg-2013.05-23-arm-none-eabi/arm-2013.05-23-arm-none-eabi.extras/host-libs-i686-pc-linux-gnu/usr --with-mpc=/scratch/jbrown/2013.05-arm-eabi-release/obj/pkg-2013.05-23-arm-none-eabi/arm-2013.05-23-arm-none-eabi.extras/host-libs-i686-pc-linux-gnu/usr --with-ppl=/scratch/jbrown/2013.05-arm-eabi-release/obj/pkg-2013.05-23-arm-none-eabi/arm-2013.05-23-arm-none-eabi.extras/host-libs-i686-pc-linux-gnu/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-cloog=/scratch/jbrown/2013.05-arm-eabi-release/obj/pkg-2013.05-23-arm-none-eabi/arm-2013.05-23-arm-none-eabi.extras/host-libs-i686-pc-linux-gnu/usr --with-libelf=/scratch/jbrown/2013.05-arm-eabi-release/obj/pkg-2013.05-23-arm-none-eabi/arm-2013.05-23-arm-none-eabi.extras/host-libs-i686-pc-linux-gnu/usr --disable-libgomp --disable-libitm --enable-poison-system-directories --with-build-time-tools=/scratch/jbrown/2013.05-arm-eabi-release/install/arm-none-eabi/bin --with-build-time-tools=/scratch/jbrown/2013.05-arm-eabi-release/install/arm-none-eabi/bin Thread model: single gcc version 4.7.3 (Sourcery CodeBench Lite 2013.05-23)
--specs=nosys.specs
. You should also show how you are compiling/linking. It should be as simple as (assuming a toolchain with a libc):/usr/arm-linux-gnueabi-gcc mysource.c -o myprogram.exe --sysroot=/usr/arm-linux-gnueabi
. – jww