This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Fwd: cannot compile with newlib on x86_64
- From: K Jski <bielsk1 at vt dot edu>
- To: newlib at sourceware dot org
- Date: Fri, 9 Jan 2015 16:38:19 -0500
- Subject: Fwd: cannot compile with newlib on x86_64
- Authentication-results: sourceware.org; auth=none
- References: <CAH=yU0bEM=g8c4Lkm2q40yggXaR+wyRrjCjFDweC7oSCExCCkA at mail dot gmail dot com>
To Whom It May concern,
I am trying to use newlib instead of glibc to create static binaries
on my x86_64 system as well as do everything from scratch (by manually
instserting the startfiles as wekk( I just got over the hurdle of
installing it, but now I cant use it. For a simple "Hello World"
currently my command line invocation (from my scipt) is:
INPUT=$1
gcc -c -o ${INPUT%.c}_x86Obj.o $1
ld -v -nostdlib -nostartfiles -static -o zgcc86 --sysroot=/ \
/mnt/drv2/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o \
/mnt/drv2/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crti.o \
/usr/lib/gcc/x86_64-linux-gnu/4.8/crtbeginT.o \
-L/home/bielsk1/aarch64-toolchain/newLib_x86build \
-L/home/bielsk1/aarch64-toolchain/X86_newlib/x86_64-linux-gnu/lib \
-L. \
-L/mnt/drv2/usr/lib/gcc/x86_64-linux-gnu/4.8 \
-L/mnt/drv2/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu \
-L/mnt/drv2/lib/x86_64-linux-gnu -L/mnt/drv2/lib/../lib64
-L/mnt/drv2/usr/lib/x86_64-linux-gnu \
-L/mnt/drv2/usr/lib/gcc/x86_64-linux-gnu/4.8/../../.. \
-L/mnt/drv2/home/bielsk1/LLVM/build/Debug+Asserts/bin/../lib -L/mnt/drv2/lib \
-L/mnt/drv2/lib64 \
-L/mnt/drv2/usr/lib -L/mnt/drv2/usr/lib/x86_64-linux-gnu/ \
/usr/lib/x86_64-linux-gnu/libc_nonshared.a \
${INPUT%.c}_x86Obj.o \
/home/bielsk1/aarch64-toolchain/X86_newlib/x86_64-linux-gnu/lib/libc.a \
/home/bielsk1/aarch64-toolchain/X86_newlib/x86_64-linux-gnu/lib/libg.a \
/home/bielsk1/aarch64-toolchain/X86_libgloss/lib/libnosys.a \
-lgcc -lgcc_eh \
/mnt/drv2/usr/lib/gcc/x86_64-linux-gnu/4.8/crtend.o \
/mnt/drv2/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crtn.o
to which the OS yells:
/mnt/drv2/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o:
In function `_start':
(.text+0x25): undefined reference to `__libc_start_main'
I see that newlib does NOT define this symbol while glibc does (in its
libc.a). I have the -nostdlib flag to specify to not use Glibc.
The closest archive I found to my problem was this one which was left
unanswered:
https://sourceware.org/ml/newlib/2009/msg00731.html
Any help would be appreciated.
Sincerely,
K Jelesnianski