[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

SOLVED? Is it bug in gcc? (was: Re: header problem and linker script problem



On Mon, Dec 28, 1998 at 07:41:15PM +0100, Marcus Brinkmann wrote:
> Second problem:
> libc.so linker script problem is back. Consider the following invocation:
> i386-gnu-gcc -o ../lib/libncurses.so.4.2 -L../lib -L/gnu/lib -shared
> -Wl,-soname,`basename ../lib/libncurses.so.4`,-stats ../obj_s/hardscroll.o
> ../obj_s/hashmap.o ../obj_s/lib_acs.o ../obj_s/lib_addch.o
> [more object files follow]
> 
> This does produce the error, that /lib/libc.so.0.2 could not be found,
> although I have correct i386-gnu-gcc wrapper (with
> -rpath=/usr/i386-gnu/lib).

Problem solved. "-L /gnu/lib" does break it. Somehow, the options get in
disorder, and the linker sees it before the right directory, and tries it
first. Running the command with "-v" reveals:

 ld -m elf_i386 -shared -o ../lib/libncurses.so.4.2 /usr/i386-gnu/lib/crti.o
/usr/lib/gcc-lib/i386-gnu/2.7.2.3/crtbeginS.o -L../lib -L/gnu/lib
                                                       ^^^^^^^^^ this overrides
-L/usr/lib/gcc-lib/i386-gnu/2.7.2.3 -L/usr/i386-gnu/lib
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this.
-rpath=/usr/i386-gnu/lib -soname libncurses.so.4 -stats
../obj_s/hardscroll.o ../obj_s/hashmap.o ../obj_s/lib_acs.o
../obj_s/lib_addch.o -lgcc -lc -lgcc
/usr/lib/gcc-lib/i386-gnu/2.7.2.3/crtendS.o /usr/i386-gnu/lib/crtn.o

Obviously, the order the commands are given gcc is not the same as the order
they are given to ld. Is this a bug in gcc?

Marcus

-- 
"Rhubarb is no Egyptian god."        Debian GNU/Linux        finger brinkmd@ 
Marcus Brinkmann                   http://www.debian.org    master.debian.org
Marcus.Brinkmann@ruhr-uni-bochum.de                        for public  PGP Key
http://homepage.ruhr-uni-bochum.de/Marcus.Brinkmann/       PGP Key ID 36E7CD09


Reply to: