Package: iptables-dev
Version: 1.3.3-2
Severity: normal
Tags: patch

I'm trying to link a shared library (specifically, a Python C Module)
against libiptc.a. This works fine on x86. On amd64, however, the linking
fails with a R_X86_64_32S relocation error; specifically:

gcc -pthread -shared build/temp.linux-x86_64-2.3/iptintmodule.o -liptc -o
build/lib.linux-x86_64-2.3/iptint.so
/usr/bin/ld:
/usr/lib/gcc/x86_64-linux-gnu/3.4.6/../../../../lib/libiptc.a(libip4tc.o):
relocation R_X86_64_32S against `iptc_free' can not be used when making a
shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/3.4.6/../../../../lib/libiptc.a: could not
read symbols: Bad value
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

Apparently this is because shared objects always use Position Independent
Code, while libiptc.a is currently compiled without -fPIC. For some reason,
it works correctly on x86 regardless.
This can be fixed by a trivial change to
'pkg_dir/debian/build/iptables-1.3.3/Makefile', adding -fPIC to the CFLAGS.
The attached trivial patch does just that, if placed in
'pkg_dir/patches/all/' and subsequently applied by the Debian build scripts.
Afaict, this completely fixes the problem for me.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (990, 'unstable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15-dana
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)

-- no debconf information
--- old/iptables-1.3.3/Makefile 2006-03-23 17:34:57.000000000 +0100
+++ new/iptables-1.3.3/Makefile 2006-03-23 17:25:12.000000000 +0100
@@ -34 +34 @@
-COPT_FLAGS:=-O2
+COPT_FLAGS:=-O2 -fPIC

Reply via email to