Re: [OpenWrt-Devel] [PATCH 19.07] libpcap: Update shared-lib patch from Debian to fix linking problems
Hello Hauke, libpcap is broken and this patch might be the cause. root@xxx:~# tcpdump Error loading shared library libpcap.so.1: No such file or directory (needed by /usr/sbin/tcpdump) Error relocating /usr/sbin/tcpdump: pcap_set_tstamp_type: symbol not found ... It's missing the last digit: root@xxx:~# opkg files libpcap1 Package libpcap1 (1.9.1-2) is installed on root and has the following files: /usr/lib/libpcap.so.0.8 /usr/lib/libpcap.so. root@xxx:~# opkg info libpcap1 Package: libpcap1 Version: 1.9.1-2 Depends: libc Provides: libpcap Status: install user installed Section: libs Architecture: x86_64 Size: 100915 Filename: libpcap1_1.9.1-2_x86_64.ipk Description: This package contains a system-independent library for user-level network packet capture. Installed-Time: 1587678893 Manually creating the link "libpcap.so. -> libpcap.so.1" does solve the problem. --- Luiz Angelo Daros de Luca luizl...@gmail.com --- Luiz Angelo Daros de Luca luizl...@gmail.com Em sex., 20 de mar. de 2020 às 15:07, Hauke Mehrtens escreveu: > > This updates the shared-lib patch to the recent version from debian > found here: > https://salsa.debian.org/rfrancoise/libpcap/-/blob/debian/1.9.1-2/debian/patches/shared-lib.diff > > This patch makes it include missing/strlcpy.o to the shared library > which is needed for OpenWrt glibc builds, otherwise there is an > undefined symbol and tcpdump and other builds are failing. > > Fixes: 44f11353de04 ("libpcap: update to 1.9.1") > Signed-off-by: Hauke Mehrtens > --- > package/libs/libpcap/Makefile | 4 +- > .../patches/100-debian_shared_lib.patch | 194 ++ > .../102-makefile_disable_manpages.patch | 6 +- > .../103-makefile_flex_workaround.patch| 2 +- > 4 files changed, 157 insertions(+), 49 deletions(-) > > diff --git a/package/libs/libpcap/Makefile b/package/libs/libpcap/Makefile > index fae955a54d..9a78216e3a 100644 > --- a/package/libs/libpcap/Makefile > +++ b/package/libs/libpcap/Makefile > @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk > > PKG_NAME:=libpcap > PKG_VERSION:=1.9.1 > -PKG_RELEASE:=1 > +PKG_RELEASE:=2 > > PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz > PKG_SOURCE_URL:=http://www.us.tcpdump.org/release/ \ > @@ -32,7 +32,7 @@ define Package/libpcap >TITLE:=Low-level packet capture library >URL:=http://www.tcpdump.org/ >MENU:=1 > - ABI_VERSION:=1 > + ABI_VERSION:=2 > endef > > define Package/libpcap/description > diff --git a/package/libs/libpcap/patches/100-debian_shared_lib.patch > b/package/libs/libpcap/patches/100-debian_shared_lib.patch > index 454490fbfa..ab70417de7 100644 > --- a/package/libs/libpcap/patches/100-debian_shared_lib.patch > +++ b/package/libs/libpcap/patches/100-debian_shared_lib.patch > @@ -3,12 +3,13 @@ build a shared library. > > --- a/Makefile.in > +++ b/Makefile.in > -@@ -40,6 +40,13 @@ mandir = @mandir@ > +@@ -40,6 +40,14 @@ mandir = @mandir@ > srcdir = @srcdir@ > VPATH = @srcdir@ > > +# some defines for shared library compilation > -+LIBVERSION=1 > ++MAJ=0.8 > ++LIBVERSION=$(shell head -1 debian/changelog | perl -nle > 'm/\S+\s+\((\S+)-\S+\)/ and print $$1') > +LIBNAME=pcap > +LIBRARY=lib$(LIBNAME).a > +SOLIBRARY=lib$(LIBNAME).so > @@ -17,38 +18,38 @@ build a shared library. > # > # You shouldn't need to edit anything below. > # > -@@ -69,7 +76,8 @@ INSTALL_RPCAPD=@INSTALL_RPCAPD@ > +@@ -69,7 +77,8 @@ INSTALL_RPCAPD=@INSTALL_RPCAPD@ > EXTRA_NETWORK_LIBS=@EXTRA_NETWORK_LIBS@ > > # Standard CFLAGS for building members of a shared library > -FULL_CFLAGS = $(CCOPT) @V_LIB_CCOPT_FAT@ $(SHLIB_CCOPT) $(INCLS) $(DEFS) > $(CFLAGS) > +FULL_CFLAGS = $(CCOPT) @V_LIB_CCOPT_FAT@ $(SHLIB_CCOPT) $(INCLS) $(DEFS) > $(CFLAGS) $(CPPFLAGS) > -+CFLAGS_SHARED = -shared -Wl,-soname,$(SHAREDLIB) > ++CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ) > -Wl,--version-script=libpcap-symbols.lds > > INSTALL = @INSTALL@ > INSTALL_PROGRAM = @INSTALL_PROGRAM@ > -@@ -84,7 +92,11 @@ YACC = @YACC@ > +@@ -84,7 +93,11 @@ YACC = @YACC@ > # problem if you don't own the file but can write to the directory. > .c.o: > @rm -f $@ > - $(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c > + $(CC) $(FULL_CFLAGS) -c -o $@ $(srcdir)/$*.c > + > -+%_pic.o: %.c %.o > ++%_pic.o: %.c > + @rm -f $@ > + $(CC) -fPIC $(FULL_CFLAGS) -c -o $@ $(srcdir)/$*.c > > PSRC =pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @BT_MONITOR_SRC@ > @NETFILTER_SRC@ @DBUS_SRC@ @NETMAP_SRC@ @RDMA_SRC@ > FSRC = @V_FINDALLDEVS@ > -@@ -101,6 +113,7 @@ SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $( > +@@ -101,6 +114,7 @@ SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $( > # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot > # hack the extra indirection > OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) > $(GENSRC:.c=.o) $(LIBOBJS) > -+OBJ_PIC = $(PSRC:.c=_pic.o) $(FSRC:.c=_pic.o) $(CSRC:.c=_pic.o) >
[OpenWrt-Devel] [PATCH 19.07] libpcap: Update shared-lib patch from Debian to fix linking problems
This updates the shared-lib patch to the recent version from debian found here: https://salsa.debian.org/rfrancoise/libpcap/-/blob/debian/1.9.1-2/debian/patches/shared-lib.diff This patch makes it include missing/strlcpy.o to the shared library which is needed for OpenWrt glibc builds, otherwise there is an undefined symbol and tcpdump and other builds are failing. Fixes: 44f11353de04 ("libpcap: update to 1.9.1") Signed-off-by: Hauke Mehrtens --- package/libs/libpcap/Makefile | 4 +- .../patches/100-debian_shared_lib.patch | 194 ++ .../102-makefile_disable_manpages.patch | 6 +- .../103-makefile_flex_workaround.patch| 2 +- 4 files changed, 157 insertions(+), 49 deletions(-) diff --git a/package/libs/libpcap/Makefile b/package/libs/libpcap/Makefile index fae955a54d..9a78216e3a 100644 --- a/package/libs/libpcap/Makefile +++ b/package/libs/libpcap/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libpcap PKG_VERSION:=1.9.1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.us.tcpdump.org/release/ \ @@ -32,7 +32,7 @@ define Package/libpcap TITLE:=Low-level packet capture library URL:=http://www.tcpdump.org/ MENU:=1 - ABI_VERSION:=1 + ABI_VERSION:=2 endef define Package/libpcap/description diff --git a/package/libs/libpcap/patches/100-debian_shared_lib.patch b/package/libs/libpcap/patches/100-debian_shared_lib.patch index 454490fbfa..ab70417de7 100644 --- a/package/libs/libpcap/patches/100-debian_shared_lib.patch +++ b/package/libs/libpcap/patches/100-debian_shared_lib.patch @@ -3,12 +3,13 @@ build a shared library. --- a/Makefile.in +++ b/Makefile.in -@@ -40,6 +40,13 @@ mandir = @mandir@ +@@ -40,6 +40,14 @@ mandir = @mandir@ srcdir = @srcdir@ VPATH = @srcdir@ +# some defines for shared library compilation -+LIBVERSION=1 ++MAJ=0.8 ++LIBVERSION=$(shell head -1 debian/changelog | perl -nle 'm/\S+\s+\((\S+)-\S+\)/ and print $$1') +LIBNAME=pcap +LIBRARY=lib$(LIBNAME).a +SOLIBRARY=lib$(LIBNAME).so @@ -17,38 +18,38 @@ build a shared library. # # You shouldn't need to edit anything below. # -@@ -69,7 +76,8 @@ INSTALL_RPCAPD=@INSTALL_RPCAPD@ +@@ -69,7 +77,8 @@ INSTALL_RPCAPD=@INSTALL_RPCAPD@ EXTRA_NETWORK_LIBS=@EXTRA_NETWORK_LIBS@ # Standard CFLAGS for building members of a shared library -FULL_CFLAGS = $(CCOPT) @V_LIB_CCOPT_FAT@ $(SHLIB_CCOPT) $(INCLS) $(DEFS) $(CFLAGS) +FULL_CFLAGS = $(CCOPT) @V_LIB_CCOPT_FAT@ $(SHLIB_CCOPT) $(INCLS) $(DEFS) $(CFLAGS) $(CPPFLAGS) -+CFLAGS_SHARED = -shared -Wl,-soname,$(SHAREDLIB) ++CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ) -Wl,--version-script=libpcap-symbols.lds INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ -@@ -84,7 +92,11 @@ YACC = @YACC@ +@@ -84,7 +93,11 @@ YACC = @YACC@ # problem if you don't own the file but can write to the directory. .c.o: @rm -f $@ - $(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c + $(CC) $(FULL_CFLAGS) -c -o $@ $(srcdir)/$*.c + -+%_pic.o: %.c %.o ++%_pic.o: %.c + @rm -f $@ + $(CC) -fPIC $(FULL_CFLAGS) -c -o $@ $(srcdir)/$*.c PSRC =pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @BT_MONITOR_SRC@ @NETFILTER_SRC@ @DBUS_SRC@ @NETMAP_SRC@ @RDMA_SRC@ FSRC = @V_FINDALLDEVS@ -@@ -101,6 +113,7 @@ SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $( +@@ -101,6 +114,7 @@ SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $( # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot # hack the extra indirection OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS) -+OBJ_PIC = $(PSRC:.c=_pic.o) $(FSRC:.c=_pic.o) $(CSRC:.c=_pic.o) $(SSRC:.c=_pic.o) $(GENSRC:.c=_pic.o) ++OBJ_PIC = $(PSRC:.c=_pic.o) $(FSRC:.c=_pic.o) $(CSRC:.c=_pic.o) $(SSRC:.c=_pic.o) $(GENSRC:.c=_pic.o) $(LIBOBJS:.o=_pic.o) PUBHDR = \ pcap.h \ pcap-bpf.h \ -@@ -155,7 +168,7 @@ TAGFILES = \ +@@ -155,7 +169,7 @@ TAGFILES = \ CLEANFILES = $(OBJ) libpcap.a libpcap.so.`cat $(srcdir)/VERSION` \ $(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \ @@ -57,7 +58,7 @@ build a shared library. MAN1 = pcap-config.1 -@@ -392,7 +405,7 @@ libpcap.a: $(OBJ) +@@ -392,7 +406,7 @@ libpcap.a: $(OBJ) $(AR) rc $@ $(OBJ) $(ADDLARCHIVEOBJS) $(RANLIB) $@ @@ -66,20 +67,21 @@ build a shared library. libpcap.so: $(OBJ) @rm -f $@ -@@ -468,6 +481,12 @@ libpcap.shareda: $(OBJ) +@@ -468,6 +482,13 @@ libpcap.shareda: $(OBJ) # libpcap.none: +$(SHAREDLIB): $(OBJ_PIC) + -@rm -f $@ -+ -@rm -f $(SOLIBRARY) ++ -@rm -f $(SOLIBRARY) $(SOLIBRARY).$(MAJ) + $(CC) $(CFLAGS_SHARED) $(LDFLAGS) -o $(SHAREDLIB) $(OBJ_PIC) -lc $(LIBS) -+ ln -s $(SHAREDLIB) $(SOLIBRARY) ++ ln -s $(SHAREDLIB) $(SOLIBRARY).$(MAJ) ++ ln -s $(SOLIBRARY).$(MAJ) $(SOLIBRARY) + scanner.c: $(srcdir)/scanner.l $(LEX) -P pcap_ --header-file=scanner.h --nounput -o