mikepaul-LuaJIT/doc/install.html

276 lines
8.1 KiB
HTML
Raw Normal View History

2009-12-08 18:46:35 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Installation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Pall">
2010-01-09 13:28:11 +00:00
<meta name="Copyright" content="Copyright (C) 2005-2010, Mike Pall">
2009-12-08 18:46:35 +00:00
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
</head>
<body>
<div id="site">
<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
</div>
<div id="head">
<h1>Installation</h1>
</div>
<div id="nav">
<ul><li>
<a href="luajit.html">LuaJIT</a>
<ul><li>
<a class="current" href="install.html">Installation</a>
</li><li>
<a href="running.html">Running</a>
</li><li>
<a href="api.html">API Extensions</a>
</li></ul>
</li><li>
<a href="status.html">Status</a>
<ul><li>
<a href="changes.html">Changes</a>
</li></ul>
</li><li>
<a href="faq.html">FAQ</a>
</li><li>
<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
</li></ul>
</div>
<div id="main">
<p>
LuaJIT is only distributed as a source package. This page explains
how to build and install LuaJIT with different operating systems
and C&nbsp;compilers.
</p>
<p>
For the impatient (on POSIX systems):
</p>
<pre class="code">
make &amp;&amp; sudo make install
</pre>
<p>
LuaJIT currently builds out-of-the box on all popular x86 systems
(Linux, Windows, OSX etc.). It builds and runs fine as a 32&nbsp;bit
application under x64-based systems, too.
</p>
<p class="indent" style="color: #00a000;">
The x64 port of LuaJIT is still experimental and not enabled by default.
It only contains the interpreter and only builds on Linux/x64 and WIN64
right now. If you want to give it a try, follow the special build instructions
below.
</p>
<p class="indent" style="color: #00a000;">
Note that the pure interpreter is quite a bit faster than Lua, but of
course not as fast as the x86 JIT compiler. Work on the x64 JIT compiler
is still ongoing.
</p>
2009-12-08 18:46:35 +00:00
<h2>Configuring LuaJIT</h2>
<p>
The standard configuration should work fine for most installations.
2009-12-08 18:49:20 +00:00
Usually there is no need to tweak the settings. The following files
hold all user-configurable settings:
2009-12-08 18:46:35 +00:00
</p>
<ul>
2009-12-08 18:49:20 +00:00
<li><tt>src/luaconf.h</tt> sets some configuration variables.</li>
<li><tt>Makefile</tt> has settings for <b>installing</b> LuaJIT (POSIX
2009-12-08 18:46:35 +00:00
only).</li>
2009-12-08 18:49:20 +00:00
<li><tt>src/Makefile</tt> has settings for <b>compiling</b> LuaJIT
under POSIX, MinGW and Cygwin.</li>
2009-12-08 18:46:35 +00:00
<li><tt>src/msvcbuild.bat</tt> has settings for compiling LuaJIT with
MSVC.</li>
</ul>
<p>
Please read the instructions given in these files, before changing
any settings.
</p>
<h2 id="posix">POSIX Systems (Linux, OSX, *BSD etc.)</h2>
<h3>Prerequisites</h3>
<p>
Depending on your distribution, you may need to install a package for
GCC (GCC 3.4 or later required), the development headers and/or a
complete SDK.
</p>
<p>
E.g. on a current Debian/Ubuntu, install <tt>libc6-dev</tt>
with the package manager. Currently LuaJIT builds as a 32&nbsp;bit
application by default, so you actually need to install <tt>libc6-dev-i386</tt>
2009-12-08 18:46:35 +00:00
when building on an x64 OS.
</p>
<p>
Download the current source package (pick the .tar.gz), if you haven't
already done so. Move it to a directory of your choice, open a
terminal window and change to this directory. Now unpack the archive
and change to the newly created directory:
</p>
<pre class="code">
2009-12-08 18:49:20 +00:00
tar zxf LuaJIT-2.0.0-beta2.tar.gz
cd LuaJIT-2.0.0-beta2</pre>
2009-12-08 18:46:35 +00:00
<h3>Building LuaJIT</h3>
<p>
The supplied Makefiles try to auto-detect the settings needed for your
operating system and your compiler. They need to be run with GNU Make,
which is probably the default on your system, anyway. Simply run:
</p>
<pre class="code">
make
</pre>
<div style="color: #00a000;">
<p>
You can force a build of the x64 interpreter on Linux/x64 with the
following command:
</p>
<pre class="code">
make CC="gcc -m64"
</pre>
</div>
2009-12-08 18:49:20 +00:00
<p>
By default modules are only searched under the prefix <tt>/usr/local</tt>.
You can add an extra prefix to the search paths by appending the
<tt>PREFIX</tt> option, e.g.:
</p>
<pre class="code">
make PREFIX=/home/myself/lj2
</pre>
<p>
Note for OSX: <tt>MACOSX_DEPLOYMENT_TARGET</tt> is set to <tt>10.4</tt>
in <tt>src/Makefile</tt>. Change it, if you want to build on an older version.
</p>
2009-12-08 18:46:35 +00:00
<h3>Installing LuaJIT</h3>
<p>
The top-level Makefile installs LuaJIT by default under
<tt>/usr/local</tt>, i.e. the executable ends up in
<tt>/usr/local/bin</tt> and so on. You need root privileges
2009-12-08 18:46:35 +00:00
to write to this path. So, assuming sudo is installed on your system,
run the following command and enter your sudo password:
</p>
<pre class="code">
sudo make install
</pre>
<p>
Otherwise specify the directory prefix as an absolute path, e.g.:
</p>
<pre class="code">
2009-12-08 18:49:20 +00:00
make install PREFIX=/home/myself/lj2
2009-12-08 18:46:35 +00:00
</pre>
<p>
2009-12-08 18:49:20 +00:00
Obviously the prefixes given during build and installation need to be the same.
2009-12-08 18:46:35 +00:00
</p>
<p style="color: #c00000;">
Note: to avoid overwriting a previous version, the beta test releases
only install the LuaJIT executable under the versioned name (i.e.
2009-12-08 18:49:20 +00:00
<tt>luajit-2.0.0-beta2</tt>). You probably want to create a symlink
2009-12-08 18:46:35 +00:00
for convenience, with a command like this:
</p>
<pre class="code" style="color: #c00000;">
2009-12-08 18:49:20 +00:00
sudo ln -sf luajit-2.0.0-beta2&nbsp;/usr/local/bin/luajit
2009-12-08 18:46:35 +00:00
</pre>
<h2 id="windows">Windows Systems</h2>
<h3>Prerequisites</h3>
<p>
Either install one of the open source SDKs
(<a href="http://mingw.org/"><span class="ext">&raquo;</span>&nbsp;MinGW</a> or
2009-12-08 18:49:20 +00:00
<a href="http://www.cygwin.com/"><span class="ext">&raquo;</span>&nbsp;Cygwin</a>), which come with a modified
GCC plus the required development headers.
2009-12-08 18:46:35 +00:00
</p>
<p>
Or install Microsoft's Visual C++ (MSVC). The freely downloadable
2009-12-08 18:46:35 +00:00
<a href="http://www.microsoft.com/Express/VC/"><span class="ext">&raquo;</span>&nbsp;Express Edition</a>
works just fine, but only contains an x86 compiler.
</p>
<p>
The freely downloadable
<a href="http://msdn.microsoft.com/en-us/windowsserver/bb980924.aspx"><span class="ext">&raquo;</span>&nbsp;Windows SDK</a>
only comes with command line tools, but this is all you need to build LuaJIT.
It contains x86 and x64 compilers.
2009-12-08 18:46:35 +00:00
</p>
<p>
Next, download the source package and unpack it using an archive manager
(e.g. the Windows Explorer) to a directory of your choice.
</p>
<h3>Building with MSVC</h3>
<p>
2009-12-08 18:49:20 +00:00
Open a "Visual Studio .NET Command Prompt", <tt>cd</tt> to the
directory where you've unpacked the sources and run these commands:
2009-12-08 18:46:35 +00:00
</p>
<pre class="code">
cd src
msvcbuild
</pre>
<p>
Then follow the installation instructions below.
</p>
<h3>Building with the Windows SDK</h3>
<p>
Open a "Windows SDK Command Shell" and select the x86 compiler:
</p>
<pre class="code">
setenv /release /x86
</pre>
<div style="color: #00a000;">
<p>
Or select the x64 compiler (this only builds the interpreter right now):
</p>
<pre class="code">
setenv /release /x64
</pre>
</div>
<p>
Then <tt>cd</tt> to the directory where you've unpacked the sources
and run these commands:
</p>
<pre class="code">
cd src
msvcbuild
</pre>
<p>
Then follow the installation instructions below.
</p>
2009-12-08 18:46:35 +00:00
<h3>Building with MinGW or Cygwin</h3>
<p>
Open a command prompt window and make sure the MinGW or Cygwin programs
are in your path. Then <tt>cd</tt> to the directory where
you've unpacked the sources and run this command for MinGW:
</p>
<pre class="code">
mingw32-make
</pre>
<p>
Or this command for Cygwin:
</p>
<pre class="code">
make
</pre>
<p>
Then follow the installation instructions below.
</p>
<h3>Installing LuaJIT</h3>
<p>
2009-12-08 18:49:20 +00:00
Copy <tt>luajit.exe</tt> and <tt>lua51.dll</tt> (built in the <tt>src</tt>
directory) to a newly created directory (any location is ok).
Add <tt>lua</tt> and <tt>lua\jit</tt> directories below it and copy
all Lua files from the <tt>lib</tt> directory of the distribution
to the latter directory.
2009-12-08 18:46:35 +00:00
</p>
<p>
There are no hardcoded
absolute path names &mdash; all modules are loaded relative to the
directory where <tt>luajit.exe</tt> is installed
(see <tt>src/luaconf.h</tt>).
</p>
<br class="flush">
</div>
<div id="foot">
<hr class="hide">
2010-01-09 13:28:11 +00:00
Copyright &copy; 2005-2010 Mike Pall
2009-12-08 18:46:35 +00:00
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>
</span>
</div>
</body>
</html>