problem with debugging flag '-g' of gcc

problem with debugging flag '-g' of gcc

Post by YU PATRICK HONG-K » Sat, 27 Aug 1994 07:55:43



I am having trouble in using the debugging flag -g of the gcc compiler.

Wihout the '-g' in the linking stage I got the final executable without error.
With the '-g' in the linking stage ld complains that it can't find libX11.

/lib/  has libX11.so.3 sym-linked to /usr/X11/lib/libX11.so.3.1.0
/usr/X11/lib/ has libX11.sa and libX11.so.3, but no libX11.a ; is that
the problem ?

I have the Slackware 2.0 distribution

Following provides detail by using the '-v' option:

------------withOUT '-g':

darkstar.. gcc -v -c -I/usr/include/tcl tkHelloWorld.c
Reading specs from /usr/lib/gcc-lib/i486-linux/2.5.8/specs
gcc version 2.5.8
 /usr/lib/gcc-lib/i486-linux/2.5.8/cpp -lang-c -v -I/usr/include/tcl -undef -D__GNUC__=2 -D__GNUC_MINOR__=5 -Dunix -Di386 -Dlinux -D__unix__ -D__i386__ -D__linux__ -D__unix -D__i386 -D__linux -Asystem(unix) -Asystem(posix) -Acpu(i386) -Amachine(i386) -D__i486__ tkHelloWorld.c /tmp/cca01141.i
