Skip to contentSkip to conversation

ngrep: fix static linking issue with libpcre

PATCH Superseded Romain Naour 3 participants 5 messages Oct 6, 2013 – Oct 8, 2013

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ngrep: fix static linking issue with libpcre

-lpcre must be placed in LIBS
So, use EXTRA_LIBS variable instead of LDFLAGS

---
 package/ngrep/ngrep-1.45-configure-extra-lib.patch | 22 ++++++++++++++++++++++
 package/ngrep/ngrep.mk                             |  3 ++-
 2 files changed, 24 insertions(+), 1 deletion(-)
 create mode 100644 package/ngrep/ngrep-1.45-configure-extra-lib.patch
package/ngrep/ngrep-1.45-configure-extra-lib.patch new file +22 -0
new file mode 100644
index 0000000..aeb6a39
@@ -0,0 +1,22 @@
+
+Signed-off-by: Romain Naour <[email protected]>
+---
+ configure | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure b/configure
+index 621f1be..bd5649f 100755
+--- a/configure
++++ b/configure
+@@ -3533,7 +3533,7 @@ fi
+
+ EXTRA_DEFINES=""
+ EXTRA_INCLUDES=""
+-EXTRA_LIBS=""
++EXTRA_LIBS ?= ""
+
+
+
+--
+1.8.4
+
package/ngrep/ngrep.mk +2 -1
index 99b8f46..1501dab 100644
@@ -8,7 +8,8 @@ NGREP_VERSION = 1.45
 NGREP_SOURCE = ngrep-$(NGREP_VERSION).tar.bz2
 NGREP_SITE = http://downloads.sourceforge.net/project/ngrep/ngrep/$(NGREP_VERSION)
 NGREP_INSTALL_STAGING = YES
-NGREP_CONF_ENV = LDFLAGS="-lpcre"
+NGREP_CONF_ENV = EXTRA_LIBS="-lpcre"
+
 NGREP_CONF_OPT =  \
 	--with-pcap-includes=$(STAGING_DIR)/usr/include \
 	--enable-pcre \
Signature · 1 line
1.8.4
#1 lore raw

PATCH 1/1 ngrep: fix static linking issue with libpcre

Hi Romain,

Quoted 3 lines · Romain Naour

-lpcre must be placed in LIBS
So, use EXTRA_LIBS variable instead of LDFLAGS

Ideally, the commit message should explain why it should be placed in
LIBS instead of LDFLAGS.

Quoted 20 lines
---
  package/ngrep/ngrep-1.45-configure-extra-lib.patch | 22 ++++++++++++++++++++++
  package/ngrep/ngrep.mk                             |  3 ++-
  2 files changed, 24 insertions(+), 1 deletion(-)

create mode 100644 package/ngrep/ngrep-1.45-configure-extra-lib.patch

package/ngrep/ngrep-1.45-configure-extra-lib.patch new file +6 -0
new file mode 100644
index 0000000..aeb6a39
@@ -0,0 +1,22 @@
+
+Signed-off-by: Romain Naour <[email protected]>
+---
+ configure | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+

package/ngrep/ngrep-1.45-configure-extra-lib.patch line 16

Quoted 10 lines
package/ngrep/ngrep-1.45-configure-extra-lib.patch new file +10 -0
+diff --git a/configure b/configure
+index 621f1be..bd5649f 100755
+--- a/configure
++++ b/configure
+@@ -3533,7 +3533,7 @@ fi
+
+ EXTRA_DEFINES=""
+ EXTRA_INCLUDES=""
+-EXTRA_LIBS=""
++EXTRA_LIBS ?= ""

This is a non-Posix bashism. You'd need something like

EXTRA_LIBS=${EXTRA_LIBS:-}

However, why not just use the LIBS environment variable? Oh, looks like
the Makefile.in is broken as well and should be patched to use @LIBS@ (which also removes the need for this EXTRA_LIBS hack).

Is this project still maintained upstream? If not, don't bother
creating upstreamable patches. If it is still maintained, a proper upstreamable patch could change configure.in to use PKG_CHECK_MODULES for libpcreposix.

Regards,
Arnout

Quoted 21 lines
package/ngrep/ngrep-1.45-configure-extra-lib.patch new file +6 -0
+
+
+
+--
+1.8.4
+
package/ngrep/ngrep.mk +2 -1
index 99b8f46..1501dab 100644
@@ -8,7 +8,8 @@ NGREP_VERSION = 1.45
  NGREP_SOURCE = ngrep-$(NGREP_VERSION).tar.bz2
  NGREP_SITE = http://downloads.sourceforge.net/project/ngrep/ngrep/$(NGREP_VERSION)
  NGREP_INSTALL_STAGING = YES
-NGREP_CONF_ENV = LDFLAGS="-lpcre"
+NGREP_CONF_ENV = EXTRA_LIBS="-lpcre"
+
  NGREP_CONF_OPT =  \
  	--with-pcap-includes=$(STAGING_DIR)/usr/include \
  	--enable-pcre \
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#2 lore raw

