diff options
author | Mike Pall <mike> | 2012-08-09 13:15:28 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2012-08-09 13:16:35 +0200 |
commit | 1878d17f1966f3368f1600865b15b449beb3a596 (patch) | |
tree | 8ad772dc30e72ad0db24bfbc54f4128cce75e9bd /doc | |
parent | 85a02f9ae87eea34eac05679422bc558b5409fc7 (diff) | |
download | luajit-1878d17f1966f3368f1600865b15b449beb3a596.tar.gz luajit-1878d17f1966f3368f1600865b15b449beb3a596.tar.bz2 luajit-1878d17f1966f3368f1600865b15b449beb3a596.zip |
Update cross-compilation docs.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/install.html | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/doc/install.html b/doc/install.html index f487958d..19772da6 100644 --- a/doc/install.html +++ b/doc/install.html | |||
@@ -126,28 +126,28 @@ operating systems, CPUs and compilers: | |||
126 | <td class="compatos">MSVC + SDK v7.0<br>WinSDK v7.0</td> | 126 | <td class="compatos">MSVC + SDK v7.0<br>WinSDK v7.0</td> |
127 | </tr> | 127 | </tr> |
128 | <tr class="odd"> | 128 | <tr class="odd"> |
129 | <td class="compatcpu"><a href="#android">ARMv5+<br>ARM9E+</a></td> | 129 | <td class="compatcpu"><a href="#cross2">ARMv5+<br>ARM9E+</a></td> |
130 | <td class="compatos">GCC 4.2+</td> | 130 | <td class="compatos">GCC 4.2+</td> |
131 | <td class="compatos">GCC 4.2+</td> | 131 | <td class="compatos">GCC 4.2+</td> |
132 | <td class="compatos">GCC 4.2+</td> | 132 | <td class="compatos">GCC 4.2+</td> |
133 | <td class="compatos compatno"> </td> | 133 | <td class="compatos compatno"> </td> |
134 | </tr> | 134 | </tr> |
135 | <tr class="even"> | 135 | <tr class="even"> |
136 | <td class="compatcpu"><a href="#ppc">PPC</a></td> | 136 | <td class="compatcpu"><a href="#cross2">PPC</a></td> |
137 | <td class="compatos">GCC 4.3+</td> | ||
138 | <td class="compatos">GCC 4.3+</td> | 137 | <td class="compatos">GCC 4.3+</td> |
138 | <td class="compatos">GCC 4.3+<br>GCC 4.1 (<a href="#cross2">PS3</a>)</td> | ||
139 | <td class="compatos compatno"> </td> | 139 | <td class="compatos compatno"> </td> |
140 | <td class="compatos compatno"> </td> | 140 | <td class="compatos compatno"> </td> |
141 | </tr> | 141 | </tr> |
142 | <tr class="odd"> | 142 | <tr class="odd"> |
143 | <td class="compatcpu"><a href="#ppc">PPC/e500v2</a></td> | 143 | <td class="compatcpu"><a href="#cross2">PPC/e500v2</a></td> |
144 | <td class="compatos">GCC 4.3+</td> | 144 | <td class="compatos">GCC 4.3+</td> |
145 | <td class="compatos">GCC 4.3+</td> | 145 | <td class="compatos">GCC 4.3+</td> |
146 | <td class="compatos compatno"> </td> | 146 | <td class="compatos compatno"> </td> |
147 | <td class="compatos compatno"> </td> | 147 | <td class="compatos compatno"> </td> |
148 | </tr> | 148 | </tr> |
149 | <tr class="even"> | 149 | <tr class="even"> |
150 | <td class="compatcpu"><a href="#mips">MIPS</a></td> | 150 | <td class="compatcpu"><a href="#cross2">MIPS</a></td> |
151 | <td class="compatos">GCC 4.3+</td> | 151 | <td class="compatos">GCC 4.3+</td> |
152 | <td class="compatos">GCC 4.3+</td> | 152 | <td class="compatos">GCC 4.3+</td> |
153 | <td class="compatos compatno"> </td> | 153 | <td class="compatos compatno"> </td> |
@@ -341,32 +341,69 @@ directory where <tt>luajit.exe</tt> is installed | |||
341 | 341 | ||
342 | <h2 id="cross">Cross-compiling LuaJIT</h2> | 342 | <h2 id="cross">Cross-compiling LuaJIT</h2> |
343 | <p> | 343 | <p> |
344 | The build system has limited support for cross-compilation. For details | 344 | The GNU Makefile-based build system allows cross-compiling on any host |
345 | check the comments in <tt>src/Makefile</tt>. Here are some popular examples: | 345 | for any supported target, as long as both architectures have the same |
346 | pointer size. If you want to cross-compile to any 32 bit target on an | ||
347 | x64 OS, you need to install the multilib development package (e.g. | ||
348 | <tt>libc6-dev-i386</tt> on Debian/Ubuntu) and build a 32 bit host part | ||
349 | (<tt>HOST_CC="gcc -m32"</tt>). | ||
346 | </p> | 350 | </p> |
347 | <p> | 351 | <p> |
348 | You can cross-compile to a <b>32 bit binary on a multilib x64 OS</b> by | 352 | You need to specify <tt>TARGET_SYS</tt> whenever the host OS and the |
349 | installing the multilib development packages (e.g. <tt>libc6-dev-i386</tt> | 353 | target OS differ, or you'll get assembler or linker errors. E.g. if |
350 | on Debian/Ubuntu) and running: | 354 | you're compiling on a Windows or OSX host for embedded Linux or Android, |
355 | you need to add <tt>TARGET_SYS=Linux</tt> to the examples below. For a | ||
356 | minimal target OS, you may need to disable the built-in allocator in | ||
357 | <tt>src/Makefile</tt> and use <tt>TARGET_SYS=Other</tt>. The examples | ||
358 | below only show some popular targets — please check the comments | ||
359 | in <tt>src/Makefile</tt> for more details. | ||
351 | </p> | 360 | </p> |
352 | <pre class="code"> | 361 | <pre class="code"> |
362 | # Cross-compile to a 32 bit binary on a multilib x64 OS | ||
353 | make CC="gcc -m32" | 363 | make CC="gcc -m32" |
354 | </pre> | 364 | |
355 | <p> | 365 | # Cross-compile on Debian/Ubuntu for Windows (mingw32 package) |
356 | You can cross-compile for a <b>Windows target on Debian/Ubuntu</b> by | ||
357 | installing the <tt>mingw32</tt> package and running: | ||
358 | </p> | ||
359 | <pre class="code"> | ||
360 | make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows | 366 | make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows |
361 | </pre> | 367 | </pre> |
362 | <p> | 368 | <p id="cross2"> |
363 | You can cross-compile for an <b>ARM target</b> on an x86 or x64 host | 369 | The <tt>CROSS</tt> prefix allows specifying a standard GNU cross-compile |
364 | system using a standard GNU cross-compile toolchain (Binutils, GCC, | 370 | toolchain (Binutils, GCC and a matching libc). The prefix may vary |
365 | EGLIBC). The <tt>CROSS</tt> prefix may vary depending on the | 371 | depending on the <tt>--target</tt> the toolchain was built for (note the |
366 | <tt>--target</tt> of the toolchain: | 372 | <tt>CROSS</tt> prefix has a trailing <tt>"-"</tt>). The examples below |
373 | use the canonical toolchain triplets for Linux. | ||
374 | </p> | ||
375 | <p> | ||
376 | Since there's often no easy way to detect CPU features at runtime, it's | ||
377 | important to compile with the proper CPU or architecture settings. You | ||
378 | can specify these when building the toolchain yourself. Or add | ||
379 | <tt>-mcpu=...</tt> or <tt>-march=...</tt> to <tt>TARGET_CFLAGS</tt>. For | ||
380 | ARM it's important to have the correct <tt>-mfloat-abi=...</tt> setting, | ||
381 | too. Otherwise LuaJIT may not run at the full performance of your target | ||
382 | CPU. | ||
367 | </p> | 383 | </p> |
368 | <pre class="code"> | 384 | <pre class="code"> |
369 | make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- | 385 | # ARM soft-float |
386 | make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- \ | ||
387 | TARGET_CFLAGS="-mfloat-abi=soft" | ||
388 | |||
389 | # ARM soft-float ABI with VFP (example for Cortex-a8) | ||
390 | make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- \ | ||
391 | TARGET_CFLAGS="-mcpu=cortex-a8 -mfloat-abi=softfp" | ||
392 | |||
393 | # ARM hard-float ABI with VFP (armhf, requires recent toolchain) | ||
394 | make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabihf- | ||
395 | |||
396 | # PPC | ||
397 | make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu- | ||
398 | # PPC/e500v2 (fast interpreter only) | ||
399 | make HOST_CC="gcc -m32" CROSS=powerpc-e500v2-linux-gnuspe- | ||
400 | # PS3 (fast interpreter only) | ||
401 | make HOST_CC="gcc -m32" CROSS=ppu-lv2- | ||
402 | |||
403 | # MIPS big-endian | ||
404 | make HOST_CC="gcc -m32" CROSS=mips-linux- | ||
405 | # MIPS little-endian | ||
406 | make HOST_CC="gcc -m32" CROSS=mipsel-linux- | ||
370 | </pre> | 407 | </pre> |
371 | <p> | 408 | <p> |
372 | You can cross-compile for <b id="android">Android (ARM)</b> using the <a href="http://developer.android.com/sdk/ndk/index.html"><span class="ext">»</span> Android NDK</a>. | 409 | You can cross-compile for <b id="android">Android (ARM)</b> using the <a href="http://developer.android.com/sdk/ndk/index.html"><span class="ext">»</span> Android NDK</a>. |
@@ -393,51 +430,14 @@ much slower than the JIT compiler. Please complain to Apple, not me. | |||
393 | Or use Android. :-p | 430 | Or use Android. :-p |
394 | </p> | 431 | </p> |
395 | <pre class="code"> | 432 | <pre class="code"> |
396 | ISDK=/Developer/Platforms/iPhoneOS.platform/Developer | 433 | IXCODE=/Applications/Xcode45-DP4.app/Contents |
397 | ISDKVER=iPhoneOS4.3.sdk | 434 | ISDK=$IXCODE/Developer/Platforms/iPhoneOS.platform/Developer |
435 | ISDKVER=iPhoneOS6.0.sdk | ||
398 | ISDKP=$ISDK/usr/bin/ | 436 | ISDKP=$ISDK/usr/bin/ |
399 | ISDKF="-arch armv6 -isysroot $ISDK/SDKs/$ISDKVER" | 437 | ISDKF="-arch armv7 -isysroot $ISDK/SDKs/$ISDKVER" |
400 | make HOST_CC="gcc -m32 -arch i386" CROSS=$ISDKP TARGET_FLAGS="$ISDKF" \ | 438 | make HOST_CC="gcc -m32 -arch i386" CROSS=$ISDKP TARGET_FLAGS="$ISDKF" \ |
401 | TARGET_SYS=iOS | 439 | TARGET_SYS=iOS |
402 | </pre> | 440 | </pre> |
403 | <p> | ||
404 | You can cross-compile for a <b id="ppc">PPC target</b> or a | ||
405 | <b>PPC/e500v2 target</b> on x86 or x64 host systems using a standard | ||
406 | GNU cross-compile toolchain (Binutils, GCC, EGLIBC). | ||
407 | The <tt>CROSS</tt> prefix may vary depending on the <tt>--target</tt> | ||
408 | of the toolchain: | ||
409 | </p> | ||
410 | <pre class="code"> | ||
411 | # PPC | ||
412 | make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu- | ||
413 | </pre> | ||
414 | <pre class="code"> | ||
415 | # PPC/e500v2 | ||
416 | make HOST_CC="gcc -m32" CROSS=powerpc-e500v2-linux-gnuspe- | ||
417 | </pre> | ||
418 | <p> | ||
419 | You can cross-compile for a big-endian or little-endian | ||
420 | <b id="mips">MIPS target</b> on x86 or x64 host systems using a standard | ||
421 | GNU cross-compile toolchain (Binutils, GCC, EGLIBC). | ||
422 | The <tt>CROSS</tt> prefix may vary depending on the <tt>--target</tt> | ||
423 | of the toolchain: | ||
424 | </p> | ||
425 | <pre class="code"> | ||
426 | # MIPS big-endian | ||
427 | make HOST_CC="gcc -m32" CROSS=mips-linux- | ||
428 | </pre> | ||
429 | <pre class="code"> | ||
430 | # MIPS little-endian | ||
431 | make HOST_CC="gcc -m32" CROSS=mipsel-linux- | ||
432 | </pre> | ||
433 | <p> | ||
434 | Whenever the <b>host OS and the target OS differ</b>, you need to specify | ||
435 | <tt>TARGET_SYS</tt> or you'll get assembler or linker errors. E.g. if | ||
436 | you're compiling on a Windows or OSX host for embedded Linux or Android, | ||
437 | you need to add <tt>TARGET_SYS=Linux</tt> to the examples above. For a | ||
438 | minimal target OS, you may need to disable the built-in allocator in | ||
439 | <tt>src/Makefile</tt> and use <tt>TARGET_SYS=Other</tt>. | ||
440 | </p> | ||
441 | 441 | ||
442 | <h2 id="embed">Embedding LuaJIT</h2> | 442 | <h2 id="embed">Embedding LuaJIT</h2> |
443 | <p> | 443 | <p> |