install.html 7.8 KB

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