GNU CPP version 2.5.8 (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/tcl
 /usr/local/include
 /usr/i486-linux/include
 /usr/lib/gcc-lib/i486-linux/2.5.8/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i486-linux/2.5.8/cc1 /tmp/cca01141.i -quiet -dumpbase tkHelloWorld.c -version -o /tmp/cca01141.s
GNU C version 2.5.8 (80386, BSD syntax) compiled by GNU C version 2.5.8.
 as -o tkHelloWorld.o /tmp/cca01141.s

darkstar.. gcc -v tkHelloWorld.o -ltk -ltcl -lX11 -lm
Reading specs from /usr/lib/gcc-lib/i486-linux/2.5.8/specs
gcc version 2.5.8
 ld -dll-verbose -m486 /usr/lib/crt0.o -L/usr/lib/gcc-lib/i486-linux/2.5.8 tkHelloWorld.o -ltk -ltcl -lX11 -lm -lgcc -lc -lgcc
Fixup count 0
Removed 2286 symbols from symtab
Fixup table address: 1124
darkstar..

---------- with '-g':
darkstar.. gcc -v -c -g -I/usr/include/tcl tkHelloWorld.c
Reading specs from /usr/lib/gcc-lib/i486-linux/2.5.8/specs
gcc version 2.5.8
 /usr/lib/gcc-lib/i486-linux/2.5.8/cpp -lang-c -v -I/usr/include/tcl -undef -D__GNUC__=2 -D__GNUC_MINOR__=5 -Dunix -Di386 -Dlinux -D__unix__ -D__i386__ -D__linux__ -D__unix -D__i386 -D__linux -Asystem(unix) -Asystem(posix) -Acpu(i386) -Amachine(i386) -g -D__i486__ tkHelloWorld.c /tmp/cca01180.i
GNU CPP version 2.5.8 (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/tcl
 /usr/local/include
 /usr/i486-linux/include
 /usr/lib/gcc-lib/i486-linux/2.5.8/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i486-linux/2.5.8/cc1 /tmp/cca01180.i -quiet -dumpbase tkHelloWorld.c -g -version -o /tmp/cca01180.s
GNU C version 2.5.8 (80386, BSD syntax) compiled by GNU C version 2.5.8.
 as -o tkHelloWorld.o /tmp/cca01180.s

darkstar.. gcc -v -g -I/usr/include/tcl tkHelloWorld.o -ltk -ltcl -lX11 -lm
Reading specs from /usr/lib/gcc-lib/i486-linux/2.5.8/specs
gcc version 2.5.8
 ld -dll-verbose -m486 /usr/lib/crt0.o -static -L/usr/lib/gcc-lib/i486-linux/2.5.8 tkHelloWorld.o -ltk -ltcl -lX11 -lm -lgcc -lg -lgcc
ld: No such file or directory for libX11
darkstar..

Thanks in advance,
Patrick

 
 
 

problem with debugging flag '-g' of gcc

Post by Mitchum DSou » Sat, 27 Aug 1994 22:54:27



Quote:HONG-KIN) writes:

|>
|> I am having trouble in using the debugging flag -g of the gcc compiler.
|>
|> Wihout the '-g' in the linking stage I got the final executable without
|> error.
|> With the '-g' in the linking stage ld complains that it can't find libX11.
|>
|> /lib/  has libX11.so.3 sym-linked to /usr/X11/lib/libX11.so.3.1.0
|> /usr/X11/lib/ has libX11.sa and libX11.so.3, but no libX11.a ; is that
|> the problem ?
|>
|> I have the Slackware 2.0 distribution
|>
|> Following provides detail by using the '-v' option:
|>
|> ------------withOUT '-g':
|>
|> darkstar.. gcc -v -c -I/usr/include/tcl tkHelloWorld.c
|> Reading specs from /usr/lib/gcc-lib/i486-linux/2.5.8/specs
|> gcc version 2.5.8
|>  /usr/lib/gcc-lib/i486-linux/2.5.8/cpp -lang-c -v -I/usr/include/tcl -undef
|> -D__GNUC__=2 -D__GNUC_MINOR__=5 -Dunix -Di386 -Dlinux -D__unix__ -D__i386__
|> -D__linux__ -D__unix -D__i386 -D__linux -Asystem(unix) -Asystem(posix)
|> -Acpu(i386) -Amachine(i386) -D__|> i486__ tkHelloWorld.c /tmp/cca01141.i
|> GNU CPP version 2.5.8 (80386, BSD syntax)
|> #include "..." search starts here:
|> #include <...> search starts here:
|>  /usr/include/tcl
|>  /usr/local/include
|>  /usr/i486-linux/include
|>  /usr/lib/gcc-lib/i486-linux/2.5.8/include
|>  /usr/include
|> End of search list.
|>  /usr/lib/gcc-lib/i486-linux/2.5.8/cc1 /tmp/cca01141.i -quiet -dumpbase
|> tkHelloWorld.c -version -o /tmp/cca01141.s
|> GNU C version 2.5.8 (80386, BSD syntax) compiled by GNU C version 2.5.8.
|>  as -o tkHelloWorld.o /tmp/cca01141.s
|>
|> darkstar.. gcc -v tkHelloWorld.o -ltk -ltcl -lX11 -lm
|> Reading specs from /usr/lib/gcc-lib/i486-linux/2.5.8/specs
|> gcc version 2.5.8
|>  ld -dll-verbose -m486 /usr/lib/crt0.o -L/usr/lib/gcc-lib/i486-linux/2.5.8
|> tkHelloWorld.o -ltk -ltcl -lX11 -lm -lgcc -lc -lgcc
|> Fixup count 0
|> Removed 2286 symbols from symtab
|> Fixup table address: 1124
|> darkstar..
|>
|> ---------- with '-g':
|> darkstar.. gcc -v -c -g -I/usr/include/tcl tkHelloWorld.c
|> Reading specs from /usr/lib/gcc-lib/i486-linux/2.5.8/specs
|> gcc version 2.5.8
|>  /usr/lib/gcc-lib/i486-linux/2.5.8/cpp -lang-c -v -I/usr/include/tcl -undef
|> -D__GNUC__=2 -D__GNUC_MINOR__=5 -Dunix -Di386 -Dlinux -D__unix__ -D__i386__
|> -D__linux__ -D__unix -D__i386 -D__linux -Asystem(unix) -Asystem(posix)
|> -Acpu(i386) -Amachine(i386) -g -|> D__i486__ tkHelloWorld.c /tmp/cca01180.i
|> GNU CPP version 2.5.8 (80386, BSD syntax)
|> #include "..." search starts here:
|> #include <...> search starts here:
|>  /usr/include/tcl
|>  /usr/local/include
|>  /usr/i486-linux/include
|>  /usr/lib/gcc-lib/i486-linux/2.5.8/include
|>  /usr/include
|> End of search list.
|>  /usr/lib/gcc-lib/i486-linux/2.5.8/cc1 /tmp/cca01180.i -quiet -dumpbase
|> tkHelloWorld.c -g -version -o /tmp/cca01180.s
|> GNU C version 2.5.8 (80386, BSD syntax) compiled by GNU C version 2.5.8.
|>  as -o tkHelloWorld.o /tmp/cca01180.s
|>
|> darkstar.. gcc -v -g -I/usr/include/tcl tkHelloWorld.o -ltk -ltcl -lX11 -lm
|> Reading specs from /usr/lib/gcc-lib/i486-linux/2.5.8/specs
|> gcc version 2.5.8
|>  ld -dll-verbose -m486 /usr/lib/crt0.o -static
|> -L/usr/lib/gcc-lib/i486-linux/2.5.8 tkHelloWorld.o -ltk -ltcl -lX11 -lm -lgcc
|> -lg -lgcc
|> ld: No such file or directory for libX11
|> darkstar..

Doesn't anyone read the FAQ's or the previous stuff I post ??

For linux the GCC `specs' file are built to imply that if -g is specified then
-static is infered. This means that with -g you MUST have the .a libraries
for any -lxxxx you specify. You can change this behavior by either editing the
appropriate `specs' file for your gcc version, or getting the correct  X11
static archives.

In your case your either do not have libX11.a or your lookup path (specified
with -L) cannot find that archive.

Mitch

 
 
 

1. etting debug flags doesn't help with debugging.

I'm trying to single step through khtmlpart.
When I call configure I set the appropriate debug flag,
yet when I try to debug it I see nothing (just to be safe
I've renamed strip ) just assemble ( if a I have the assmebler window
open ). It seems like the debugging information just isn't present.
I know on Windows sometimes the debugging information is in a seperate
file which may not get copied when you install.
Is this the case? If so how do I install the debug info?
TIA

2. Installing KDE 3.0 on Redhat 7.2

3. Network code fails with '-ansi' gcc flag.

4. Crypt command

5. what's awk(1)'s equivalent of sed(1)'s `!d' flag?

6. apache log directory, restarting server after rotating logs.

7. doesn't sendmail understand 'm' flag ?

8. BocaLAN card problems

9. 'make' and 'gcc' don't work

10. How do I debug a 'Network is unreachable' problem

11. Need 'as' and possibly 'ld' for gcc

12. Can't debug when compiled with gcc

13. 'gcc' can not find 'as'