Skip to contentSkip to conversation

package/lua: link liblua.so with $(LIBS)

PATCH In review James Hilliard 1 participant 2 messages Feb 18 – Oct 27

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/lua: link liblua.so with $(LIBS)

The shared liblua.so rule omitted $(LIBS), so direct deps like -lm were not recorded.

Fixes:
Relink /lib64/liblua.so.5.4.8' with /lib64/libm.so.6' for IFUNC symbol `sin'

---
 package/lua/5.1.5/0002-shared-libs-for-lua.patch | 2 +-
 package/lua/5.3.6/0002-shared-libs-for-lua.patch | 2 +-
 package/lua/5.4.8/0002-shared-libs-for-lua.patch | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
package/lua/5.1.5/0002-shared-libs-for-lua.patch +1 -1
index 5ae0756c4c..0ec6d97391 100644
@@ -64,7 +64,7 @@ Index: b/src/Makefile
  	$(RANLIB) $@
  
 +$(LUA_SO): $(CORE_O) $(LIB_O)
-+	$(CC) -o $@.$(PKG_VERSION) -shared -Wl,-soname="$@.$(PKG_VERSION)" $?
++	$(CC) -o $@.$(PKG_VERSION) -shared -Wl,-soname="$@.$(PKG_VERSION)" $? $(LIBS)
 +	ln -fs $@.$(PKG_VERSION) $@
 +
 +ifneq (dynamic,$(BUILDMODE))
package/lua/5.3.6/0002-shared-libs-for-lua.patch +1 -1
index 0821007474..6c3efc0a37 100644
@@ -64,7 +64,7 @@ Index: b/src/Makefile
  	$(RANLIB) $@
  
 +$(LUA_SO): $(CORE_O) $(LIB_O)
-+	$(CC) -o $@.$(PKG_VERSION) -shared -Wl,-soname="$@.$(PKG_VERSION)" $?
++	$(CC) -o $@.$(PKG_VERSION) -shared -Wl,-soname="$@.$(PKG_VERSION)" $? $(LIBS)
 +	ln -fs $@.$(PKG_VERSION) $@
 +
 +ifneq (dynamic,$(BUILDMODE))
package/lua/5.4.8/0002-shared-libs-for-lua.patch +1 -1
index 6115960956..d583b17193 100644
@@ -64,7 +64,7 @@ Index: b/src/Makefile
  	$(RANLIB) $@
  
 +$(LUA_SO): $(CORE_O) $(LIB_O)
-+	$(CC) -o $@.$(PKG_VERSION) -shared -Wl,-soname="$@.$(PKG_VERSION)" $?
++	$(CC) -o $@.$(PKG_VERSION) -shared -Wl,-soname="$@.$(PKG_VERSION)" $? $(LIBS)
 +	ln -fs $@.$(PKG_VERSION) $@
 +
 +ifneq (dynamic,$(BUILDMODE))
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 6 lines · James Hilliard

The shared liblua.so rule omitted $(LIBS), so direct deps like -lm were not recorded.

Fixes:
Relink /lib64/liblua.so.5.4.8' with /lib64/libm.so.6' for IFUNC symbol `sin'

This was a runtime failure, not an autobuilder failure. I hit it starting Weston on an x86-64 system with glibc 2.42, shortly before sending the patch:

/bin/weston: Relink `/lib64/liblua.so.5.4.8' with
/lib64/libm.so.6' for IFUNC symbol sin'

Weston loads libinput, which pulls in Lua. ELF inspection showed that liblua.so referenced math functions but had no DT_NEEDED entry for libm.so.6. This allowed glibc to resolve an IFUNC before libm had been relocated, resulting in a segmentation fault during startup.

The recent trigger is ce823a0f5b4c ("package/libinput: bump version to 1.30.1"), which enabled Lua support when Lua 5.4 is selected. The incorrect Lua link rule predates that change.

I have since reproduced this independently with Buildroot 2026.02, using the following configuration:

BR2_x86_64=y
BR2_TOOLCHAIN_EXTERNAL=y BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_X86_64_GLIBC_BLEEDING_EDGE=y BR2_SHARED_LIBS=y BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
# BR2_PACKAGE_EUDEV_MODULE_LOADING is not set
# BR2_PACKAGE_EUDEV_ENABLE_HWDB is not set BR2_PACKAGE_LUA=y
BR2_PACKAGE_LUA_5_4=y
BR2_PACKAGE_LIBINPUT=y

After building with make libinput, this reproduces the failure on an x86-64 host using the target's loader and libraries:

T="$PWD/output/target"

"$T/lib/ld-linux-x86-64.so.2" \
    --library-path "$T/usr/lib:$T/lib" \
    "$T/usr/libexec/libinput/libinput-list-devices" --help

This reproducer reports ceil rather than sin. Libinput 1.29.0 works, while 1.30.1 and 1.31.0 crash with the unfixed Lua library. Adding $(LIBS) records the missing libm dependency and makes the same executables work without rebuilding libinput.

Quoted 48 lines
---
 package/lua/5.1.5/0002-shared-libs-for-lua.patch | 2 +-
 package/lua/5.3.6/0002-shared-libs-for-lua.patch | 2 +-
 package/lua/5.4.8/0002-shared-libs-for-lua.patch | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
package/lua/5.1.5/0002-shared-libs-for-lua.patch +1 -1
index 5ae0756c4c..0ec6d97391 100644
@@ -64,7 +64,7 @@ Index: b/src/Makefile
        $(RANLIB) $@
 
 +$(LUA_SO): $(CORE_O) $(LIB_O)
-+      $(CC) -o $@.$(PKG_VERSION) -shared -Wl,-soname="$@.$(PKG_VERSION)" $?
++      $(CC) -o $@.$(PKG_VERSION) -shared -Wl,-soname="$@.$(PKG_VERSION)" $? $(LIBS)
 +      ln -fs $@.$(PKG_VERSION) $@
 +
 +ifneq (dynamic,$(BUILDMODE))
package/lua/5.3.6/0002-shared-libs-for-lua.patch +1 -1
index 0821007474..6c3efc0a37 100644
@@ -64,7 +64,7 @@ Index: b/src/Makefile
        $(RANLIB) $@
 
 +$(LUA_SO): $(CORE_O) $(LIB_O)
-+      $(CC) -o $@.$(PKG_VERSION) -shared -Wl,-soname="$@.$(PKG_VERSION)" $?
++      $(CC) -o $@.$(PKG_VERSION) -shared -Wl,-soname="$@.$(PKG_VERSION)" $? $(LIBS)
 +      ln -fs $@.$(PKG_VERSION) $@
 +
 +ifneq (dynamic,$(BUILDMODE))
package/lua/5.4.8/0002-shared-libs-for-lua.patch +1 -2
index 6115960956..d583b17193 100644
@@ -64,7 +64,7 @@ Index: b/src/Makefile
        $(RANLIB) $@
 
 +$(LUA_SO): $(CORE_O) $(LIB_O)
-+      $(CC) -o $@.$(PKG_VERSION) -shared -Wl,-soname="$@.$(PKG_VERSION)" $?
++      $(CC) -o $@.$(PKG_VERSION) -shared -Wl,-soname="$@.$(PKG_VERSION)" $? $(LIBS)
 +      ln -fs $@.$(PKG_VERSION) $@
 +
 +ifneq (dynamic,$(BUILDMODE))
--
Quoted 2 lines

2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot