Closed t-brown closed 8 years ago
I have created 6.2.2 on github. This version protects Lmod from user changes to LUA_PATH and LUA_CPATH. Or at least it does for me. When you get a change please test this out at your site.
This new version uses the technique that Tim suggested. It uses the values of LUA_PATH and LUA_CPATH at the time of configuration for the installation of Lmod. This means that sites will have to use LMOD_PACKAGE_PATH to let Lmod know where SitePackage.lua. is. They can't change the value of LUA_PATH after Lmod is installed to find it.
I think this broke the configure on my system. The script fails to find posix
:
checking for lua modules: posix lfs
/usr/bin/lua: error loading module 'posix' from file '/usr/lib64/lua/5.3/posix.so':
/usr/lib64/lua/5.3/posix.so: undefined symbol: luaopen_posix
stack traceback:
[C]: in ?
[C]: in function 'require'
luaModuleAvailable:3: in function 'main'
luaModuleAvailable:10: in main chunk
[C]: in ?
Running /usr/bin/lua luaModuleAvailable posix
myself works just fine. Neither LUA_PATH
or LUA_CPATH
is definied.
Confirmed: git bisect
says 12cf882210acce8ba14ed8c07ea25ca4234ec007 is the faulty commit.
Works for me:
diff --git a/configure b/configure
index c842b11..1989e6a 100755
--- a/configure
+++ b/configure
@@ -3710,7 +3710,11 @@ echo "... $LuaV"
PATH_TO_LUA=$(dirname $luaprog)
-export LUA_PATH=$ORIG_LUA_PATH
+if [ -z $ORIG_LUA_PATH ]; then
+ unset LUA_PATH
+else
+ export LUA_PATH=$ORIG_LUA_PATH
+fi
Thanks for the careful testing and the fix. I learned yet again the difference between having unset environment variable versus having LUA_PATH="". I have pushed a new version of Lmod (6.2.4).
Please test this version out for me when you get a chance.
Thanks, R.
@rtmclay Works again. Thanks!
New wrinkle (I can open a new issue if you want). For Fedora Lmod packages we can build on any arch - so LUA_PATH can reference either /usr/lib/lua/... or /usr/lib64/lua/... This then gets encoded into Lmod and so breaks it running on a different architecture. I can fix it by making Lmod an arch specific package, which may be the easiest thing to do.
I think that it will have to be an arch specific package. But I'm not completely sure that it is necessary. Why can't you set:
export LUA_PATH="/usr/lib/lua/5.1/?.lua;/usr/lib64/lua/5.1/?.lua
As long as only one directory is filled, this will work.
R.
You can have both the 64-bit and 32-bit lua libraries installed at the same time. So yeah, going arch specific seems to be the way to go here.
If a user sets their own LUA_PATH/LUA_CPATH and does not include a double semi-colon (
;;
) at the end of it lua will no longer look at it's default path. This means Lmod is unable to find dependent modules, such as posix.For example with no LUA_PATH (everything works)
If the user sets LUA_PATH to
/tmp
(for example).If the user sets LUA_PATH to
/tmp
correctly.One idea would be to modify the
luaModuleAvailable
program inconfigure.ac
to try and find the package and/or .so and then populatesrc/lmod.in.lua
as is currently done to find the lmod packages.