如何使用MinGW和MSYS为Windows构建Lua? [英] How Do I Build Lua For Windows Using MinGW and MSYS?

查看:478
本文介绍了如何使用MinGW和MSYS为Windows构建Lua?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一本名为开始Lua编程的书,它假设要浏览原始的基础知识,但它是一种让我搁浅的书。以下是努力缩小3页:



QUOTE:

 对于Windows,建议使用以下环境变量:
UTIL_DIR = c:\program files\utility
LUA_DIR = c:\program files\lua\5.1
LUA_CPATH =? dll;%LUA_DIR%\?.dll
LUA_PATH =?。lua;%LUA_DIR%\?.lua
UTIL_DIR变量标识在上一节中创建的实用程序目录。

之后,有一个关于为lua设置'windows搜索路径'的段。基本上,它告诉我查找'doskey /?'和'path'的输出,并自己搞定。我不知道这些做什么,如何使用它们,以及它们之间的区别是什么。



我在我的智慧结束。详细说明或指向详细博客/文章或YouTube视频的链接非常感谢!

解决方案

让Lua在你的机器上工作。如果你只是想要一个功能的Lua环境匆忙,最小的麻烦,然后考虑下载一个预编译的Lua二进制文件。常见的是 Lua for Windows LuaBinaries



用Mingw建造Lua并不难:




  • 首先获取所需的Lua版本在这里。 / li>
  • 在某处提取包含Lua源的tar文件。对于这个例子,我假设你提取到 c:\lua

  • ,您可以从该环境运行make文件。从Msys shell,您可以使用以下命令构建lua:

      cd / c / lua 
    make PLAT = mingw
    make install


  • 您应该找到 lua。 exe luac.exe 在构建完成后的某处。




常规 cmd.exe shell也可以对命令进行一些修改:

  cd lua 
mingw32-make PLAT = mingw

make install nix环境等,所以不能在正常的Windows cmd shell下工作。在这种情况下,您可以手动将编译的文件从 .\lua\src 复制到所需位置,或者如果需要,可以直接从中运行。 p>

I have a book called Beginning Lua Programming which is suppose to go over the raw basics but it is sort of leaving me stranded. Here is an effort to condense 3 pages:

QUOTE:

The following environment variables are recommended for Windows:
UTIL_DIR=c:\program files\utility
LUA_DIR=c:\program files\lua\5.1
LUA_CPATH=?.dll;%LUA_DIR%\?.dll
LUA_PATH=?.lua;%LUA_DIR%\?.lua
The UTIL_DIR variable identifies the utility directory you created in the preceding section. 

After this, there is a segment about setting the 'windows search path' for lua. Basically, it tells me to look up the output of 'doskey /?' and 'path' and figure it out myself. I have no idea what these do, how to use them, and what the difference between them is.

I'm at my wits end. A detailed explanation or a link to a detailed blog/article or youtube video is EXTREMELY appreciated!

解决方案

There are a few ways to get Lua working on your machine. If you just want to a functional Lua environment in a hurry with minimal fuss then consider downloading one of the precompiled Lua binaries. The common ones being Lua for Windows and LuaBinaries.

Building Lua with Mingw isn't too difficult:

  • First get your desired Lua version here.
  • Extract the tar file containing Lua's source somewhere. For this example, I'll assume you extracted to c:\lua
  • If you have Msys already set up, you can run the make file from that environment. From the Msys shell, you can build lua with the follow commands:

    cd /c/lua
    make PLAT=mingw
    make install
    

  • You should find lua.exe and luac.exe somewhere in there after the build completes. Lua should be ready for use at this point.

The regular cmd.exe shell can work too with some changes to the commands:

    cd lua
    mingw32-make PLAT=mingw

The make install assumes a *nix environment and so doesn't work under a normal windows cmd shell. In this case you can just manually copy the compiled files from .\lua\src to where you want or you can just run it directly from there if desired.

这篇关于如何使用MinGW和MSYS为Windows构建Lua?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