Skip to contentSkip to conversation

collectd: fix postgresql library detection

PATCH New Peter Seiderer 2 participants 3 messages Mar 17, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 collectd: fix postgresql library detection

Explicitly link against -lpthread and -lm.

Fixes ([1]):
checking for PQconnectdb in -lpq... no
checking for PQserverVersion in -lpq... no
postgresql . . . . . no (dependency error)

[1] http://autobuild.buildroot.org/results/926/926a43b8f635790d7e9abdc977ea803ddaf8a523/

---
 package/collectd/collectd.mk | 1 +
 1 file changed, 1 insertion(+)
package/collectd/collectd.mk +1 -0
index a4b91d6..4a40faa 100644
@@ -141,6 +141,7 @@ ifeq ($(BR2_PACKAGE_NETSNMP),y)
 endif
 ifeq ($(BR2_PACKAGE_POSTGRESQL),y)
 	COLLECTD_CONF_OPTS += --with-libpq=$(STAGING_DIR)/usr/bin/pg_config
+	COLLECTD_CONF_ENV = LIBS="-lpthread -lm"
 endif
 ifeq ($(BR2_PACKAGE_YAJL),y)
 	COLLECTD_CONF_OPTS += --with-yajl=$(STAGING_DIR)/usr
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 collectd: fix postgresql library detection

Dear Peter Seiderer,

package/collectd/collectd.mk ifeq ($(BR2_PACKAGE_NETSNMP),y) · line 144

Quoted 3 lines · Peter Seiderer

ifeq ($(BR2_PACKAGE_POSTGRESQL),y)

package/collectd/collectd.mk +1 -0
 	COLLECTD_CONF_OPTS += --with-libpq=$(STAGING_DIR)/usr/bin/pg_config
+	COLLECTD_CONF_ENV = LIBS="-lpthread -lm"

If they are needed, why isn't pg_config returning those linker flags?

I'm sorry to be annoying, but I really don't like adding LIBS variables all over the place, because they tend to become wrong/unneeded, and we never notice.

Thomas

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

PATCH 1/1 collectd: fix postgresql library detection

Hello Thomas,

Quoted 8 lines

Gesendet: Dienstag, 17. M?rz 2015 um 22:58 Uhr
Von: "Thomas Petazzoni" <[email protected]>
An: "Peter Seiderer" <[email protected]>
Cc: buildroot at busybox.net
Betreff: Re: [Buildroot] [PATCH v1] collectd: fix postgresql library detection

Dear Peter Seiderer,

Quoted 8 lines

package/collectd/collectd.mk ifeq ($(BR2_PACKAGE_NETSNMP),y) · line 144

Quoted 3 lines · Peter Seiderer

ifeq ($(BR2_PACKAGE_POSTGRESQL),y)

package/collectd/collectd.mk +1 -0
 	COLLECTD_CONF_OPTS += --with-libpq=$(STAGING_DIR)/usr/bin/pg_config
+	COLLECTD_CONF_ENV = LIBS="-lpthread -lm"

If they are needed, why isn't pg_config returning those linker flags?

Because pg_config only implements --includedir and --libdir:

    $ cat host/usr/sh4-buildroot-linux-uclibc/sysroot/usr/bin/pg_config
#!/bin/sh

#
# Minimal pg_config implementation as replacement for the native pg_config application # Only implements --includedir and --libdir
#

prefix=/home/seiderer/BUildroot/build_sh_postgresql_collectd/host/usr/sh4-buildroot-linux-uclibc/sysroot/usr

case "$1" in
--includedir)

        echo "$prefix/include"
        ;;
  --libdir)
        echo "$prefix/lib"
        ;;
  *)
        echo "Usage: $0 {--includedir|--libdir}"

esac

And collectd configure uses only this two options...

Quoted 3 lines

I'm sorry to be annoying, but I really don't like adding LIBS variables all over the place, because they tend to become wrong/unneeded, and we never notice.

...suspected this argument, I am open for other suggestions, but I think this aproach is the least invasive...

Regards,
Peter

Quoted 7 lines

Thomas

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