PATCH 1/1 ngrep: fix static linking issue with libpcre

Hi Arnout,

Le 07/10/2013 23:46, Arnout Vandecappelle a ?crit :

Quoted 8 lines

Hi Romain,

Quoted 3 lines · Romain Naour

-lpcre must be placed in LIBS
So, use EXTRA_LIBS variable instead of LDFLAGS

Ideally, the commit message should explain why it should be placed in LIBS instead of LDFLAGS.

Ok, I'll be more verbose.
The reason why is that libraries must be placed after object files.

Quoted 34 lines
Quoted 21 lines
---
  package/ngrep/ngrep-1.45-configure-extra-lib.patch | 22 ++++++++++++++++++++++
  package/ngrep/ngrep.mk                             |  3 ++-
  2 files changed, 24 insertions(+), 1 deletion(-)

create mode 100644 package/ngrep/ngrep-1.45-configure-extra-lib.patch

package/ngrep/ngrep-1.45-configure-extra-lib.patch new file +6 -0
new file mode 100644
index 0000000..aeb6a39
@@ -0,0 +1,22 @@
+
+Signed-off-by: Romain Naour <[email protected]>
+---
+ configure | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+

package/ngrep/ngrep-1.45-configure-extra-lib.patch line 16

Quoted 10 lines
package/ngrep/ngrep-1.45-configure-extra-lib.patch new file +10 -0
+diff --git a/configure b/configure
+index 621f1be..bd5649f 100755
+--- a/configure
++++ b/configure
+@@ -3533,7 +3533,7 @@ fi
+
+ EXTRA_DEFINES=""
+ EXTRA_INCLUDES=""
+-EXTRA_LIBS=""
++EXTRA_LIBS ?= ""

This is a non-Posix bashism. You'd need something like

Quoted 1 line

EXTRA_LIBS=${EXTRA_LIBS:-}

Ok, thanks for the tips.

Quoted 3 lines

However, why not just use the LIBS environment variable? Oh, looks like the Makefile.in is broken as well and should be patched to use @LIBS@ (which
also removes the need for this EXTRA_LIBS hack).

I tested this but -lpcap appears twice in LIBS, but it fix the build.

Quoted 3 lines

Is this project still maintained upstream? If not, don't bother creating upstreamable patches. If it is still maintained, a proper upstreamable patch
could change configure.in to use PKG_CHECK_MODULES for libpcreposix.

It seems not maintained anymore, the last release was published in 2006 and the last commit in sourceforge is dated 2008.

Also, Gentoo seems to have a patch for this problem.
http://ftp.eenet.ee/gentoo-portage/net-analyzer/ngrep/files/ngrep-1.45.patch

Maybe just patch Makefile.in to add -lpcre beside -lpcap ?

Best regards,
Romain

Quoted 27 lines

Regards,
Arnout

Quoted 21 lines
package/ngrep/ngrep-1.45-configure-extra-lib.patch new file +6 -0
+
+
+
+--
+1.8.4
+
package/ngrep/ngrep.mk +2 -1
index 99b8f46..1501dab 100644
@@ -8,7 +8,8 @@ NGREP_VERSION = 1.45
  NGREP_SOURCE = ngrep-$(NGREP_VERSION).tar.bz2
  NGREP_SITE = http://downloads.sourceforge.net/project/ngrep/ngrep/$(NGREP_VERSION)
  NGREP_INSTALL_STAGING = YES
-NGREP_CONF_ENV = LDFLAGS="-lpcre"
+NGREP_CONF_ENV = EXTRA_LIBS="-lpcre"
+
  NGREP_CONF_OPT =  \
      --with-pcap-includes=$(STAGING_DIR)/usr/include \
      --enable-pcre \
Signature · 8 lines
Romain Naour

OPEN WIDE Ing?nierie - Paris
23/25, rue Daviel 75013 PARIS
http://ingenierie.openwide.fr

Le blog des technologies libres et embarqu?es :
http://www.linuxembedded.fr
#3 lore raw

PATCH 1/1 ngrep: fix static linking issue with libpcre

Dear Romain Naour,

Quoted 4 lines · Romain Naour

Also, Gentoo seems to have a patch for this problem.
http://ftp.eenet.ee/gentoo-portage/net-analyzer/ngrep/files/ngrep-1.45.patch

Maybe just patch Makefile.in to add -lpcre beside -lpcap ?

Or use pkg-config to get the proper list of libraries.

Thomas

Signature · 3 lines
Thomas Petazzoni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH 1/1 ngrep: fix static linking issue with libpcre

Quoted 10 lines · Thomas Petazzoni

Dear Romain Naour,

Quoted 4 lines · Romain Naour

Also, Gentoo seems to have a patch for this problem.
http://ftp.eenet.ee/gentoo-portage/net-analyzer/ngrep/files/ngrep-1.45.patch

Maybe just patch Makefile.in to add -lpcre beside -lpcap ?

Or use pkg-config to get the proper list of libraries.

If upstream is dead, that's a bit pointless, no?

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F