热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

InstallingLuainMac

Luaisdistributedinsourceform.Youneedtobuilditbeforeusingit.BuildingLuashouldbestraightfo

Lua is distributed in source form. You
need to build it before using it. Building Lua should be straightforward because
Lua is implemented in pure ANSI C and compiles unmodified in all known platforms
that have an ANSI C compiler. Lua also compiles unmodified as C++. The
instructions given below for building Lua are for Unix-like platforms. See also
instructions
for other systems and customization
options.

If you don‘t have the time or the inclination to compile Lua yourself, get a
binary from LuaBinaries. Try
also Lua for Windows, an
easy-to-use distribution of Lua that includes many useful libraries.


Building Lua

In most Unix-like platforms, simply do "make" with a suitable
target. Here are the details.



  1. Open a terminal window and move to the top-level directory, which is named
    lua-5.2.3. The Makefile there controls both the build process and the
    installation process.

     


  2. Do "make" and see if your platform is listed. The platforms
    currently supported are:

     

    aix ansi bsd freebsd generic linux macosx mingw posix
    solaris

    If your platform is listed, just do "make xxx", where xxx is
    your platform name.

    If your platform is not listed, try the closest one or posix, generic,
    ansi, in this order.

     


  3. The compilation takes only a few moments and produces three files in the
    src directory: lua (the interpreter), luac (the compiler), and
    liblua.a (the library).

     


  4. To check that Lua has been built correctly, do "make test"
    after building Lua. This will run the interpreter and print its version
    string.

If you‘re running Linux and get compilation errors, make sure you have
installed the readline development package. If you get link errors
after that, then try "make linux MYLIBS=-ltermcap".


Installing Lua

Once you have built Lua, you may want to install it in an official place in
your system. In this case, do "make install". The official place and
the way to install files are defined in the Makefile. You‘ll probably need the
right permissions to install files.

To build and install Lua in one step, do "make xxx install", where
xxx is your platform name.

To install Lua locally, do "make local". This will create a
directory install with subdirectories bin, include,
lib, man, and install Lua as listed below. To install Lua
locally, but in some other directory, do "make install
INSTALL_TOP=xxx
", where xxx is your chosen directory.



bin:

lua luac

include:

lua.h luaconf.h lualib.h lauxlib.h lua.hpp

lib:

liblua.a

man/man1:

lua.1 luac.1

These are the only directories you need for development. If you only want to
run Lua programs, you only need the files in bin and man. The files in include
and lib are needed for embedding Lua in C or C++ programs.


Customization

Three kinds of things can be customized by editing a file:



  • Where and how to install Lua — edit Makefile.

  • How to build Lua — edit src/Makefile.

  • Lua features — edit src/luaconf.h.

You don‘t actually need to edit the Makefiles because you may set the
relevant variables in the command line when invoking make. Nevertheless, it‘s
probably best to edit and save the Makefiles to record the changes you need.

On the other hand, if you need to customize some Lua features, you‘ll need to
edit src/luaconf.h before building and installing Lua. The edited file
will be the one installed, and it will be used by any Lua clients that you
build, to ensure consistency. Further customization is available to experts by
editing the Lua sources.

We strongly recommend that you enable dynamic loading in
src/luaconf.h. This is done automatically for all platforms listed
above that have this feature and also for Windows.


Building Lua on other systems

If you‘re not using the usual Unix tools, then the instructions for building
Lua depend on the compiler you use. You‘ll need to create projects (or whatever
your compiler uses) for building the library, the interpreter, and the compiler,
as follows:



library:

lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c
lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c ltm.c lundump.c
lvm.c lzio.c lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c
lmathlib.c loslib.c lstrlib.c ltablib.c loadlib.c linit.c

interpreter:

library, lua.c

compiler:

library, luac.c

To use Lua as a library in your own programs you‘ll need to know how to
create and use libraries with your compiler. Moreover, to dynamically load C
libraries for Lua you‘ll need to know how to create dynamic libraries and you‘ll
need to make sure that the Lua API functions are accessible to those dynamic
libraries — but don‘t link the Lua library into each dynamic library.
For Unix, we recommend that the Lua library be linked statically into the host
program and its symbols exported for dynamic linking; src/Makefile does
this for the Lua interpreter. For Windows, we recommend that the Lua library be
a DLL.

