This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: undefined references in libc_nonshared.a when linking .so
- From: Ian Lance Taylor <ian at airs dot com>
- To: chris cross <xcross_ibm at yahoo dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: 18 Jul 2005 13:17:58 -0700
- Subject: Re: undefined references in libc_nonshared.a when linking .so
- References: <20050718201436.70698.qmail@web33808.mail.mud.yahoo.com>
chris cross <xcross_ibm@yahoo.com> writes:
> Trying to link a shared object on FC3 and get some
> confusing undefined references in libc_nonshared.a. I
> isolated it to when I pass -shared as a linker option,
> as in "gcc -Wl,-shared". When I use the gcc option,
> "gcc -shared" I don't get the problem.
You should use gcc -shared. You should not use gcc -Wl,-shared.
gcc -shared passes the right files and options to the linker to create
a shared library, including -shared. Using -Wl,-shared just passes
-shared to the linker, without the required additional files.
There is no bug here. Passing commands directly to the linker
requires that you know what you are doing.
Ian