Skip to contentSkip to conversation

lua: fix compilation with Blackfin FLAT

PATCH New Francois Perrad 3 participants 6 messages Jan 22, 2014 – Jan 23, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lua: fix compilation with Blackfin FLAT

the dlfcn interface is not available with flat memory model

see http://autobuild.buildroot.net/results/b41/b4146bf821d59f694546f6e3a341394cc8fa43ce/

---
 package/lua/lua.mk |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
package/lua/lua.mk +8 -4
index 2c867f6..b263070 100644
@@ -15,7 +15,6 @@ LUA_LICENSE = MIT
 LUA_LICENSE_FILES = COPYRIGHT
 
 LUA_CFLAGS = -Wall -fPIC
-LUA_MYLIBS += -ldl
 
 ifeq ($(BR2_PACKAGE_LUA_5_2),y)
 LUA_CFLAGS += -DLUA_COMPAT_ALL
@@ -24,17 +23,22 @@ LUA_CFLAGS += -D_FILE_OFFSET_BITS=32
 endif
 endif
 
+ifneq ($(BR2_BINFMT_FLAT),y)
+	LUA_CFLAGS += -DLUA_USE_DLOPEN
+	LUA_MYLIBS += -ldl
+endif
+
 ifeq ($(BR2_PACKAGE_LUA_INTERPRETER_READLINE),y)
 	LUA_DEPENDENCIES = readline ncurses
 	LUA_MYLIBS += -lreadline -lhistory -lncurses
-	LUA_CFLAGS += -DLUA_USE_POSIX -DLUA_USE_DLOPEN -DLUA_USE_READLINE
+	LUA_CFLAGS += -DLUA_USE_POSIX -DLUA_USE_READLINE
 else
 ifeq ($(BR2_PACKAGE_LUA_INTERPRETER_LINENOISE),y)
 	LUA_DEPENDENCIES = linenoise
 	LUA_MYLIBS += -llinenoise
-	LUA_CFLAGS += -DLUA_USE_POSIX -DLUA_USE_DLOPEN -DLUA_USE_LINENOISE
+	LUA_CFLAGS += -DLUA_USE_POSIX -DLUA_USE_LINENOISE
 else
-	LUA_CFLAGS += -DLUA_USE_POSIX -DLUA_USE_DLOPEN
+	LUA_CFLAGS += -DLUA_USE_POSIX
 endif
 endif
 
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 lua: fix compilation with Blackfin FLAT

Quoted 23 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Francois" == Francois Perrad <[email protected]> writes:

the dlfcn interface is not available with flat memory model
see http://autobuild.buildroot.net/results/b41/b4146bf821d59f694546f6e3a341394cc8fa43ce/

---
 package/lua/lua.mk |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
package/lua/lua.mk +0 -1
index 2c867f6..b263070 100644
@@ -15,7 +15,6 @@ LUA_LICENSE = MIT
 LUA_LICENSE_FILES = COPYRIGHT
 
 LUA_CFLAGS = -Wall -fPIC
-LUA_MYLIBS += -ldl
 
 ifeq ($(BR2_PACKAGE_LUA_5_2),y)
 LUA_CFLAGS += -DLUA_COMPAT_ALL

package/lua/lua.mk LUA_CFLAGS += -D_FILE_OFFSET_BITS=32 · line 29

Quoted 7 lines
package/lua/lua.mk +4 -0
@@ -24,17 +23,22 @@ LUA_CFLAGS += -D_FILE_OFFSET_BITS=32
 endif
 endif
 
+ifneq ($(BR2_BINFMT_FLAT),y)
+	LUA_CFLAGS += -DLUA_USE_DLOPEN
+	LUA_MYLIBS += -ldl
+endif

But BINFMT_FLAT imply BR2_PREFER_STATIC_LIB. I guess we should do this whenever BR2_PREFER_STATIC_LIB is enabled, right?

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH 1/1 lua: fix compilation with Blackfin FLAT

2014/1/22 Peter Korsgaard <[email protected]>:

Quoted 26 lines
Quoted 25 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Francois" == Francois Perrad <[email protected]> writes:

the dlfcn interface is not available with flat memory model
see http://autobuild.buildroot.net/results/b41/b4146bf821d59f694546f6e3a341394cc8fa43ce/

---
 package/lua/lua.mk |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
package/lua/lua.mk +0 -1
index 2c867f6..b263070 100644
@@ -15,7 +15,6 @@ LUA_LICENSE = MIT
 LUA_LICENSE_FILES = COPYRIGHT
 
 LUA_CFLAGS = -Wall -fPIC
