Closed zxj12530 closed 6 years ago
The default-compiled natives should not allow loading external libraries from the Lua side, as that would be a security concern in the context we're using JNLua in. You may have to add additional compile flags.
Can you give some advice for the “additional compile flags”?
Are you saying that the additional compile flags are Lua_Type, or what?
We commonly use macosx and linux
We must to use the dynamic library
We use lua5.1 is normal, why 5.3 will have security concern?
@zxj12530 We are developing JNLua with a video game in mind, loading user-provided code on servers. Loading dynamic libraries would be a huge security liability.
Try replacing the LUA_TYPE in the script with "macosx" on Mac and "linux" on Linux instances.
We'll take care of this after other, more pressing parts of the project are done: see https://github.com/MovingBlocks/JNLua/issues/6
Thank you, I have modified LUA_TYPE to macosx and linux, but still report the error.
Try passing -DLUA_USE_DLOPEN directly, then. Maybe that will do.
change Makefile.mac like this ?
CFLAGS?=-O2 -DLUA_USE_MACOSX -DLUA_USE_DLOPEN
Yes. This might help.
Ok, I will try it later, then give you feedback.
I followed the instructions you said, I did the following:
(1) Modify Makefile.mac CFLAGS?=-O2 -DLUA_USE_MACOSX -DLUA_USE_DLOPEN
(2) modify build-natives-eris_mac.sh LUA_TYPE="posix" is changed to LUA_TYPE="macosx"
(3) Generate libjnlua-5.3-mac-amd64.dylib and put it under /Library/Java/Extensions (4)./gradlew build generates JNLua-0.1.0-SNAPSHOT.jar (5) My project uses the Lua5.3 version, and the cjson library compiled with 5.3
When I execute the call, I still get an error.
Exception in thread "main" org.terasology.jnlua.LuaRuntimeException: error loading module 'cjson' from file '/usr/local/lib/lua/5.3/cjson.so':
Dynamic libraries not enabled; check your Lua installation
You forgot to modify the CFLAGS in the shell script itself. Makefile.mac controls the building logic of the Java glue and does not control Lua itself.
Modfiy MY_LUA_CFLAGS in the shell script. Sorry if this is unclear right now, development of the fork of JNLua has been focused on other things (such as improving the quality of the native library itself) and not everything is well-documented yet.
Hello, there is still a problem, I see "This branch of Eris currently comes with Lua 5.3.0"
We tested with lua5.3.5
Will this version of the difference affect?
i will try to Modfiy MY_LUA_CFLAGS in the shell script
Will this version of the difference affect?
The branch actually comes with Lua 5.3.5. A bit of text has not been updated, I suppose.
ok,thank you!
i test on macosx but got this error