diff mbox

[1/2] lua: fix pkg-config file

Message ID 20170731211800.5888-1-joerg.krause@embedded.rocks
State Accepted
Headers show

Commit Message

Jörg Krause July 31, 2017, 9:17 p.m. UTC
When Lua is linked with additional libraries, these libraries should go
into the pkg-config file as well.

Otherwise, linking swupdate with the lua library fails:

```
/home/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/liblua.so: undefined reference to `dlopen'
/home/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/liblua.so: undefined reference to `dlclose'
/home/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/liblua.so: undefined reference to `dlerror'
/home/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/liblua.so: undefined reference to `dlsym'
```

Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
---
 package/lua/5.2.4/0004-lua-pc.patch | 4 +++-
 package/lua/5.3.4/0004-lua-pc.patch | 4 +++-
 package/lua/lua.mk                  | 8 ++++----
 3 files changed, 10 insertions(+), 6 deletions(-)

Comments

Thomas Petazzoni Aug. 1, 2017, 5:08 p.m. UTC | #1
Hello,

On Mon, 31 Jul 2017 23:17:59 +0200, Jörg Krause wrote:
> When Lua is linked with additional libraries, these libraries should go
> into the pkg-config file as well.
> 
> Otherwise, linking swupdate with the lua library fails:
> 
> ```
> /home/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/liblua.so: undefined reference to `dlopen'
> /home/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/liblua.so: undefined reference to `dlclose'
> /home/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/liblua.so: undefined reference to `dlerror'
> /home/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/liblua.so: undefined reference to `dlsym'
> ```
> 
> Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>

Is this fixing an autobuilder issue ? I guess it should fix the ones
you mention in PATCH 2/2, but obviously only for the supported Lua
versions.

Thomas
Jörg Krause Aug. 2, 2017, 8:04 a.m. UTC | #2
Hi Thomas,

On Tue, 2017-08-01 at 19:08 +0200, Thomas Petazzoni wrote:
> Hello,
> 
> On Mon, 31 Jul 2017 23:17:59 +0200, Jörg Krause wrote:
> > When Lua is linked with additional libraries, these libraries
> > should go
> > into the pkg-config file as well.
> > 
> > Otherwise, linking swupdate with the lua library fails:
> > 
> > ```
> > /home/buildroot/output/host/arm-buildroot-linux-
> > gnueabihf/sysroot/usr/lib/liblua.so: undefined reference to
> > `dlopen'
> > /home/buildroot/output/host/arm-buildroot-linux-
> > gnueabihf/sysroot/usr/lib/liblua.so: undefined reference to
> > `dlclose'
> > /home/buildroot/output/host/arm-buildroot-linux-
> > gnueabihf/sysroot/usr/lib/liblua.so: undefined reference to
> > `dlerror'
> > /home/buildroot/output/host/arm-buildroot-linux-
> > gnueabihf/sysroot/usr/lib/liblua.so: undefined reference to `dlsym'
> > ```
> > 
> > Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
> 
> Is this fixing an autobuilder issue ? I guess it should fix the ones
> you mention in PATCH 2/2, but obviously only for the supported Lua
> versions.

It is an autobuilder issue indeed, but it was not detected the date I
wrote the patch. The autobuilder issues concerning swupdate until that
date where Lua 5.1/LuaJIT related. I noticed the issue using the Linaro
 Toolchain for armhf.

There is now a report of an autobuilder from yesterday:
http://autobuild.buildroot.net/results/1c3/1c349cc5904868e4def292b9fbfa
164828e46156/

Not all toolchains are producing the issue (only glibc ones?):

                armv5-ctng-linux-gnueabi [ 1/47]: FAILED
              armv7-ctng-linux-gnueabihf [ 2/47]: FAILED
                        br-aarch64-glibc [ 3/47]: FAILED
                           br-arcle-hs38 [ 4/47]: OK
                            br-arm-basic [ 5/47]: OK
                  br-arm-cortex-a9-glibc [ 6/47]: FAILED
                   br-arm-cortex-a9-musl [ 7/47]: OK
                             br-arm-full [ 9/47]: OK
                      br-arm-full-static [11/47]: OK
                   br-i386-pentium4-full [13/47]: OK
                br-i386-pentium-mmx-musl [14/47]: OK
                      br-m68k-68040-full [16/47]: OK
                    br-microblazeel-full [17/47]: OK
                 br-mips32r6-el-hf-glibc [18/47]: FAILED
                      br-mips64-n64-full [19/47]: OK
                 br-mips64r6-el-hf-glibc [20/47]: FAILED

