help: compiling with -g doesn't work in Linux 
Author Message
 help: compiling with -g doesn't work in Linux

(Oops, forgot to cross post this =( )

I downloaded and compiled the tcl/tk/BLT sources (respective versions
7.3, 3.6.1, 1.3, ported to Linux). They, and all their demos, work fine.
However, while trying to compile my own program that uses their
libraries, I ran into a problem I can't figure out by myself.

Compiling with gcc 2.4.5 and the -O option, everything works fine. If
I try -g, though, the linker complains about undefined symbols (sample
below). The libraries in question are libtk.a and libBLT.a, which do
use X.

Since other compilations seem to work fine and the -g option works in
their case, I guess I'm the culprit here. Maybe I have misunderstood
the use of static and dynamic  libraries (gcc -g -static didn't do
anything different), or
maybe there's something fishy with my X setup (Slackware 1.0 or 1.1
didn't quite complete something, so I downloaded 1.2's X libraries and
xd kit). The kernel is 1.0 (Linux, for the tcl group).

In addition - and I don't know if this problem is related - I can't
get the -g option to link in the HP/UX environment at school either
(there I get some interesting output about MIN and MAX being
undefined).

The following is a listing of my Makefile, the linker's output, and a
listing of /usr/X11/lib in my Linux system. I greatly appreciate any
help; it is important to be able to debug my code as soon as possible.

Thank you!
Erik Bunn

------------------------------------------------

# Makefile

CC      = gcc
CFLAGS  = -O -static
#CFLAGS = -g -static
#(-static doesn't seem to produce different results)

TCL_INCLUDE     = -I/usr/include/tcl
TK_INCLUDE      = -I/usr/include/tcl
BLT_INCLUDE     = -I/usr/include/tcl
X_INCLUDE       = -I/usr/X386/include

TCL_LIB = -L/usr/lib -ltcl
TK_LIB  = -L/usr/X11/lib -ltk
BLT_LIB = -L/usr/X11/lib -lBLT
X_LIB   = -L/usr/X11/lib -lX11
EXTRA_LIB      = -lm

INCLUDES = -I. $(TCL_INCLUDE) $(TK_INCLUDE) $(BLT_INCLUDE) $(X_INCLUDE)
LIBS     = $(BLT_LIB) $(TK_LIB) $(TCL_LIB) $(X_LIB) $(EXTRA_LIB)

EXE = simwish
OBJS = sim_appinit.o mainloop.o transitions.o infection.o structures.o \
        gausdev.o ds_display.o dynstruct.o
SRCS = sim_appinit.c mainloop.c transitions.c infection.c structures.c \
        gausdev.c ds_display.c dynstruct.c

all:    $(EXE)

.c.o:

$(EXE): $(OBJS)

clean:
        rm -f $(OBJS) core *.~

clobber:
        rm -f $(OBJS) $(EXE) core

depend:
        makedepend $(SRCS)
# End

# DO NOT DELETE THIS LINE -- make depend depends on it.

-----------------------------------------------------
cd ~/projects/infemat/tcl_version/
make
gcc -O -static -I. -I/usr/include/tcl -I/usr/include/tcl -I/usr/include/tcl -I/usr/X386/include -o simwish sim_appinit.o mainloop.o transitions.o infection.o structures.o gausdev.o ds_display.o dynstruct.o -L/usr/X11/lib -lBLT -L/usr/X11/lib -ltk -L/usr/lib -ltcl -L/usr/X386/lib -lX11 -lm
/usr/X11/lib/libBLT.a(bltBitmap.o): Undefined symbol _XGetImage referenced from text segment
/usr/X11/lib/libBLT.a(bltBitmap.o): Undefined symbol _XFreePixmap referenced from text segment
/usr/X11/lib/libBLT.a(bltBusy.o): Undefined symbol _XReparentWindow referenced from text segment

.
.
.
make: *** [simwish] Error 1

----------------------------------------------------------------

