Skip to contentSkip to conversation

ngrep: fix static linking issue with libpcre

PATCH New Romain Naour 2 participants 3 messages Nov 2, 2013 – Nov 4, 2013

lore
Share & tools
lore
#0 lore raw

PATCH v3 2/2 ngrep: fix static linking issue with libpcre

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

---
 package/ngrep/ngrep-0003-fix-static-link.patch | 22 ++++++++++++++++++++++
 package/ngrep/ngrep.mk                         |  2 +-
 2 files changed, 23 insertions(+), 1 deletion(-)
 create mode 100644 package/ngrep/ngrep-0003-fix-static-link.patch
package/ngrep/ngrep-0003-fix-static-link.patch new file +22 -0
new file mode 100644
index 0000000..6d70778
@@ -0,0 +1,22 @@
+fix static link
+Libraries must be placed before object files.
+---
+ 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
+
package/ngrep/ngrep.mk +1 -1
index 6a9b42f..0bb5d7e 100644
@@ -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 \
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH v3 2/2 ngrep: fix static linking issue with libpcre

Quoted 23 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Romain" == Romain Naour <[email protected]> writes:

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

---
 package/ngrep/ngrep-0003-fix-static-link.patch | 22 ++++++++++++++++++++++
 package/ngrep/ngrep.mk                         |  2 +-
 2 files changed, 23 insertions(+), 1 deletion(-)
 create mode 100644 package/ngrep/ngrep-0003-fix-static-link.patch
package/ngrep/ngrep-0003-fix-static-link.patch new file +0 -0
new file mode 100644
index 0000000..6d70778

package/ngrep/ngrep-0003-fix-static-link.patch line 2

Quoted 2 lines
package/ngrep/ngrep-0003-fix-static-link.patch new file +2 -0
@@ -0,0 +1,22 @@
+fix static link
+Libraries must be placed before object files.

I guess you mean AFTER.

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH v3 2/2 ngrep: fix static linking issue with libpcre

Le 04/11/2013 22:09, Peter Korsgaard a ?crit :

Quoted 17 lines
Quoted 16 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Romain" == Romain Naour <[email protected]> writes:

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

---
 package/ngrep/ngrep-0003-fix-static-link.patch | 22 ++++++++++++++++++++++
 package/ngrep/ngrep.mk                         |  2 +-
 2 files changed, 23 insertions(+), 1 deletion(-)
 create mode 100644 package/ngrep/ngrep-0003-fix-static-link.patch
Quoted 11 lines

package/ngrep/ngrep-0003-fix-static-link.patch line 2

Quoted 8 lines
package/ngrep/ngrep-0003-fix-static-link.patch new file +2 -0
new file mode 100644
index 0000000..6d70778
@@ -0,0 +1,22 @@
+fix static link
+Libraries must be placed before object files.

I guess you mean AFTER.

Yes, copy and past error...
Thanks

Romain