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

Forcing links in shared libraries



I'm stumped.  The significant part of the Makefile says:


FLAGS=-Wall -g -fPIC -fno-rtti
INCLUDES=-I/usr/include/postgresql
LIBS=-lc -lpq++

LIBRPGBASE_OBJECTS=common.o librpgbase_add2.o librpgbase_sanct.o

all: shlib


$(LIBRPGBASE_OBJECTS): %.o: %.cpp
	g++ -fPIC $(FLAGS) $(INCLUDES) -c $< -o $@

librpgbase.so.0.0.1: $(LIBRPGBASE_OBJECTS)
	g++ -shared -Wl,-symbolic,-soname,librpgbase.so.0 \
	$(LIBRPGBASE_OBJECTS) -o librpgbase.so.0.0.1 -lc -lpq++

shlib: librpgbase.so.0.0.1



However, running ldd on the resulting librpgbase.so.0.0.1 says:

 libstdc++-libc6.1-2.so.3 => /usr/lib/libstdc++-libc6.1-2.so.3 (0x4005a000)
 libm.so.6 => /lib/libm.so.6 (0x400a7000)
 libc.so.6 => /lib/libc.so.6 (0x400c4000)
 /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)


Note the absence of a link to libpq++, which this particular library
needs.  This absence is bad because if you link to this library you'll
have to manually insert a -lpq++ in your own code as well.  I know
I've seen a discussion on this before, but a Glimpse search didn't
find anything useful.  What have I missed?

-- 
Zed Pobre <zed@debian.org> a.k.a. Zed Pobre <zed@resonant.org>
PGP key and fingerprint available on finger; encrypted mail welcomed.

Attachment: pgpDSpyQD9qwo.pgp
Description: PGP signature


Reply to: