【问题标题】:Lua Build Lua In Windows build.cmdLua 构建 Lua 在 Windows build.cmd
【发布时间】:2018-08-18 03:30:34
【问题描述】:

我尝试按照这个问题 (Get Lua running with Torch on Windows 10 (with limited admin rights)) 中的建议使用 build.cmd 文件进行安装。结果是这样的:

mingw32-make: *** No targets specified and no makefile found. Stop.

**** COMPILATION TERMINATED ****

**** BUILDING BINARY DISTRIBUTION ****

The system cannot find the path specified. The system cannot find the path specified. The system cannot find the path specified. The system cannot find the path specified. The system cannot find the path specified. The system cannot find the path specified. The system cannot find the path specified. The system cannot find the path specified.

**** BINARY DISTRIBUTION BUILT ****

'C:\gcc-lua-install\lua\bin\lua.exe' is not recognized as an internal or external command, operable program or batch file.

Press any key to continue . . .

在这一行失败:

mingw32-make PLAT=mingw

这条线有什么作用?我认为它“制作”了它,但从教程中看,此时没有 makefile。

    @echo off
    :: ========================
    :: file build.cmd
    :: ========================
    setlocal
    :: you may change the following variable's value
    :: to suit the downloaded version
    set lua_version=5.3.4

    set work_dir=%~dp0
    :: Removes trailing backslash
    :: to enhance readability in the following steps
    set work_dir=%work_dir:~0,-1%

    set lua_install_dir=%work_dir%\lua
    set compiler_bin_dir=%work_dir%\tdm-gcc\bin
    set lua_build_dir=%work_dir%\lua-%lua_version%
    set path=%compiler_bin_dir%;%path%

    cd /D %lua_build_dir%
    mingw32-make PLAT=mingw

    echo.
    echo **** COMPILATION TERMINATED ****
    echo.
    echo **** BUILDING BINARY DISTRIBUTION ****
    echo.

    :: create a clean "binary" installation
    mkdir %lua_install_dir%
    mkdir %lua_install_dir%\doc
    mkdir %lua_install_dir%\bin
    mkdir %lua_install_dir%\include

    copy %lua_build_dir%\doc\*.* %lua_install_dir%\doc\*.*
    copy %lua_build_dir%\src\*.exe %lua_install_dir%\bin\*.*
    copy %lua_build_dir%\src\*.dll %lua_install_dir%\bin\*.*
    copy %lua_build_dir%\src\luaconf.h %lua_install_dir%\include\*.*
    copy %lua_build_dir%\src\lua.h %lua_install_dir%\include\*.*
    copy %lua_build_dir%\src\lualib.h %lua_install_dir%\include\*.*
    copy %lua_build_dir%\src\lauxlib.h %lua_install_dir%\include\*.*
    copy %lua_build_dir%\src\lua.hpp %lua_install_dir%\include\*.*

    echo.
    echo **** BINARY DISTRIBUTION BUILT ****
    echo.

    %lua_install_dir%\bin\lua.exe -e"print [[Hello!]];print[[Simple Lua test successful!!!]]"

    echo.

    pause

build.cmd 显示为: 1)制作一些目录变量。 2) 使用 mingw32-make 构建 makefile(缺失) 3) 创建文件结构。 4) 将文件放入文件结构中。

我不明白的是mingw32-make。

【问题讨论】:

  • 在运行 .cmd 文件之前,您是否将所有文件都放在如下目录中? C:\gcc-lua-install\tdm-gcc-4.9.2.exe, C:\gcc-lua-install\lua-5.3.0.tar.gz, C:\gcc-lua-install\7-ZipPortable_9 .20_Rev_3.paf.exe, C:\gcc-lua-install\tdm-gcc, C:\gcc-lua-install\7zip, C:\gcc-lua-install\lua-5.3.0, C:\gcc -lua-install\build.cmd
  • 是的,我做到了。
  • 也许你应该一步一步再试一次(lua-users.org/wiki/BuildingLuaInWindowsForNewbies

标签: windows lua


【解决方案1】:

鉴于您正确地遵循了本教程,并且您拥有应该存在的 Lua 源文件,您不必指定文件名。 mingw32-make 将使用源文件夹中的 Makefile 文件,该文件位于您选择作为起始目录的源文件夹中,在前一行中带有 cd /D %lua_build_dir%

PLAT=mingw 定义要使用的平台。在这种情况下,它是 mingw,因为您使用的是 mingw32。顺便说一句,您会在 Makefile 中找到它。

来自 GNU make 文档:

指定 Makefile 的参数

指定makefile名称的方法是使用-f或 --file 选项(--makefile 也有效)。例如,-f altmake 说使用文件 altmake 作为 makefile。

如果您多次使用 -f 标志并在每个 -f 后面加上一个 参数,所有指定的文件共同用作makefile。

如果不使用 -f 或 --file 标志, 默认是尝试 GNUmakefile、makefile 和 Makefile,按此顺序,并使用 这三个中的第一个存在或可以制造

如果我必须进行有根据的猜测,我会说您要么在设置工作主管时出错,要么从错误的目录运行 build.cmd。按照教程一步一步来,这两种情况都可以避免。

【讨论】:

    【解决方案2】:

    从这里重新下载 lua https://www.lua.org/download.html

    直接用winrar解压到目录

    将版本号重命名为下载的版本号

    将文本文件另存为 UTF-8 build.cmd

    运行它。

    【讨论】:

      猜你喜欢
      • 2013-10-04
      • 2014-11-27
      • 1970-01-01
      • 2020-04-29
      • 1970-01-01
      • 2021-12-31
      • 2015-03-06
      • 2013-05-14
      • 2012-08-06
      相关资源
      最近更新 更多