:/usr/src/tcldev> L /usr/X11/lib
total 2969
drwxr-xr-x   4 root     root         1024 Apr  9 13:18 ./
drwxr-xr-x   6 root     root         1024 Mar 15 01:03 ../
lrwxrwxrwx   1 root     root           24 Mar 15 00:49 X11 -> ../../../var/X11/lib/X11/
drwxr-xr-x   5 root     root         1024 Mar 15 01:06 fonts/
-rw-r--r--   1 root     root       209684 Apr  8 20:06 libBLT.a
-rw-r--r--   1 root     root         5702 Jan 20 01:15 libBLT.sa
lrwxrwxrwx   1 root     root           13 Apr  2 19:02 libBLT.so.3 -> libBLT.so.3.3*
-rwxr-xr-x   1 root     root       152580 Jan 20 01:15 libBLT.so.3.3*
lrwxrwxrwx   1 root     root           15 Apr  2 18:20 libX11.a -> libX11.so.3.1.0*
-rw-r--r--   1 root     root       157756 Mar 10 07:06 libX11.sa
lrwxrwxrwx   1 root     root           29 Mar 15 01:04 libX11.so.3 -> /usr/X386/lib/libX11.so.3.1.0*
-r-xr-xr-x   1 root     root       320516 Mar 10 07:06 libX11.so.3.1.0*
-rw-r--r--   1 root     root         5910 Mar 10 05:59 libXau.a
-rw-r--r--   1 root     root       228174 Mar 10 07:39 libXaw.a
-rw-r--r--   1 root     root        30208 Mar 10 07:39 libXaw.sa
lrwxrwxrwx   1 root     root           29 Mar 15 01:04 libXaw.so.3 -> /usr/X386/lib/libXaw.so.3.1.0*
-r-xr-xr-x   1 root     root       189444 Mar 10 07:39 libXaw.so.3.1.0*
-rw-r--r--   1 root     root        13264 Mar 10 07:39 libXdmcp.a
-rw-r--r--   1 root     root        24166 Mar 10 08:23 libXext.a
-rw-r--r--   1 root     root        50928 Mar 10 08:23 libXext.sa
-rw-r--r--   1 root     root        34752 Mar 10 08:24 libXi.a
-rw-r--r--   1 root     root        56442 Mar 10 08:24 libXi.sa
-rw-r--r--   1 root     root        78928 Mar 10 07:31 libXmu.a
-rw-r--r--   1 root     root        61362 Mar 10 07:31 libXmu.sa
lrwxrwxrwx   1 root     root           14 Apr  3 18:57 libXt.a -> libXt.so.3.1.0*
-rw-r--r--   1 root     root        80440 Mar 10 07:31 libXt.sa
lrwxrwxrwx   1 root     root           28 Mar 15 01:04 libXt.so.3 -> /usr/X386/lib/libXt.so.3.1.0*
-r-xr-xr-x   1 root     root       291844 Mar 10 07:31 libXt.so.3.1.0*
-rw-r--r--   1 root     root         3086 Mar 10 08:25 libXtst.a
-rw-r--r--   1 root     root        47260 Mar 10 08:25 libXtst.sa
-rw-r--r--   1 root     root         5462 Mar 10 07:06 liboldX.a
-rw-r--r--   1 root     root       475770 Apr  9 13:18 libtk.a
-rw-r--r--   1 root     root        46358 Nov 25 00:40 libtk.sa
lrwxrwxrwx   1 root     root           12 Mar 18 13:11 libtk.so.3 -> libtk.so.3.1*
-rwxr-xr-x   1 root     root       357380 Nov 25 00:40 libtk.so.3.1*
-rw-r--r--   1 root     root        21124 Nov 26 14:45 libtkx.a
-rw-r--r--   1 root     root         2200 Nov 26 18:08 libtkx.sa
lrwxrwxrwx   1 root     root           15 Mar 18 13:13 libtkx.so.3 -> libtkx.so.3.1.1*
-rwxr-xr-x   1 root     root        37892 Nov 26 18:08 libtkx.so.3.1.1*
lrwxrwxrwx   1 root     root           27 Mar 15 00:49 scores -> ../../../var/X11/lib/scores/
drwxr-xr-x   2 root     root         1024 Mar 15 01:27 xmahjongg/

--
Erik Bunn // DiscworldRingworldCerebusSandmanC&HBrazilWandaXpilotRaceDrivin'
"He's muffed it," said Simony. "he could have done *anything* with
them. And he just told them the facts. You can't inspire people with
facts. They need a cause. They need a symbol."
        -- (Terry Pratchett, Small Gods)



Wed, 25 Sep 1996 23:46:58 GMT  
 help: compiling with -g doesn't work in Linux

: Compiling with gcc 2.4.5 and the -O option, everything works fine. If
: I try -g, though, the linker complains about undefined symbols (sample
: below). The libraries in question are libtk.a and libBLT.a, which do
: use X.

From the linker error messages, I'd start by checking the X11 library.
Use the -v flag with gcc to see what libraries are actually getting
loaded.

The linker is complaining that it can't find X routines like XGetImage
and XFreePixmap (both are used in BLT and Tk).  My guess is that you
are picking up a bad X11 library from somewhere.

: Since other compilations seem to work fine and the -g option works in
: their case, I guess I'm the culprit here. Maybe I have misunderstood
: the use of static and dynamic  libraries (gcc -g -static didn't do
: anything different), or
: maybe there's something fishy with my X setup (Slackware 1.0 or 1.1
: didn't quite complete something, so I downloaded 1.2's X libraries and
: xd kit). The kernel is 1.0 (Linux, for the tcl group).

Again, check which libraries are actually getting linked.  "-g" may
imply "-static".  It may be that the shared libraries are Ok and the
static libraries are bad.

: In addition - and I don't know if this problem is related - I can't
: get the -g option to link in the HP/UX environment at school either
: (there I get some interesting output about MIN and MAX being
: undefined).

Check which object files or libraries MIN and MAX are undefined in.  
If it's in BLT, let me know.

--gah



Thu, 26 Sep 1996 04:14:57 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. tkdesk on fedora core 5 -- doesn't run, doesn't compile

2. BLT installs but doesn't work, and TkTable doesn't build

3. Doesn't work when compiled

4. Compile and Run doesn't work

5. Img doesn't compile correctly in Linux

6. Compiling python2.2.1 on redHat 6.1 - doesn't work

7. Multitasking doesn't work under linux?

8. Compilation under HP works, under Linux doesn't

9. Linux : f77 -g doesn't work.

10. HELP: Verilog doesn't compile

11. Help - why doesn't this conjunction work?

12. --HELP-- Subcanvas LIST BOX doesn't work now

 

 
Powered by phpBB® Forum Software