[luarocks] fix compiler issues on CLANG64 and CLANGARM64, and update to 3.11.1 #22975
+48
−42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Warning
It is a long PR. Two issues are reproduced, and the working fix is shown.
Description
Today, I found that the current package
mingw-w64-lua-luarocks
has two independent issues:CLANG64
andCLANGARM64
environments,luarocks
is built with a configuration to fallback togcc
as the default C compiler, which causes Lua modules written in C fail to build / install;luarocks
fails to uninstall luafilesystem properly after a previouslfs
package installation.Note
Issue 2 has already been reported upstream luarocks/luarocks#1428, and fixed at luarocks/luarocks#1616. However, it still persists here without a proper fix.
Of lesser importance, MSYS2 is running version 3.9.2, while the latest
luarocks
release is 3.11.1.Tip
I verified (cloned the branch and installed) that #20461 updates to 3.11.1, but the issues described here still persists with the solution provided there. So, I would like to invite @sewbacca and @Biswa96 to review this PR.
Table of Contents
Reproduction of Issue 1
CLANG64
shellImportant
CC
environment variable must not be setluafilesystem
is not installed for the current environment (either byluarocks
, or bymingw-w64-clang-x86_64-lua-luafilesystem
).Install
luarocks
:pacman -S ${MINGW_PACKAGE_PREFIX}-lua-luarocks
Try to install any Lua package that has components written in C. For instance, luafilesystem is enough for the test:
The resulting output should be like this:
Leave the shell opened and untouched for the reproduction of the issue 2.
Reproduction of Issue 2
Note
We are going to continue with the shell left opened from the issue 1.
The issue 1 can be remedied by setting the
CC
environment variable, becauseluarocks
will use it to build the C parts of a Lua module. So, setCC
environment variable to the correct compiler:export CC=cc
Try again to install
luafilesystem
(it should succeed):List
luarocks
and check thatluafilesystem
was installed properly:Remove
luafilesystem
throughluarocks
:Check that
luarocks
said to have removedluafilesystem
properly, but did not:lua -e "print(require 'lfs')"
Note
lfs.dll
can still be found at/clang64/lib/lua/5.4/lfs.dll
Go ahead and remove it manually:
rm ${MINGW_PREFIX}/lib/lua/5.4/lfs.dll
After the fix
Initial setup
CLANG64
shellNote
Ideally,
CC
environment variable should not be set. Remember that issue 1 can be bypassed by settingCC
.luarocks
in case it is already installed, and also make sure thatluafilesystem
is not installed for the current environment (either byluarocks
, or bymingw-w64-clang-x86_64-lua-luafilesystem
);Check that issues 1 and 2 were fixed
Install
luafilesystem
:List
luarocks
and check thatluafilesystem
was installed properly:Remove
luafilesystem
throughluarocks
:Check that
luarocks
removedluafilesystem
properly, and it cannot findlfs.dll
anymorelua -e "print(require 'lfs')"