As mentioned above, you may edit src/luaconf.h to customize some
features before building Lua.  


推荐阅读
  • 本文介绍如何在 Xcode 中使用快捷键和菜单命令对多行代码进行缩进,包括右缩进和左缩进的具体操作方法。 ... [详细]
  • 深入理解 Oracle 存储函数:计算员工年收入
    本文介绍如何使用 Oracle 存储函数查询特定员工的年收入。我们将详细解释存储函数的创建过程,并提供完整的代码示例。 ... [详细]
  • 本文总结了2018年的关键成就,包括职业变动、购车、考取驾照等重要事件,并分享了读书、工作、家庭和朋友方面的感悟。同时,展望2019年,制定了健康、软实力提升和技术学习的具体目标。 ... [详细]
  • 在计算机技术的学习道路上,51CTO学院以其专业性和专注度给我留下了深刻印象。从2012年接触计算机到2014年开始系统学习网络技术和安全领域,51CTO学院始终是我信赖的学习平台。 ... [详细]
  • CSS 布局:液态三栏混合宽度布局
    本文介绍了如何使用 CSS 实现液态的三栏布局,其中各栏具有不同的宽度设置。通过调整容器和内容区域的属性,可以实现灵活且响应式的网页设计。 ... [详细]
  • Linux 系统启动故障排除指南:MBR 和 GRUB 问题
    本文详细介绍了 Linux 系统启动过程中常见的 MBR 扇区和 GRUB 引导程序故障及其解决方案,涵盖从备份、模拟故障到恢复的具体步骤。 ... [详细]
  • 本文介绍了如何使用jQuery根据元素的类型(如复选框)和标签名(如段落)来获取DOM对象。这有助于更高效地操作网页中的特定元素。 ... [详细]
  • 在Linux系统中配置并启动ActiveMQ
    本文详细介绍了如何在Linux环境中安装和配置ActiveMQ,包括端口开放及防火墙设置。通过本文,您可以掌握完整的ActiveMQ部署流程,确保其在网络环境中正常运行。 ... [详细]
  • 本文介绍如何通过Windows批处理脚本定期检查并重启Java应用程序,确保其持续稳定运行。脚本每30分钟检查一次,并在需要时重启Java程序。同时,它会将任务结果发送到Redis。 ... [详细]
  • 本文介绍如何通过SQL查询从JDE(JD Edwards)系统中提取所有字典数据,涵盖关键表的关联和字段选择。具体包括F0004和F0005系列表的数据提取方法。 ... [详细]
  • 本文详细介绍了如何通过命令行启动MySQL服务,包括打开命令提示符窗口、进入MySQL的bin目录、输入正确的连接命令以及注意事项。文中还提供了更多相关命令的资源链接。 ... [详细]
  • QUIC协议:快速UDP互联网连接
    QUIC(Quick UDP Internet Connections)是谷歌开发的一种旨在提高网络性能和安全性的传输层协议。它基于UDP,并结合了TLS级别的安全性,提供了更高效、更可靠的互联网通信方式。 ... [详细]
  • 深入理解OAuth认证机制
    本文介绍了OAuth认证协议的核心概念及其工作原理。OAuth是一种开放标准,旨在为第三方应用提供安全的用户资源访问授权,同时确保用户的账户信息(如用户名和密码)不会暴露给第三方。 ... [详细]
  • 1:有如下一段程序:packagea.b.c;publicclassTest{privatestaticinti0;publicintgetNext(){return ... [详细]
  • 深入理解Cookie与Session会话管理
    本文详细介绍了如何通过HTTP响应和请求处理浏览器的Cookie信息,以及如何创建、设置和管理Cookie。同时探讨了会话跟踪技术中的Session机制,解释其原理及应用场景。 ... [详细]
author-avatar
je荒也是种美
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有