static linking error
Doug Evans
dje@transmeta.com
Tue Jul 8 21:04:00 GMT 2003
Charles Lockhart writes:
> If I edit my LDFLAGS line to "LDFLAGS = -static", removing the
> "-nostdlib -L${TARGET_PREFIX}/lib" stuff, I get the following errors:
>
> ppc-405-linux-gnu-gcc -O2 -Wall -c test.c
> ppc-405-linux-gnu-gcc -o test
> /home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
> gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/crt1.o
> /home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
> gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/crti.o
> /home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
> gcc-3.2.3-glibc-2.2.5/lib/gcc-lib/ppc-405-linux-gnu/3.2.3/crtbegin.o
> test.o -lc
> /home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
> gcc-3.2.3-glibc-2.2.5/lib/gcc-lib/ppc-405-linux-gnu/3.2.3/crtend.o
> /home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
> gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/crtn.o -static
> /home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
> gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/crt1.o(.text+0x0): In
> function `_start':
> : multiple definition of `_start'
> /home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
> gcc-3.2.3-glibc-2.2.5/lib/gcc-lib/ppc-405-linux-gnu/3.2.3/../../../../ppc-405-linux-gnu/lib/crt1.o(.text+0x0):
> first defined here
It looks like you're explicitly providing crt1.o,crti.o,etc.
Try removing all of them, gcc provides them implicitly as you can
see from the error message: note that the multiple definition of _start
is coming from two different crt1.o's. Ditto for the -lc by the way
though in this case there's no harm in adding it.
Also, when providing information to help us debug things,
it is very useful to add a -v argument to gcc.
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
More information about the crossgcc
mailing list