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

Re: gcc can't compile, egcc can!??



On 14 Jun, Zack Weinberg wrote:
> On Sat, 13 Jun 1998 22:51:30 -0500 (CDT), servis@purdue.edu wrote:
>>On 13 Jun, Zack Weinberg wrote:
>>> What do you get if you do this:
>>> 
>>> gcc -v -o hello hello.c
>>
>>This is what I get:
>>
>>% gcc -v -o hello hello.c
>>gcc version 2.7.2.3
> [...]
>> ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o hello
>> /usr/lib/crt1.o /usr/lib/crti.o
>> /usr/lib/gcc-lib/i486-linux/2.7.2.3/crtbegin.o
>> -L/usr/lib/gcc-lib/i486-linux/2.7.2.3 /tmp/ccd01600 -lgcc -lc -lgcc
>> /usr/lib/gcc-lib/i486-linux/2.7.2.3/crtend.o /usr/lib/crtn.o
>>/usr/lib/crt1.o(.text+0xe): undefined reference to `__libc_init_first'
>>/usr/lib/crt1.o(.text+0x18): undefined reference to `_environ'
> 
> Hunh.  It is pulling in the C library (-lc).  Next thing is to see
> what egcc and/or g++ do differently; can you try the same thing with
> either of them?  (I only need to see the link line, so you could do
> 
> gcc -c hello.c
> 
> egcc -v -o hello hello.o
> g++ -v -o hello hello.o
> 
> to cut down on the noise a little.)
> 

% egcc -v -o hello hello.o
Reading specs from /usr/lib/gcc-lib/i486-linux/egcs-2.90.29/specs
gcc version egcs-2.90.29 980515 (egcs-1.0.3 release)
 /usr/lib/gcc-lib/i486-linux/egcs-2.90.29/ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o hello /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/gcc-lib/i486-linux/egcs-2.90.29/crtbegin.o -L/usr/lib/gcc-lib/i486-linux/egcs-2.90.29 hello.o -lgcc -lc -lgcc /usr/lib/gcc-lib/i486-linux/egcs-2.90.29/crtend.o /usr/lib/crtn.o

(note this the the egcs g++)
% g++ -v -o hello hello.o
Reading specs from /usr/lib/gcc-lib/i486-linux/egcs-2.90.29/specs
gcc version egcs-2.90.29 980515 (egcs-1.0.3 release)
 /usr/lib/gcc-lib/i486-linux/egcs-2.90.29/ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o hello /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/gcc-lib/i486-linux/egcs-2.90.29/crtbegin.o -L/usr/lib/gcc-lib/i486-linux/egcs-2.90.29 hello.o -lstdc++ -lm -lgcc -lc -lgcc /usr/lib/gcc-lib/i486-linux/egcs-2.90.29/crtend.o /usr/lib/crtn.o

Note:  Package conflicts wouldn't allow both g++272 and egcc to
co-exist on Debian.  So I had to remove egcc, g++ in order to install
g++272.

(note this is the gcc g++)
% g++272 -v -o hello hello.o
 gcc -v -o hello hello.o -lstdc++ -lm
Reading specs from /usr/lib/gcc-lib/i486-linux/2.7.2.3/specs
gcc version 2.7.2.3
 ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o hello /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/gcc-lib/i486-linux/2.7.2.3/crtbegin.o -L/usr/lib/gcc-lib/i486-linux/2.7.2.3 hello.o -lstdc++ -lm -lgcc -lc -lgcc /usr/lib/gcc-lib/i486-linux/2.7.2.3/crtend.o /usr/lib/crtn.o
ld: warning: libm.so.6, needed by /usr/lib/libstdc++.so, may conflict with libm.so.5
ld: warning: libc.so.6, needed by /lib/libm.so.6, may conflict with libc.so.5


> Also, another thing that might possibly produce this error is if
> /usr/lib/libc.so is mangled.  Can you check that that's an ordinary
> file containing something like
> 
> GROUP { libc.so.6 ld-linux.so.2 libc.a }
> 
> please?  It ought to affect both compilers if that's wrong, but it's
> worth checking. 

% cat /usr/lib/libc.so
/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a )


Thanks,

Brian 


--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: