Debian Bug report logs - #358637
[noop] libip* should be compiled with -fPIC; attempt to

version graph

Package: iptables-dev; Maintainer for iptables-dev is Debian Netfilter Packaging Team <pkg-netfilter-team@lists.alioth.debian.org>; Source for iptables-dev is src:iptables (PTS, buildd, popcon).

Reported by: Sebastian Hagen <sebastian_hagen@memespace.net>

Date: Thu, 23 Mar 2006 17:18:05 UTC

Severity: important

Tags: patch

Found in version iptables-dev/1.3.3-2

Done: "Laurence J. Lane" <ljlane@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, ljlane@debian.org (Laurence J. Lane):
Bug#358637; Package iptables-dev. (full text, mbox, link).


Acknowledgement sent to Sebastian Hagen <sebastian_hagen@memespace.net>:
New Bug report received and forwarded. Copy sent to ljlane@debian.org (Laurence J. Lane). (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Sebastian Hagen <sebastian_hagen@memespace.net>
To: submit@bugs.debian.org
Subject: libip* should be compiled with -fPIC; attempt to link the current libiptc.a binary into a shared library on amd64 causes an R_X86_64_32S relocation error
Date: Thu, 23 Mar 2006 18:13:04 +0100
[Message part 1 (text/plain, inline)]
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: LANG=de_DE@euro, LC_CTYPE=de_DE@euro (charmap=ISO-8859-15)

-- no debconf information
[003-dev_fPIC.patch (text/plain, inline)]
--- 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

Information forwarded to debian-bugs-dist@lists.debian.org, ljlane@debian.org (Laurence J. Lane):
Bug#358637; Package iptables-dev. (full text, mbox, link).


Acknowledgement sent to Kurt Roeckx <kurt@roeckx.be>:
Extra info received and forwarded to list. Copy sent to ljlane@debian.org (Laurence J. Lane). (full text, mbox, link).


Message #10 received at 358637@bugs.debian.org (full text, mbox, reply):

From: Kurt Roeckx <kurt@roeckx.be>
To: 358637@bugs.debian.org
Subject: Re: libip* should be compiled with -fPIC.
Date: Tue, 18 Apr 2006 20:39:30 +0200
Hi,

Policy 10.2 says that a static library should get build without
-fPIC.  Only shared libraries should get build with -fPIC.

Either iptables-dev needs to provide a shared library, or it
should provide a pic version of the static library.

From http://release.debian.org/etch_rc_policy.txt:

  (f) Libraries

        Shared libraries must be compiled with -fPIC, and normally static
        libraries must not be. If you need to provide static libraries
        compiled with -fPIC, call it "<libname>_pic.a".

Kurt




Information forwarded to debian-bugs-dist@lists.debian.org, ljlane@debian.org (Laurence J. Lane):
Bug#358637; Package iptables-dev. (full text, mbox, link).


Acknowledgement sent to Sebastian Hagen <sebastian_hagen@memespace.net>:
Extra info received and forwarded to list. Copy sent to ljlane@debian.org (Laurence J. Lane). (full text, mbox, link).


Message #15 received at 358637@bugs.debian.org (full text, mbox, reply):

From: Sebastian Hagen <sebastian_hagen@memespace.net>
To: 358637@bugs.debian.org
Subject: Re: libip* should be compiled with -fPIC.
Date: Sun, 18 Jun 2006 20:46:11 +0200
[Message part 1 (text/plain, inline)]
> Either iptables-dev needs to provide a shared library, or it
> should provide a pic version of the static library.
Unfortunately, providing a single shared library isn't possible in this case.
libiptc.a is an ar archive of two object files: libip4tc.o and libip6tc.o.
These two files contain a few symbols with the same names, namely
'TC_GET_RULE', 'TC_NUM_RULES' and 'standard_target_map'. While this isn't a
problem when putting them together into an ar archive, trying to link them
into a single shared library results in 'multiple definition' errors.

Aside from changing the way the object files are generated, the options are:
1) Make a -fPICed static library, i.e. libiptc_pic.a
2) Split the code into two different shared libraries; i.e. something like
libip4tc.so and libip6tc.so

Either one would work for me. For now I've tried to do the former; see the
attached patch.

Sebastian Hagen
[003-dev_lib_fPIC.patch (text/plain, inline)]
--- old/iptables_profectio/libiptc/Makefile	2004-10-10 11:56:24.000000000 +0200
+++ build/iptables_profectio/libiptc/Makefile	2006-06-18 20:17:28.000000000 +0200
@@ -1,8 +1,8 @@
 #! /usr/bin/make
 
-EXTRAS+=libiptc/libiptc.a
+EXTRAS+=libiptc/libiptc.a libiptc/libiptc_pic.a
 
-DEVEL_LIBS+=libiptc/libiptc.a
+DEVEL_LIBS+=libiptc/libiptc.a libiptc/libiptc_pic.a
 
 ifndef TOPLEVEL_INCLUDED
 local:
@@ -13,6 +13,20 @@
 
 libiptc/libiptc.a: libiptc/libiptc.a(libiptc/libip4tc.o)
 
