Package: libdpkg-dev
Version: 1.15.7.2
Severity: normal
Tags: patch

I am trying to build a shared library where libdpkg.a (from libdpkg-dev 
1.15.7.2, installed on Ubuntu 10.04) should be linked into. I get the following 
error, though:

/usr/bin/ld: /usr/lib/dpkg/libdpkg.a(database.o): relocation R_X86_64_32S 
against `.bss' can not be used when making a shared object; recompile with -fPIC

This is because the objects in libdpkg.a are not compiled to 
position-independent code (with gcc -fPIC). I believe that should be done, 
though, to make using libdpkg.a in shared libraries possible.

Attached is a trivial patch that adds -fPIC to CFLAGS.


-- System Information:
Debian Release: squeeze/sid
  APT prefers lucid-updates
  APT policy: (500, 'lucid-updates'), (500, 'lucid-security'), (500, 'lucid')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-22-generic (SMP w/2 CPU cores)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

-- no debconf information
diff --git a/lib/dpkg/Makefile.am b/lib/dpkg/Makefile.am
index 8ce01d8..3c8be1c 100644
--- a/lib/dpkg/Makefile.am
+++ b/lib/dpkg/Makefile.am
@@ -4,6 +4,7 @@ SUBDIRS = test
 
 localedir = $(datadir)/locale
 pkgconfdir = $(sysconfdir)/@PACKAGE@
+AM_CFLAGS = -fPIC
 AM_CPPFLAGS = \
 	-DLOCALEDIR=\"$(localedir)\" \
 	-DCONFIGDIR=\"$(pkgconfdir)\" \

Reply via email to