Jörg
Peter Korsgaard Sept. 5, 2017, 9:52 p.m. UTC | #3
>>>>> "Jörg" == Jörg Krause <joerg.krause@embedded.rocks> writes:

 > When Lua is linked with additional libraries, these libraries should go
 > into the pkg-config file as well.

 > Otherwise, linking swupdate with the lua library fails:

 > ```
 > /home/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/liblua.so: undefined reference to `dlopen'
 > /home/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/liblua.so: undefined reference to `dlclose'
 > /home/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/liblua.so: undefined reference to `dlerror'
 > /home/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/liblua.so: undefined reference to `dlsym'
 > ```

 > Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>

Committed to 2017.02.x, thanks.
diff mbox

Patch

diff --git a/package/lua/5.2.4/0004-lua-pc.patch b/package/lua/5.2.4/0004-lua-pc.patch
index 62acb201f2..31ff61157a 100644
--- a/package/lua/5.2.4/0004-lua-pc.patch
+++ b/package/lua/5.2.4/0004-lua-pc.patch
@@ -1,6 +1,8 @@ 
 add lua.pc
 
 Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
+[Jörg Krause: add @MYLIBS@]
+Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
 
 Index: b/etc/lua.pc
 ===================================================================
@@ -34,7 +36,7 @@  Index: b/etc/lua.pc
 +Description: An Extensible Extension Language
 +Version: ${R}
 +Requires: 
-+Libs: -L${libdir} -llua -lm
++Libs: -L${libdir} -llua -lm @MYLIBS@
 +Cflags: -I${includedir}
 +
 +# (end of lua.pc)
diff --git a/package/lua/5.3.4/0004-lua-pc.patch b/package/lua/5.3.4/0004-lua-pc.patch
index 615a7db8fc..11258329d1 100644
--- a/package/lua/5.3.4/0004-lua-pc.patch
+++ b/package/lua/5.3.4/0004-lua-pc.patch
@@ -1,6 +1,8 @@ 
 add lua.pc
 
 Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
+[Jörg Krause: add @MYLIBS@]
+Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
 
 Index: b/etc/lua.pc
 ===================================================================
@@ -34,7 +36,7 @@  Index: b/etc/lua.pc
 +Description: An Extensible Extension Language
 +Version: ${R}
 +Requires:
-+Libs: -L${libdir} -llua -lm
++Libs: -L${libdir} -llua -lm @MYLIBS@
 +Cflags: -I${includedir}
 +
 +# (end of lua.pc)
diff --git a/package/lua/lua.mk b/package/lua/lua.mk
index 93339ad9ce..0692c53764 100644
--- a/package/lua/lua.mk
+++ b/package/lua/lua.mk
@@ -86,8 +86,8 @@  endef
 
 define LUA_INSTALL_STAGING_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) INSTALL_TOP="$(STAGING_DIR)/usr" -C $(@D) install
-	$(INSTALL) -m 0644 -D $(@D)/etc/lua.pc \
-		$(STAGING_DIR)/usr/lib/pkgconfig/lua.pc
+	sed -e "s/@MYLIBS@/$(LUA_MYLIBS)/g" $(@D)/etc/lua.pc \
+		> $(STAGING_DIR)/usr/lib/pkgconfig/lua.pc
 endef
 
 define LUA_INSTALL_TARGET_CMDS
@@ -96,8 +96,8 @@  endef
 
 define HOST_LUA_INSTALL_CMDS
 	$(HOST_MAKE_ENV) $(MAKE) INSTALL_TOP="$(HOST_DIR)" -C $(@D) install
-	$(INSTALL) -m 0644 -D $(@D)/etc/lua.pc \
-		$(HOST_DIR)/lib/pkgconfig/lua.pc
+	sed -e "s/@MYLIBS@/$(HOST_LUA_MYLIBS)/g" $(@D)/etc/lua.pc \
+		> $(HOST_DIR)/lib/pkgconfig/lua.pc
 endef
 
 $(eval $(generic-package))