diff options
| author | Mike Pall <mike> | 2010-03-04 19:07:38 +0100 |
|---|---|---|
| committer | Mike Pall <mike> | 2010-03-04 19:07:38 +0100 |
| commit | af92a143132ab8f39d9d7893fe4797b67b72bc98 (patch) | |
| tree | 1004d369ad7a1ac4ff731271acd96ee680522ac0 /doc/install.html | |
| parent | f76e5a311ba543ae174acd3b585fb672fde8a3b5 (diff) | |
| download | luajit-af92a143132ab8f39d9d7893fe4797b67b72bc98.tar.gz luajit-af92a143132ab8f39d9d7893fe4797b67b72bc98.tar.bz2 luajit-af92a143132ab8f39d9d7893fe4797b67b72bc98.zip | |
Update docs: native build default, cross-compilation, embedding.
Diffstat (limited to 'doc/install.html')
| -rw-r--r-- | doc/install.html | 75 |
1 files changed, 52 insertions, 23 deletions
diff --git a/doc/install.html b/doc/install.html index 102f3417..727668cf 100644 --- a/doc/install.html +++ b/doc/install.html | |||
| @@ -50,14 +50,8 @@ For the impatient (on POSIX systems): | |||
| 50 | make && sudo make install | 50 | make && sudo make install |
| 51 | </pre> | 51 | </pre> |
| 52 | <p> | 52 | <p> |
| 53 | LuaJIT currently builds out-of-the box on all popular x86 systems | 53 | LuaJIT currently builds out-of-the box on all popular x86 or x64 systems |
| 54 | (Linux, Windows, OSX etc.). It builds and runs fine as a 32 bit | 54 | (Linux, Windows, OSX etc.). |
| 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> | 55 | </p> |
| 62 | 56 | ||
| 63 | <h2>Configuring LuaJIT</h2> | 57 | <h2>Configuring LuaJIT</h2> |
| @@ -85,13 +79,8 @@ any settings. | |||
| 85 | <p> | 79 | <p> |
| 86 | Depending on your distribution, you may need to install a package for | 80 | Depending on your distribution, you may need to install a package for |
| 87 | GCC (GCC 3.4 or later required), the development headers and/or a | 81 | GCC (GCC 3.4 or later required), the development headers and/or a |
| 88 | complete SDK. | 82 | complete SDK. E.g. on a current Debian/Ubuntu, install <tt>libc6-dev</tt> |
| 89 | </p> | 83 | with the package manager. |
| 90 | <p> | ||
| 91 | E.g. on a current Debian/Ubuntu, install <tt>libc6-dev</tt> | ||
| 92 | with the package manager. Currently LuaJIT builds as a 32 bit | ||
| 93 | application by default, so you actually need to install <tt>libc6-dev-i386</tt> | ||
| 94 | when building on an x64 OS. | ||
| 95 | </p> | 84 | </p> |
| 96 | <p> | 85 | <p> |
| 97 | Download the current source package (pick the .tar.gz), if you haven't | 86 | Download the current source package (pick the .tar.gz), if you haven't |
| @@ -111,14 +100,9 @@ which is probably the default on your system, anyway. Simply run: | |||
| 111 | <pre class="code"> | 100 | <pre class="code"> |
| 112 | make | 101 | make |
| 113 | </pre> | 102 | </pre> |
| 114 | <div style="color: #00a000;"> | ||
| 115 | <p> | 103 | <p> |
| 116 | You can force a native x64 build on Linux/x64 with the following command: | 104 | This always builds a native x86 or x64 binary, depending on your OS. |
| 117 | </p> | 105 | </p> |
| 118 | <pre class="code"> | ||
| 119 | make CC="gcc -m64" | ||
| 120 | </pre> | ||
| 121 | </div> | ||
| 122 | <p> | 106 | <p> |
| 123 | By default modules are only searched under the prefix <tt>/usr/local</tt>. | 107 | By default modules are only searched under the prefix <tt>/usr/local</tt>. |
| 124 | You can add an extra prefix to the search paths by appending the | 108 | You can add an extra prefix to the search paths by appending the |
| @@ -203,14 +187,12 @@ Open a "Windows SDK Command Shell" and select the x86 compiler: | |||
| 203 | <pre class="code"> | 187 | <pre class="code"> |
| 204 | setenv /release /x86 | 188 | setenv /release /x86 |
| 205 | </pre> | 189 | </pre> |
| 206 | <div style="color: #00a000;"> | ||
| 207 | <p> | 190 | <p> |
| 208 | Or select the x64 compiler: | 191 | Or select the x64 compiler: |
| 209 | </p> | 192 | </p> |
| 210 | <pre class="code"> | 193 | <pre class="code"> |
| 211 | setenv /release /x64 | 194 | setenv /release /x64 |
| 212 | </pre> | 195 | </pre> |
| 213 | </div> | ||
| 214 | <p> | 196 | <p> |
| 215 | Then <tt>cd</tt> to the directory where you've unpacked the sources | 197 | Then <tt>cd</tt> to the directory where you've unpacked the sources |
| 216 | and run these commands: | 198 | and run these commands: |
| @@ -254,6 +236,53 @@ absolute path names — all modules are loaded relative to the | |||
| 254 | directory where <tt>luajit.exe</tt> is installed | 236 | directory where <tt>luajit.exe</tt> is installed |
| 255 | (see <tt>src/luaconf.h</tt>). | 237 | (see <tt>src/luaconf.h</tt>). |
| 256 | </p> | 238 | </p> |
| 239 | |||
| 240 | <h2>Cross-compiling LuaJIT</h2> | ||
| 241 | <p> | ||
| 242 | The build system has limited support for cross-compilation. For details | ||
| 243 | check the comments in <tt>src/Makefile</tt>. Here are some popular examples: | ||
| 244 | </p> | ||
| 245 | <p> | ||
| 246 | You can cross-compile to a 32 bit binary on a multilib x64 OS by | ||
| 247 | installing the multilib development pacakges (e.g. <tt>libc6-dev-i386</tt> | ||
| 248 | on Debian/Ubuntu) and running: | ||
| 249 | </p> | ||
| 250 | <pre class="code"> | ||
| 251 | make CC="gcc -m32" | ||
| 252 | </pre> | ||
| 253 | <p> | ||
| 254 | You can cross-compile for a Windows target on Debian/Ubuntu by | ||
| 255 | installing the <tt>mingw32</tt> package and running: | ||
| 256 | </p> | ||
| 257 | <pre class="code"> | ||
| 258 | make CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows | ||
| 259 | </pre> | ||
| 260 | |||
| 261 | <h2>Embedding LuaJIT</h2> | ||
| 262 | <p> | ||
| 263 | LuaJIT is API-compatible with Lua 5.1. If you've already embedded Lua | ||
| 264 | into your application, you probably don't need to do anything to switch | ||
| 265 | to LuaJIT, except link with a different library. Additional hints: | ||
| 266 | </p> | ||
| 267 | <ul> | ||
| 268 | <li>Make sure you use <tt>luaL_newstate</tt>. Avoid using | ||
| 269 | <tt>lua_newstate</tt>, since this uses the (slower) default memory | ||
| 270 | allocator from your system (no support for this on x64).</tt></li> | ||
| 271 | <li>Make sure you use <tt>luaL_openlibs</tt> and not the old Lua 5.0 style | ||
| 272 | of calling <tt>luaopen_base</tt> etc. directly.</li> | ||
| 273 | <li>To change which standard libraries to load, copy <tt>src/lib_init.c</tt> | ||
| 274 | to your project and modify it accordingly. Make sure the <tt>jit</tt> | ||
| 275 | library is loaded or the JIT compiler will not be activated.</li> | ||
| 276 | <li>Here's a | ||
| 277 | <a href="http://lua-users.org/wiki/SimpleLuaApiExample"><span class="ext">»</span> simple example</a>.</li> | ||
| 278 | </ul> | ||
| 279 | <p> | ||
| 280 | 64 bit applications on OSX must be linked with these options | ||
| 281 | (only the main executable): | ||
| 282 | </p> | ||
| 283 | <pre class="code"> | ||
| 284 | -pagezero_size 10000 -image_base 100000000 | ||
| 285 | </pre> | ||
| 257 | <br class="flush"> | 286 | <br class="flush"> |
| 258 | </div> | 287 | </div> |
| 259 | <div id="foot"> | 288 | <div id="foot"> |