-LUA_MYLIBS += -ldl
 
 ifeq ($(BR2_PACKAGE_LUA_5_2),y)
 LUA_CFLAGS += -DLUA_COMPAT_ALL
@@ -24,17 +23,22 @@ LUA_CFLAGS += -D_FILE_OFFSET_BITS=32
 endif
 endif
Quoted 7 lines

package/lua/lua.mk LUA_CFLAGS += -D_FILE_OFFSET_BITS=32 · line 29

Quoted 4 lines
package/lua/lua.mk +4 -0
+ifneq ($(BR2_BINFMT_FLAT),y)
+    LUA_CFLAGS += -DLUA_USE_DLOPEN
+    LUA_MYLIBS += -ldl
+endif

But BINFMT_FLAT imply BR2_PREFER_STATIC_LIB. I guess we should do this whenever BR2_PREFER_STATIC_LIB is enabled, right?

No, the condition BR2_PREFER_STATIC_LIB is too large.
The tarball Lua contains no Configure script, my patch behaves like the detection of the presence of the functions dlopen/dlclose/dlsym in a Configure script.
The purpose of BR2_PREFER_STATIC_LIB as described in its help message is very different.

Fran?ois

Quoted 7 lines

--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#3 lore raw

PATCH 1/1 lua: fix compilation with Blackfin FLAT

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fran?ois" == Fran?ois Perrad <[email protected]> writes:

Hi,

Quoted 9 lines
Quoted 2 lines

But BINFMT_FLAT imply BR2_PREFER_STATIC_LIB. I guess we should do this whenever BR2_PREFER_STATIC_LIB is enabled, right?

No, the condition BR2_PREFER_STATIC_LIB is too large.
The tarball Lua contains no Configure script, my patch behaves like the detection of the presence of the functions dlopen/dlclose/dlsym in a Configure script.
The purpose of BR2_PREFER_STATIC_LIB as described in its help message is very different.

Well, I wouldn't call it "very different". The idea is to not use shared libraries when PREFER_STATIC_LIB is enabled, so also not dlopen/dlclose/dlsym.

What you perhaps mean is that there is a difference between architectures (or variants) where we select BR2_PREFER_STATIC_LIB because they cannot support shared libraries (and hence have no dlopen/dlclose/dlsym), and other situations where the USER just desides that they don't want shared libraries, even if the architecture could support it.

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 1/1 lua: fix compilation with Blackfin FLAT

2014/1/23 Peter Korsgaard <[email protected]>:

Quoted 18 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fran?ois" == Fran?ois Perrad <[email protected]> writes:

Hi,

Quoted 9 lines
Quoted 2 lines

But BINFMT_FLAT imply BR2_PREFER_STATIC_LIB. I guess we should do this whenever BR2_PREFER_STATIC_LIB is enabled, right?

No, the condition BR2_PREFER_STATIC_LIB is too large.
The tarball Lua contains no Configure script, my patch behaves like the detection of the presence of the functions dlopen/dlclose/dlsym in a Configure script.
The purpose of BR2_PREFER_STATIC_LIB as described in its help message is very different.

Well, I wouldn't call it "very different". The idea is to not use shared libraries when PREFER_STATIC_LIB is enabled, so also not dlopen/dlclose/dlsym.

Quoted 6 lines

What you perhaps mean is that there is a difference between architectures (or variants) where we select BR2_PREFER_STATIC_LIB because they cannot support shared libraries (and hence have no dlopen/dlclose/dlsym), and other situations where the USER just desides that they don't want shared libraries, even if the architecture could support it.

Yes, BR2_PREFER_STATIC_LIB is mostly a user choice, when BR2_BINFMT_FLAT is an architecture limitation.

Fran?ois

Quoted 3 lines

--
Bye, Peter Korsgaard

#5 lore raw

PATCH 1/1 lua: fix compilation with Blackfin FLAT

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fran?ois" == Fran?ois Perrad <[email protected]> writes:

Hi,

Quoted 9 lines
Quoted 6 lines

What you perhaps mean is that there is a difference between architectures (or variants) where we select BR2_PREFER_STATIC_LIB because they cannot support shared libraries (and hence have no dlopen/dlclose/dlsym), and other situations where the USER just desides that they don't want shared libraries, even if the architecture could support it.

Yes, BR2_PREFER_STATIC_LIB is mostly a user choice, when BR2_BINFMT_FLAT is an architecture limitation.

But why should lua care? If buildroot is configured to use static libraries, then that's what it should do.

Signature · 1 line
Bye, Peter Korsgaard