please help with shared libs
Hi,
I am trying to pack libvdk. Evrithing is now fine, excepting the
dependencies. Aka, the dependencies are wrong: the libvdk is using the
libglib and libgtk. But they are not reflected in the generated deb
files. This made me discover that libvdk itself doesn't contain the
references. This is the output of ldd run over libvdk:
borco-ei:/usr/local/src/vdk/VDK-0.5.0/lib# ldd ./libvdk.so.0.5.0
libwcsmbs.so.0 => /lib/libwcsmbs.so.0 (0x40064000)
libstdc++-libc6.0-1.so.2 => /usr/lib/libstdc++-libc6.0-1.so.2
(0x40069000)
libm.so.6 => /lib/libm.so.6 (0x400ad000)
libc.so.6 => /lib/libc.so.6 (0x400c6000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaaa000)
The Makefile(stripped a bit) is added at the end of the message.
Also, the lib doesn't compile without -O2. I get this:
g++ -c -Wall -fPIC -I../include `gtk-config --cflags` -o vdkclist.o
vdkclist.cc
vdkclist.cc: g++: Internal compiler error: program cc1plus got fatal
signal 11
It compiles well with -O2.
The Makefile seems to give commands like the ones from ELF HOWTO. I have
no previous experience with shared, so it can be also wrong (or
partially wrong). But the idea is that ldd doesn't repport correct the
dependencies. My gcc/g++ are:
bash-2.01$ g++ -v
Reading specs from /usr/lib/gcc-lib/i486-linux/egcs-2.91.60/specs
gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
bash-2.01$ gcc -v
Reading specs from /usr/lib/gcc-lib/i486-linux/2.7.2.3/specs
gcc version 2.7.2.3
The libs has only .cc files, therefore gcc should never be called.
TIA,
Ionutz,
===================== Shorted Makefile ==================
CC = g++
C = gcc
CFLAGS = -Wall -fPIC -O2 #-g -DVDKDEBUG
INCPATH = -I../include `gtk-config --cflags`
LINK = g++
LFLAGS = -shared -Wl,-soname,libvdk.so.0
AR = ar cqs
####### Files
HEADERS = application.h \
...
vdkcsortlist.h
SOURCES = application.cc \
...
vdkcsortlist.cc
OBJECTS = application.o \
...
vdkcsortlist.o
TARGET = libvdk.so.0.5.0
TARGETA = ../lib/libvdk.a
TARGETD = libvdk.so.0.5.0
TARGET0 = libvdk.so
TARGET1 = libvdk.so.0
####### Implicit rules
.SUFFIXES: .cc .c
.cc.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
.c.o:
$(C) -c $(CFLAGS) $(INCPATH) -o $@ $<
####### Build rules
all: ../lib/libvdk.so.0.5.0
../lib/libvdk.so.0.5.0: $(OBJECTS)
-rm -f $(TARGET) $(TARGET0) $(TARGET1)
$(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS)
-ln -s $(TARGET) $(TARGET0)
-rm -f ../lib/$(TARGET)
-rm -f ../lib/$(TARGET0)
-rm -f ../lib/$(TARGET1)
-mv $(TARGET) $(TARGET0) $(TARGET1) ../lib/
staticlib: $(TARGETA)
$(TARGETA): $(OBJECTS)
-rm -f $(TARGETA)
$(AR) $(TARGETA) $(OBJECTS)
install:
install -d /usr/local/lib/
install ../lib/$(TARGETA) /usr/local/lib
install ../lib/$(TARGET) /usr/local/lib/
install -d /usr/local/include/vdk
cp ../include/vdk/*.h /usr/local/include/vdk
mv ../lib/$(TARGET0) ../lib/$(TARGET1) /usr/local/lib/
ldconfig /usr/local/lib/
Reply to: