简体   繁体   中英

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

    @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. 2) Build makefile (missing) with mingw32-make 3) Create the file structure. 4) Place the files in the file structure.

The line I don't understand is the 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. 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.

在此处输入图片说明

PLAT=mingw defines the platform to be used. In this case it's mingw as you're using mingw32. You'll find that in the Makefile btw.

From the GNU make documentation:

Arguments to Specify the Makefile

The way to specify the name of the makefile is with the -f or --file option (--makefile also works). For example, -f altmake says to use the file altmake as the 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.

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

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. Both can be avoided by following the tutorial step by step.

redownload the lua from here https://www.lua.org/download.html

extract using winrar directly to the directory

rename the version number to the downloaded version number

save text file as UTF-8 build.cmd

run it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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