尝试使用 luarocks 安装时无法识别 mingw-gcc
我的路径中有 lua,而 luarocks 位于 Program Files 的同一文件夹中。我正在尝试安装 luafilesystem 并收到此错误。
PS C:\Users\Owner> luarocks install luafilesystem
Installing https://luarocks.org/luafilesystem-1.8.0-1.src.rock
luafilesystem 1.8.0-1 depends on lua >= 5.1 (5.3-1 provided by VM)
mingw32-gcc -O2 -c -o src/lfs.o -IC:\Program Files\lua/include src/lfs.c
'mingw32-gcc' is not recognized as an internal or external command,
operable program or batch file.
Error: Build error: Failed compiling object src/lfs.o
PS C:\Users\Owner>
我尝试通过 mingw 站点上的安装程序安装 mingw64,认为这可以作为修复程序,但它在安装程序中给出了“下载不正确”错误。还尝试使用 msys 安装 mingw ,似乎可以安装,但在尝试安装 luafilesystem 时仍然遇到相同的错误
I have lua in my path and luarocks is in the same folder in Program Files. I'm trying to install luafilesystem
and I am receiving this error.
PS C:\Users\Owner> luarocks install luafilesystem
Installing https://luarocks.org/luafilesystem-1.8.0-1.src.rock
luafilesystem 1.8.0-1 depends on lua >= 5.1 (5.3-1 provided by VM)
mingw32-gcc -O2 -c -o src/lfs.o -IC:\Program Files\lua/include src/lfs.c
'mingw32-gcc' is not recognized as an internal or external command,
operable program or batch file.
Error: Build error: Failed compiling object src/lfs.o
PS C:\Users\Owner>
I tried installing mingw64
through the installer on mingw site thinking that would work as a fix, but it gives a "downloaded incorrectly" error in the installer. Also tried installing mingw using msys and that seemed to install but still getting the same error trying to install luafilesystem
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果 gcc 已安装并且位于您的路径中,则在运行 luarocks 之前,我可以通过将我的 gcc.exe 编译器重命名为 mingw32-gcc.exe 来修复此错误安装命令。这有点老套,但我还没有遇到任何问题。
If gcc is installed and in your Path, I was able to fix this error by renaming my
gcc.exe
compiler tomingw32-gcc.exe
before running theluarocks install
command. It's a bit hacky but I haven't run into any issues with it.安装 mingw 确实应该可以解决问题,但并没有就此结束。我已经安装了 mingw,gcc 简称为 gcc(而不是 mingw32-gcc),因此错误仍然存在。您可以检查一下这是否也是您的问题。
我认为足够好的解决方案是切换到 MSVC 并从开发人员命令提示符运行 luarocks:luarocks 应该自动检测编译器并使用它,但如果您想使用 gcc,您应该寻找如何解决该命名问题。
Installing mingw should indeed solve the issue, but it doesn't end there. I have installed mingw, and gcc is simply called
gcc
(notmingw32-gcc
), therefore the error persists. You may check if that is your problem as well.A solution that I deemed good enough was switching to MSVC and running luarocks from the developer command prompt: luarocks should automatically detect the compiler and use it, but if you want to use gcc you should look for how to solve that naming issue.