[Buildroot] [git commit] ngrep: fix static linking issue with libpcre

Peter Korsgaard peter at korsgaard.com
Mon Nov 4 20:55:17 UTC 2013


commit: http://git.buildroot.net/buildroot/commit/?id=6d3b4faca914cde10e4238b3cca45f680eaa41b9
branch: http://git.buildroot.net/buildroot/commit/?id=refs/heads/master

Adding -lpcre in LDFLAGS place the library before object files:
gcc ... -lpcre -L.../sysroot/usr/lib -s -o ngrep ngrep.o -lpcap

Makefile.in is patched to use @LIBS@ for adding -lpcre in the right place.

Fixes:
http://autobuild.buildroot.net/results/684/684a3bed28d13ef5e5156257aade3b9aff32f180

[Peter: fixup patch description]
Signed-off-by: Romain Naour <romain.naour at openwide.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
Signed-off-by: Peter Korsgaard <peter at korsgaard.com>
---
 package/ngrep/ngrep-0003-fix-static-link.patch |   25 ++++++++++++++++++++++++
 package/ngrep/ngrep.mk                         |    2 +-
 2 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/package/ngrep/ngrep-0003-fix-static-link.patch b/package/ngrep/ngrep-0003-fix-static-link.patch
new file mode 100644
index 0000000..98c2626
--- /dev/null
+++ b/package/ngrep/ngrep-0003-fix-static-link.patch
@@ -0,0 +1,25 @@
+ngrep: fix static link with pcre
+
+Libraries must be placed after object files.
+
+Signed-off-by: Romain Naour <romain.naour at openwide.fr>
+---
+ Makefile.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 2ae4506..761d7d9 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -11,7 +11,7 @@ CFLAGS=@CFLAGS@ -D at OS@ @DEFS@ @EXTRA_DEFINES@
+ INCLUDES=-I at srcdir@ @PCAP_INCLUDE@ @EXTRA_INCLUDES@
+ 
+ LDFLAGS=@LDFLAGS@ @PCAP_LINK@
+-LIBS=-lpcap @EXTRA_LIBS@ 
++LIBS=@LIBS@ @EXTRA_LIBS@
+ 
+ STRIPFLAG=@STRIPFLAG@
+ 
+-- 
+1.8.1.4
+
diff --git a/package/ngrep/ngrep.mk b/package/ngrep/ngrep.mk
index 6a9b42f..0bb5d7e 100644
--- a/package/ngrep/ngrep.mk
+++ b/package/ngrep/ngrep.mk
@@ -10,7 +10,7 @@ NGREP_SITE = http://downloads.sourceforge.net/project/ngrep/ngrep/$(NGREP_VERSIO
 NGREP_LICENSE = BSD-4c-like
 NGREP_LICENSE_FILES = LICENSE.txt
 NGREP_INSTALL_STAGING = YES
-NGREP_CONF_ENV = LDFLAGS="-lpcre"
+NGREP_CONF_ENV = LIBS="-lpcre"
 NGREP_CONF_OPT =  \
 	--with-pcap-includes=$(STAGING_DIR)/usr/include \
 	--enable-pcre \


More information about the buildroot mailing list