+libiptc/libip4tc_pic.o: libiptc/libip4tc.c
+	$(CC) $(SH_CFLAGS) -c -o $@ $^
+
+libiptc/libip6tc_pic.o: libiptc/libip6tc.c
+	$(CC) $(SH_CFLAGS) -c -o $@ $^
+
+ifeq ($(DO_IPV6), 1)
+libiptc/libiptc_pic.a: libiptc/libip4tc_pic.o libiptc/libip6tc_pic.o
+	rm -f $@; ar crv $@ $^
+else
+libiptc/libiptc_pic.a: libiptc/libip4tc_pic.o
+	rm -f $@; ar crv $@ $^
+endif
+
 ifeq ($(DO_IPV6), 1)
 EXTRA_DEPENDS+= libiptc/libip6tc.d
 libiptc/libiptc.a: libiptc/libiptc.a(libiptc/libip6tc.o)

Information forwarded to debian-bugs-dist@lists.debian.org, ljlane@debian.org (Laurence J. Lane):
Bug#358637; Package iptables-dev. (full text, mbox, link).


Acknowledgement sent to Sebastian Harl <sh@tokkee.org>:
Extra info received and forwarded to list. Copy sent to ljlane@debian.org (Laurence J. Lane). (full text, mbox, link).


Message #20 received at 358637@bugs.debian.org (full text, mbox, reply):

From: Sebastian Harl <sh@tokkee.org>
To: 358637@bugs.debian.org, 419684@bugs.debian.org, control@bugs.debian.org
Subject: severity raise
Date: Tue, 17 Apr 2007 15:22:25 +0200
[Message part 1 (text/plain, inline)]
severity 358637 serious
severity 419684 serious
thanks

Hi,

These two bugs cause a FTBFS of the upcoming collectd package, thus I'm
raising the severity. A shared library should be an appropriate solution in my
case as well as building using -fPIC.

TIA,
Sebastian

-- 
Sebastian "tokkee" Harl
GnuPG-ID: 0x8501C7FC
http://tokkee.org/

[signature.asc (application/pgp-signature, inline)]

Severity set to `serious' from `normal' Request was from Sebastian Harl <sh@tokkee.org> to control@bugs.debian.org. (Tue, 17 Apr 2007 13:30:07 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, ljlane@debian.org (Laurence J. Lane):
Bug#358637; Package iptables-dev. (full text, mbox, link).


Acknowledgement sent to Steve Langasek <vorlon@debian.org>:
Extra info received and forwarded to list. Copy sent to ljlane@debian.org (Laurence J. Lane). (full text, mbox, link).


Message #27 received at 358637@bugs.debian.org (full text, mbox, reply):

From: Steve Langasek <vorlon@debian.org>
To: 358637@bugs.debian.org, Sebastian Harl <sh@tokkee.org>, 419684@bugs.debian.org
Subject: PIC libraries are not mandatory under policy
Date: Wed, 18 Apr 2007 16:12:00 -0700
severity 419684 important
severity 358637 important
thanks

> These two bugs cause a FTBFS of the upcoming collectd package, thus I'm
> raising the severity. A shared library should be an appropriate solution in
> my case as well as building using -fPIC.

It is not mandatory for library packages to support use cases that require
PIC; it is only mandatory that *if* they build shared libraries they are
built using -fPIC.

If that makes it impossible to package collectd, sorry, but RC bugs are
still not an instrument with which to bludgeon maintainers into supporting
your target use case.

These bugs are still ok candidates for NMUs if you can provide patches that
the maintainers don't object to and follow the NMU procedure in the devref.

Cheers,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
vorlon@debian.org                                   http://www.debian.org/



Severity set to `important' from `serious' Request was from Steve Langasek <vorlon@debian.org> to control@bugs.debian.org. (Wed, 18 Apr 2007 23:15:05 GMT) (full text, mbox, link).


Reply sent to "Laurence J. Lane" <ljlane@debian.org>:
You have taken responsibility. (full text, mbox, link).


Notification sent to Sebastian Hagen <sebastian_hagen@memespace.net>:
Bug acknowledged by developer. (full text, mbox, link).


Message #34 received at 358637-done@bugs.debian.org (full text, mbox, reply):

From: "Laurence J. Lane" <ljlane@debian.org>
To: 358637-done@bugs.debian.org
Subject: libip* should be compiled with -fPIC; attempt to link the current libiptc.a binary into a shared library on amd64 causes an R_X86_64_32S relocation error
Date: Wed, 6 Feb 2008 20:20:12 -0500
retitle 358637 [noop] libip* should be compiled with -fPIC
thanks

Version: 1.4.0-1

iptc is now withdrawn from the Debian packages. Upstream never intended
iptc to be distributed as stand alone library and never provided a published
interface.  Adding it was my error.




Changed Bug title to `[noop] libip* should be compiled with -fPIC; attempt to' from `libip* should be compiled with -fPIC; attempt to link the current libiptc.a binary into a shared library on amd64 causes an R_X86_64_32S relocation error'. Request was from "Laurence J. Lane" <ljlane@debian.org> to control@bugs.debian.org. (Fri, 08 Feb 2008 02:03:02 GMT) (full text, mbox, link).


Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Fri, 07 Mar 2008 07:29:36 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Thu Jan 11 02:32:31 2018; Machine Name: beach

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.