install.html 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <title>Installation</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. <meta name="Author" content="Mike Pall">
  7. <meta name="Copyright" content="Copyright (C) 2005-2009, Mike Pall">
  8. <meta name="Language" content="en">
  9. <link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
  10. <link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
  11. </head>
  12. <body>
  13. <div id="site">
  14. <a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
  15. </div>
  16. <div id="head">
  17. <h1>Installation</h1>
  18. </div>
  19. <div id="nav">
  20. <ul><li>
  21. <a href="luajit.html">LuaJIT</a>
  22. <ul><li>
  23. <a class="current" href="install.html">Installation</a>
  24. </li><li>
  25. <a href="running.html">Running</a>
  26. </li><li>
  27. <a href="api.html">API Extensions</a>
  28. </li></ul>
  29. </li><li>
  30. <a href="status.html">Status</a>
  31. <ul><li>
  32. <a href="changes.html">Changes</a>
  33. </li></ul>
  34. </li><li>
  35. <a href="faq.html">FAQ</a>
  36. </li><li>
  37. <a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
  38. </li></ul>
  39. </div>
  40. <div id="main">
  41. <p>
  42. LuaJIT is only distributed as a source package. This page explains
  43. how to build and install LuaJIT with different operating systems
  44. and C&nbsp;compilers.
  45. </p>
  46. <p>
  47. For the impatient (on POSIX systems):
  48. </p>
  49. <pre class="code">
  50. make &amp;&amp; sudo make install
  51. </pre>
  52. <p>
  53. LuaJIT currently builds out-of-the box on all popular x86 systems
  54. (Linux, Windows, OSX etc.). It builds and runs fine as a 32&nbsp;bit
  55. application under x64-based systems, too.
  56. </p>
  57. <h2>Configuring LuaJIT</h2>
  58. <p>
  59. The standard configuration should work fine for most installations.
  60. Usually there is no need to tweak the settings, except when you want to
  61. install to a non-standard path. The following three files hold all
  62. user-configurable settings:
  63. </p>
  64. <ul>
  65. <li><tt>src/luaconf.h</tt> sets some configuration variables, in
  66. particular the default paths for loading modules.</li>
  67. <li><tt>Makefile</tt> has settings for installing LuaJIT (POSIX
  68. only).</li>
  69. <li><tt>src/Makefile</tt> has settings for compiling LuaJIT under POSIX,
  70. MinGW and Cygwin.</li>
  71. <li><tt>src/msvcbuild.bat</tt> has settings for compiling LuaJIT with
  72. MSVC.</li>
  73. </ul>
  74. <p>
  75. Please read the instructions given in these files, before changing
  76. any settings.
  77. </p>
  78. <h2 id="posix">POSIX Systems (Linux, OSX, *BSD etc.)</h2>
  79. <h3>Prerequisites</h3>
  80. <p>
  81. Depending on your distribution, you may need to install a package for
  82. GCC (GCC 3.4 or later required), the development headers and/or a
  83. complete SDK.
  84. </p>
  85. <p>
  86. E.g. on a current Debian/Ubuntu, install <tt>libc6-dev</tt>
  87. with the package manager. Currently LuaJIT only builds as a 32&nbsp;bit
  88. application, so you actually need to install <tt>libc6-dev-i386</tt>
  89. when building on an x64 OS.
  90. </p>
  91. <p>
  92. Download the current source package (pick the .tar.gz), if you haven't
  93. already done so. Move it to a directory of your choice, open a
  94. terminal window and change to this directory. Now unpack the archive
  95. and change to the newly created directory:
  96. </p>
  97. <pre class="code">
  98. tar zxf LuaJIT-2.0.0-beta1.tar.gz
  99. cd LuaJIT-2.0.0-beta1
  100. </pre>
  101. <h3>Building LuaJIT</h3>
  102. <p>
  103. The supplied Makefiles try to auto-detect the settings needed for your
  104. operating system and your compiler. They need to be run with GNU Make,
  105. which is probably the default on your system, anyway. Simply run:
  106. </p>
  107. <pre class="code">
  108. make
  109. </pre>
  110. <h3>Installing LuaJIT</h3>
  111. <p>
  112. The top-level Makefile installs LuaJIT by default under
  113. <tt>/usr/local</tt>, i.e. the executable ends up in
  114. <tt>/usr/local/bin</tt> and so on. You need to have root privileges
  115. to write to this path. So, assuming sudo is installed on your system,
  116. run the following command and enter your sudo password:
  117. </p>
  118. <pre class="code">
  119. sudo make install
  120. </pre>
  121. <p>
  122. Otherwise specify the directory prefix as an absolute path, e.g.:
  123. </p>
  124. <pre class="code">
  125. sudo make install PREFIX=/opt/lj2
  126. </pre>
  127. <p>
  128. But note that the installation prefix and the prefix for the module paths
  129. (configured in <tt>src/luaconf.h</tt>) must match.
  130. </p>
  131. <p style="color: #c00000;">
  132. Note: to avoid overwriting a previous version, the beta test releases
  133. only install the LuaJIT executable under the versioned name (i.e.
  134. <tt>luajit-2.0.0-beta1</tt>). You probably want to create a symlink
  135. for convenience, with a command like this:
  136. </p>
  137. <pre class="code" style="color: #c00000;">
  138. sudo ln -sf luajit-2.0.0-beta1 /usr/local/bin/luajit
  139. </pre>
  140. <h2 id="windows">Windows Systems</h2>
  141. <h3>Prerequisites</h3>
  142. <p>
  143. Either install one of the open source SDKs
  144. (<a href="http://mingw.org/"><span class="ext">&raquo;</span>&nbsp;MinGW</a> or
  145. <a href="http://www.cygwin.com/"><span class="ext">&raquo;</span>&nbsp;Cygwin</a>) which come with modified
  146. versions of GCC plus the required development headers.
  147. </p>
  148. <p>
  149. Or install Microsoft's Visual C++ (MSVC) &mdash; the freely downloadable
  150. <a href="http://www.microsoft.com/Express/VC/"><span class="ext">&raquo;</span>&nbsp;Express Edition</a>
  151. works just fine.
  152. </p>
  153. <p>
  154. Next, download the source package and unpack it using an archive manager
  155. (e.g. the Windows Explorer) to a directory of your choice.
  156. </p>
  157. <h3>Building with MSVC</h3>
  158. <p>
  159. Open a "Visual Studio .NET Command Prompt" and <tt>cd</tt> to the
  160. directory where you've unpacked the sources. Then run this command:
  161. </p>
  162. <pre class="code">
  163. cd src
  164. msvcbuild
  165. </pre>
  166. <p>
  167. Then follow the installation instructions below.
  168. </p>
  169. <h3>Building with MinGW or Cygwin</h3>
  170. <p>
  171. Open a command prompt window and make sure the MinGW or Cygwin programs
  172. are in your path. Then <tt>cd</tt> to the directory where
  173. you've unpacked the sources and run this command for MinGW:
  174. </p>
  175. <pre class="code">
  176. cd src
  177. mingw32-make
  178. </pre>
  179. <p>
  180. Or this command for Cygwin:
  181. </p>
  182. <pre class="code">
  183. cd src
  184. make
  185. </pre>
  186. <p>
  187. Then follow the installation instructions below.
  188. </p>
  189. <h3>Installing LuaJIT</h3>
  190. <p>
  191. Copy <tt>luajit.exe</tt> and <tt>lua51.dll</tt>
  192. to a newly created directory (any location is ok). Add <tt>lua</tt>
  193. and <tt>lua\jit</tt> directories below it and copy all Lua files
  194. from the <tt>lib</tt> directory of the distribution to the latter directory.
  195. </p>
  196. <p>
  197. There are no hardcoded
  198. absolute path names &mdash; all modules are loaded relative to the
  199. directory where <tt>luajit.exe</tt> is installed
  200. (see <tt>src/luaconf.h</tt>).
  201. </p>
  202. <br class="flush">
  203. </div>
  204. <div id="foot">
  205. <hr class="hide">
  206. Copyright &copy; 2005-2009 Mike Pall
  207. <span class="noprint">
  208. &middot;
  209. <a href="contact.html">Contact</a>
  210. </span>
  211. </div>
  212. </body>
  213. </html>