Skip to content

Fix luajit rolling release build in msys shell#54

Merged
un-def merged 1 commit intoluarocks:masterfrom
tobil4sk:fix/windows-msys-shell
Feb 28, 2026
Merged

Fix luajit rolling release build in msys shell#54
un-def merged 1 commit intoluarocks:masterfrom
tobil4sk:fix/windows-msys-shell

Conversation

@tobil4sk
Copy link

The SHELL=cmd argument is needed when running hererocks from cmd or powershell, because in that case luajit will use dos commands.

However, if MSYSTEM or TERM are defined (e.g. in a msys shell) then luajit will build using bash commands and the build will fail with the error below.

To fix this, this patch respects the same variables that luajit uses to decide whether to use dos or unix commands. SHELL=cmd is no longer set in a unix environment, but still is in a dos environment.

See luajit src/Makefile:
https://github.com/LuaJIT/LuaJIT/blob/26fd1a7d6770b2237240a071e6f01132877a2425/src/Makefile#L157

Current build error:

Building LuaJIT @26fd1a7 (target: mingw)
"==== Building LuaJIT 2.1 ===="
mingw32-make -C src
mingw32-make[1]: Entering directory 'C:/Users/RUNNER~1/AppData/Local/Temp/tmpadzy1my3/LuaJIT/src'
"HOSTCC    host/minilua.o"
"HOSTLINK  host/minilua.exe"
"VERSION   luajit.h"
Error: host/genversion.lua:14: run from the wrong directory
mingw32-make[1]: *** [Makefile:673: luajit.h] Error 1
mingw32-make[1]: Leaving directory 'C:/Users/RUNNER~1/AppData/Local/Temp/tmpadzy1my3/LuaJIT/src'
mingw32-make: *** [Makefile:127: default] Error 2
Error: got exitcode 2 from command mingw32-make SHELL=cmd

Closes #53.

Related to #26.

cc: @un-def

The SHELL=cmd argument is needed when running hererocks from cmd or
powershell, because in that case luajit will use dos commands.

However, if MSYSTEM or TERM are defined (e.g. in a msys shell) then
luajit will build using bash commands and the build will fail with the
error below.

To fix this, this patch respects the same variables that luajit uses to
decide whether to use dos or unix commands. SHELL=cmd is no longer set
in a unix environment, but still is in a dos environment.

See luajit src/Makefile:
https://github.com/LuaJIT/LuaJIT/blob/26fd1a7d6770b2237240a071e6f01132877a2425/src/Makefile#L157

Current build error:
```
Building LuaJIT @26fd1a7 (target: mingw)
"==== Building LuaJIT 2.1 ===="
mingw32-make -C src
mingw32-make[1]: Entering directory 'C:/Users/RUNNER~1/AppData/Local/Temp/tmpadzy1my3/LuaJIT/src'
"HOSTCC    host/minilua.o"
"HOSTLINK  host/minilua.exe"
"VERSION   luajit.h"
Error: host/genversion.lua:14: run from the wrong directory
mingw32-make[1]: *** [Makefile:673: luajit.h] Error 1
mingw32-make[1]: Leaving directory 'C:/Users/RUNNER~1/AppData/Local/Temp/tmpadzy1my3/LuaJIT/src'
mingw32-make: *** [Makefile:127: default] Error 2
Error: got exitcode 2 from command mingw32-make SHELL=cmd
```
@un-def un-def merged commit 3db3726 into luarocks:master Feb 28, 2026
16 checks passed
@un-def
Copy link
Collaborator

un-def commented Feb 28, 2026

Thanks!

@tobil4sk tobil4sk deleted the fix/windows-msys-shell branch February 28, 2026 12:28
@tobil4sk tobil4sk restored the fix/windows-msys-shell branch February 28, 2026 12:28
@tobil4sk
Copy link
Author

Thank you!

@tobil4sk tobil4sk deleted the fix/windows-msys-shell branch March 3, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failing to build luajit rolling release on windows

2 participants