Skip to contentSkip to conversation

package/libubox: Fix linking against libm

PATCH New Bernd Kuhls 2 participants 2 messages Apr 28, 2015 – May 1, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/libubox: Fix linking against libm

Fixes
http://autobuild.buildroot.net/results/94d/94dd7f38ae105e7cd2f342d718e27a65edcf3a3d/
http://autobuild.buildroot.net/results/1ca/1ca29f3adc1b9b2a841df7d118548654b3235432/
http://autobuild.buildroot.net/results/231/231e5966948dcef579190c48d2aaf24414159483/
http://autobuild.buildroot.net/results/b55/b55aecc18a9870c342e0be4ed58cd609527bff96/
http://autobuild.buildroot.net/results/947/9473b109cf942296b0643e074839209134f6e3fc/
and many others

---
 package/libubox/libubox.mk |    5 +++++
 1 file changed, 5 insertions(+)
package/libubox/libubox.mk +5 -0
index 5d9c01d..15a3739 100644
@@ -10,6 +10,11 @@ LIBUBOX_LICENSE = LGPLv2.1, GPLv2, BSD-3c, MIT
 LIBUBOX_INSTALL_STAGING = YES
 LIBUBOX_DEPENDENCIES = $(if $(BR2_PACKAGE_JSON_C),json-c)
 
+# For uClibc-based toolchains, libubox forgets to link with -lm
+ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
+LIBUBOX_CONF_OPTS = -DCMAKE_C_FLAGS="-lm"
+endif
+
 ifeq ($(BR2_USE_MMU)$(BR2_PACKAGE_LUA_5_1),yy)
 LIBUBOX_DEPENDENCIES += lua
 LIBUBOX_CONF_OPTS += -DBUILD_LUA=ON \
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 package/libubox: Fix linking against libm

Dear Bernd Kuhls,

Quoted 18 lines · Bernd Kuhls

Fixes
http://autobuild.buildroot.net/results/94d/94dd7f38ae105e7cd2f342d718e27a65edcf3a3d/
http://autobuild.buildroot.net/results/1ca/1ca29f3adc1b9b2a841df7d118548654b3235432/
http://autobuild.buildroot.net/results/231/231e5966948dcef579190c48d2aaf24414159483/
http://autobuild.buildroot.net/results/b55/b55aecc18a9870c342e0be4ed58cd609527bff96/
http://autobuild.buildroot.net/results/947/9473b109cf942296b0643e074839209134f6e3fc/
and many others

---
 package/libubox/libubox.mk |    5 +++++
 1 file changed, 5 insertions(+)
package/libubox/libubox.mk +0 -0
index 5d9c01d..15a3739 100644

package/libubox/libubox.mk LIBUBOX_LICENSE = LGPLv2.1, GPLv2, BSD-3c, MIT · line 16

Quoted 7 lines
package/libubox/libubox.mk +4 -0
@@ -10,6 +10,11 @@ LIBUBOX_LICENSE = LGPLv2.1, GPLv2, BSD-3c, MIT
 LIBUBOX_INSTALL_STAGING = YES
 LIBUBOX_DEPENDENCIES = $(if $(BR2_PACKAGE_JSON_C),json-c)
 
+# For uClibc-based toolchains, libubox forgets to link with -lm
+ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
+LIBUBOX_CONF_OPTS = -DCMAKE_C_FLAGS="-lm"
+endif

This is not the right fix. This is just a workaround.

The real problem is in json-c, it uses isnan() without linking against libm. So the json-c configure.ac script should be adjusted to link against libm when needed, and reflect that in json-c pkg-config file as well.

Best regards,

Thomas

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