-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix C module loading on windows #38
base: master
Are you sure you want to change the base?
Conversation
@leafo I've tested this in the CI runs for luasystem at lunarmodules/luasystem#17 and I confirm this works! Without this patch, the resulting binary can only run pure Lua code (which meant LuaRocks ran fine, but then the C-based packages built by it wouldn't load in the interpreter). |
await install_files(pathJoin(luaInstallPath, "bin"), luaExtractPath, [ "lua.exe", "luac.exe", dllFile ]) | ||
await install_files(pathJoin(luaInstallPath, "lib"), luaExtractPath, [ dllFile, libFile ]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the dll should be installed in only one place, not in both lib
and bin
:
await install_files(pathJoin(luaInstallPath, "bin"), luaExtractPath, [ "lua.exe", "luac.exe", dllFile ]) | |
await install_files(pathJoin(luaInstallPath, "lib"), luaExtractPath, [ dllFile, libFile ]) | |
await install_files(pathJoin(luaInstallPath, "bin"), luaExtractPath, [ "lua.exe", "luac.exe", dllFile ]) | |
await install_files(pathJoin(luaInstallPath, "lib"), luaExtractPath, [ libFile ]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copying the file in both places won't hurt (it's a small file in a temporary CI environment), and I can't tell for certain that not copying the file to lib
won't break someone else's flows which are relying on that file being there. What I do know is that this PR as is fixes the C module loading behavior.
@leafo Can we merge this as-is? Let's not get this held back on whether it produces a redundant file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late reply, must have overseen this. @hishamhm Agreed, I believe to remember seeing some linking problems with some rocks when the file was not present in lib, I think it was related to stub-libs on Windows / MSVC.
This PR addresses #39 and introduces 2 changes to the windows plain lua build:
luaxx.dll
next tolua.exe
(bin/
) where it can be picked up at runtime by native libraries linked against itlua.exe
againstluaxx.dll
to avoid "multiple lua VMs" errors