> 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
--- 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)

Reply via email to