install.html 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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. The following files
  61. hold all user-configurable settings:
  62. </p>
  63. <ul>
  64. <li><tt>src/luaconf.h</tt> sets some configuration variables.</li>
  65. <li><tt>Makefile</tt> has settings for <b>installing</b> LuaJIT (POSIX
  66. only).</li>
  67. <li><tt>src/Makefile</tt> has settings for <b>compiling</b> LuaJIT
  68. under POSIX, MinGW and Cygwin.</li>
  69. <li><tt>src/msvcbuild.bat</tt> has settings for compiling LuaJIT with
  70. MSVC.</li>
  71. </ul>
  72. <p>
  73. Please read the instructions given in these files, before changing
  74. any settings.
  75. </p>
  76. <h2 id="posix">POSIX Systems (Linux, OSX, *BSD etc.)</h2>
  77. <h3>Prerequisites</h3>
  78. <p>
  79. Depending on your distribution, you may need to install a package for
  80. GCC (GCC 3.4 or later required), the development headers and/or a
  81. complete SDK.
  82. </p>
  83. <p>
  84. E.g. on a current Debian/Ubuntu, install <tt>libc6-dev</tt>
  85. with the package manager. Currently LuaJIT only builds as a 32&nbsp;bit
  86. application, so you actually need to install <tt>libc6-dev-i386</tt>
  87. when building on an x64 OS.
  88. </p>
  89. <p>
  90. Download the current source package (pick the .tar.gz), if you haven't
  91. already done so. Move it to a directory of your choice, open a
  92. terminal window and change to this directory. Now unpack the archive
  93. and change to the newly created directory:
  94. </p>
  95. <pre class="code">
  96. tar zxf LuaJIT-2.0.0-beta2.tar.gz
  97. cd LuaJIT-2.0.0-beta2</pre>
  98. <h3>Building LuaJIT</h3>
  99. <p>
  100. The supplied Makefiles try to auto-detect the settings needed for your
  101. operating system and your compiler. They need to be run with GNU Make,
  102. which is probably the default on your system, anyway. Simply run:
  103. </p>
  104. <pre class="code">
  105. make
  106. </pre>
  107. <p>
  108. By default modules are only searched under the prefix <tt>/usr/local</tt>.
  109. You can add an extra prefix to the search paths by appending the
  110. <tt>PREFIX</tt> option, e.g.:
  111. </p>
  112. <pre class="code">
  113. make PREFIX=/home/myself/lj2
  114. </pre>
  115. <p>
  116. Note for OSX: <tt>MACOSX_DEPLOYMENT_TARGET</tt> is set to <tt>10.4</tt>
  117. in <tt>src/Makefile</tt>. Change it, if you want to build on an older version.
  118. </p>
  119. <h3>Installing LuaJIT</h3>
  120. <p>
  121. The top-level Makefile installs LuaJIT by default under
  122. <tt>/usr/local</tt>, i.e. the executable ends up in
  123. <tt>/usr/local/bin</tt> and so on. You need to have root privileges
  124. to write to this path. So, assuming sudo is installed on your system,
  125. run the following command and enter your sudo password:
  126. </p>
  127. <pre class="code">
  128. sudo make install
  129. </pre>
  130. <p>
  131. Otherwise specify the directory prefix as an absolute path, e.g.:
  132. </p>
  133. <pre class="code">
  134. make install PREFIX=/home/myself/lj2
  135. </pre>
  136. <p>
  137. Obviously the prefixes given during build and installation need to be the same.
  138. </p>
  139. <p style="color: #c00000;">
  140. Note: to avoid overwriting a previous version, the beta test releases
  141. only install the LuaJIT executable under the versioned name (i.e.
  142. <tt>luajit-2.0.0-beta2</tt>). You probably want to create a symlink
  143. for convenience, with a command like this:
  144. </p>
  145. <pre class="code" style="color: #c00000;">
  146. sudo ln -sf luajit-2.0.0-beta2&nbsp;/usr/local/bin/luajit
  147. </pre>
  148. <h2 id="windows">Windows Systems</h2>
  149. <h3>Prerequisites</h3>
  150. <p>
  151. Either install one of the open source SDKs
  152. (<a href="http://mingw.org/"><span class="ext">&raquo;</span>&nbsp;MinGW</a> or
  153. <a href="http://www.cygwin.com/"><span class="ext">&raquo;</span>&nbsp;Cygwin</a>), which come with a modified
  154. GCC plus the required development headers.
  155. </p>
  156. <p>
  157. Or install Microsoft's Visual C++ (MSVC) &mdash; the freely downloadable
  158. <a href="http://www.microsoft.com/Express/VC/"><span class="ext">&raquo;</span>&nbsp;Express Edition</a>
  159. works just fine.
  160. </p>
  161. <p>
  162. Next, download the source package and unpack it using an archive manager
  163. (e.g. the Windows Explorer) to a directory of your choice.
  164. </p>
  165. <h3>Building with MSVC</h3>
  166. <p>
  167. Open a "Visual Studio .NET Command Prompt", <tt>cd</tt> to the
  168. directory where you've unpacked the sources and run these commands:
  169. </p>
  170. <pre class="code">
  171. cd src
  172. msvcbuild
  173. </pre>
  174. <p>
  175. Then follow the installation instructions below.
  176. </p>
  177. <h3>Building with MinGW or Cygwin</h3>
  178. <p>
  179. Open a command prompt window and make sure the MinGW or Cygwin programs
  180. are in your path. Then <tt>cd</tt> to the directory where
  181. you've unpacked the sources and run this command for MinGW:
  182. </p>
  183. <pre class="code">
  184. mingw32-make
  185. </pre>
  186. <p>
  187. Or this command for Cygwin:
  188. </p>
  189. <pre class="code">
  190. make
  191. </pre>
  192. <p>
  193. Then follow the installation instructions below.
  194. </p>
  195. <h3>Installing LuaJIT</h3>
  196. <p>
  197. Copy <tt>luajit.exe</tt> and <tt>lua51.dll</tt> (built in the <tt>src</tt>
  198. directory) to a newly created directory (any location is ok).
  199. Add <tt>lua</tt> and <tt>lua\jit</tt> directories below it and copy
  200. all Lua files from the <tt>lib</tt> directory of the distribution
  201. to the latter directory.
  202. </p>
  203. <p>
  204. There are no hardcoded
  205. absolute path names &mdash; all modules are loaded relative to the
  206. directory where <tt>luajit.exe</tt> is installed
  207. (see <tt>src/luaconf.h</tt>).
  208. </p>
  209. <br class="flush">
  210. </div>
  211. <div id="foot">
  212. <hr class="hide">
  213. Copyright &copy; 2005-2009 Mike Pall
  214. <span class="noprint">
  215. &middot;
  216. <a href="contact.html">Contact</a>
  217. </span>
  218. </div>
  219. </body>
  220. </html>