Skip to contentSkip to conversation

alfred-gpsd: add -lm to linker flags for libgps

PATCH In review Simon Wunderlich 2 participants 2 messages Oct 22, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 alfred-gpsd: add -lm to linker flags for libgps

Appearently applications using libgps must link -lm themselves. A patch was submitted [1] to change this unusual behaviour upstream, but was never applied. Therefore link to -lm to alfred-gpsd too as this should not hurt anyway.

[1] https://lists.berlios.de/pipermail/gpsd-dev/2011-August/009451.html

---
 gpsd/Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
gpsd/Makefile +1 -1
index 9b21652..92e690f 100644
@@ -49,7 +49,7 @@ ifeq ($(origin LIBGPS_CFLAGS) $(origin LIBGPS_LDLIBS), undefined undefined)
     $(error No $(LIBGPS_NAME) development libraries found!)
   endif
   LIBGPS_CFLAGS += $(shell $(PKG_CONFIG) --cflags $(LIBGPS_NAME))
-  LIBGPS_LDLIBS +=  $(shell $(PKG_CONFIG) --libs $(LIBGPS_NAME))
+  LIBGPS_LDLIBS +=  $(shell $(PKG_CONFIG) --libs $(LIBGPS_NAME)) -lm
 endif
 CFLAGS += $(LIBGPS_CFLAGS)
 LDLIBS += $(LIBGPS_LDLIBS)
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Simon Wunderlich

Appearently applications using libgps must link -lm themselves. A patch was submitted [1] to change this unusual behaviour upstream, but was never applied. Therefore link to -lm to alfred-gpsd too as this should not hurt anyway.

Hi Simon

What the gpsd sources i have says is:

On some systems (those which do not support implicit linking in libraries) you may need to add -lm to your link line when you link libgps. It is always safe to do this.

So i guess my Debian system does have implicit linking, and ldd on the library does include libm. Hence it worked for me.

However, as you said, it does not harm, so:

Andrew

Quoted 24 lines

[1] https://lists.berlios.de/pipermail/gpsd-dev/2011-August/009451.html

---
 gpsd/Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
gpsd/Makefile +1 -1
index 9b21652..92e690f 100644
@@ -49,7 +49,7 @@ ifeq ($(origin LIBGPS_CFLAGS) $(origin LIBGPS_LDLIBS), undefined undefined)
     $(error No $(LIBGPS_NAME) development libraries found!)
   endif
   LIBGPS_CFLAGS += $(shell $(PKG_CONFIG) --cflags $(LIBGPS_NAME))
-  LIBGPS_LDLIBS +=  $(shell $(PKG_CONFIG) --libs $(LIBGPS_NAME))
+  LIBGPS_LDLIBS +=  $(shell $(PKG_CONFIG) --libs $(LIBGPS_NAME)) -lm
 endif
 CFLAGS += $(LIBGPS_CFLAGS)
 LDLIBS += $(LIBGPS_LDLIBS)
Signature · 1 line
1.7.10.4