This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: shared library not found
> Okay, it is missing the crt1.o which is usually in /usr/lib. But, I did
> not read the -nostdlib option completely and carefully. It means that
> none of the standard libraries are passed to the linker. I just thought
> that I will not search the standard libraries. Sorry for this. So, you
> should need use the -nostdlib option. :)
Maybe you mean the -nodefaultlibs option :)
Now I get:
$ gcc dummy.c -nodefaultlibs -L/tools/lib
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/crt1.o: In function
`_start':
(.text+0x12): undefined reference to `__libc_csu_fini'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/crt1.o: In function
`_start':
(.text+0x19): undefined reference to `__libc_csu_init'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/crt1.o: In function
`_start':
(.text+0x25): undefined reference to `__libc_start_main'
collect2: ld returned 1 exit status
Or, if I use the -B switch instead of the -L switch:
$ gcc dummy.c -nodefaultlibs -B/tools/lib
/tools/lib/crt1.o: In function `_start':
(.text+0x12): undefined reference to `__libc_csu_fini'
/tools/lib/crt1.o: In function `_start':
(.text+0x19): undefined reference to `__libc_csu_init'
/tools/lib/crt1.o: In function `_start':
(.text+0x25): undefined reference to `__libc_start_main'
collect2: ld returned 1 exit status