简体   繁体   English

Lua Build Lua在Windows build.cmd中

[英]Lua Build Lua In Windows build.cmd

I tried to install as suggested in this question ( Get Lua running with Torch on Windows 10 (with limited admin rights) ) with the build.cmd file. 我尝试按照build.cmd文件中的问题( 在Windows 10上使用Torch在Lua上运行(具有受限管理员权限) )建议安装。 This was the result: 结果是:

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 . . .

It fails on this line: 在此行失败:

mingw32-make PLAT=mingw

What does this line do? 这条线是做什么的? I gather that it "makes" it, but from the tutorial there is no makefile at this point. 我收集到它是“ makes”的,但是在本教程中,目前没有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

The build.cmd appears to: 1) Make some directory variables. build.cmd似乎可以:1)创建一些目录变量。 2) Build makefile (missing) with mingw32-make 3) Create the file structure. 2)使用mingw32-make生成makefile(缺少)3)创建文件结构。 4) Place the files in the file structure. 4)将文件放在文件结构中。

The line I don't understand is the mingw32-make. 我不明白的那行是mingw32-make。

Given that you have followed the tutorial correctly and that you have the Lua source files where they are supposed to be you don't have to specify a file name. 鉴于您已经正确地遵循了本教程,并且您拥有了Lua源文件,因此不必指定文件名。 mingw32-make will use the file Makefile which is in the source folder which you chose as your starting directory with cd /D %lua_build_dir% in the preceding line. mingw32-make将使用文件Makefile,该文件位于您选择作为开始目录的源文件夹中,并在前一行带有cd /D %lua_build_dir%

在此处输入图片说明

PLAT=mingw defines the platform to be used. PLAT = mingw定义要使用的平台。 In this case it's mingw as you're using mingw32. 在这种情况下,使用mingw32时就是mingw。 You'll find that in the Makefile btw. 您会在Makefile btw中找到它。

From the GNU make documentation: 从GNU make文档:

Arguments to Specify the Makefile 指定Makefile的参数

The way to specify the name of the makefile is with the -f or --file option (--makefile also works). 指定makefile名称的方法是使用-f或--file选项(--makefile也可以使用)。 For example, -f altmake says to use the file altmake as the makefile. 例如,-f altmake表示将文件altmake用作makefile。

If you use the -f flag several times and follow each -f with an argument, all the specified files are used jointly as makefiles. 如果您多次使用-f标志,并在每个-f之后加上一个参数,则所有指定的文件将一起用作makefile。

If you do not use the -f or --file flag, the default is to try GNUmakefile, makefile, and Makefile, in that order, and use the first of these three which exists or can be made 如果不使用-f或--file标志, 则默认设置是 按该顺序 尝试 GNUmakefile,makefile和Makefile,并使用 这三个存在的或可以创建的第一个

If I had to take an educated guess I would say that you either made a mistake setting up your working director or you ran the build.cmd from the wrong directory. 如果我必须进行有根据的猜测,我会说您是在设置工作主管时出错,或者是从错误的目录运行了build.cmd。 Both can be avoided by following the tutorial step by step. 逐步遵循本教程可以避免这两种情况。

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

extract using winrar directly to the directory 使用winrar直接解压到目录

rename the version number to the downloaded version number 将版本号重命名为下载的版本号

save text file as UTF-8 build.cmd 将文本文件另存为UTF-8 build.cmd

run it. 运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM