summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMike Pall <mike>2012-08-09 13:15:28 +0200
committerMike Pall <mike>2012-08-09 13:16:35 +0200
commit1878d17f1966f3368f1600865b15b449beb3a596 (patch)
tree8ad772dc30e72ad0db24bfbc54f4128cce75e9bd /doc
parent85a02f9ae87eea34eac05679422bc558b5409fc7 (diff)
downloadluajit-1878d17f1966f3368f1600865b15b449beb3a596.tar.gz
luajit-1878d17f1966f3368f1600865b15b449beb3a596.tar.bz2
luajit-1878d17f1966f3368f1600865b15b449beb3a596.zip
Update cross-compilation docs.
Diffstat (limited to 'doc')
-rw-r--r--doc/install.html126
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">&nbsp;</td> 133<td class="compatos compatno">&nbsp;</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">&nbsp;</td> 139<td class="compatos compatno">&nbsp;</td>
140<td class="compatos compatno">&nbsp;</td> 140<td class="compatos compatno">&nbsp;</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">&nbsp;</td> 146<td class="compatos compatno">&nbsp;</td>
147<td class="compatos compatno">&nbsp;</td> 147<td class="compatos compatno">&nbsp;</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">&nbsp;</td> 153<td class="compatos compatno">&nbsp;</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>
344The build system has limited support for cross-compilation. For details 344The GNU Makefile-based build system allows cross-compiling on any host
345check the comments in <tt>src/Makefile</tt>. Here are some popular examples: 345for any supported target, as long as both architectures have the same
346pointer size. If you want to cross-compile to any 32 bit target on an
347x64 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>
348You can cross-compile to a <b>32 bit binary on a multilib x64 OS</b> by 352You need to specify <tt>TARGET_SYS</tt> whenever the host OS and the
349installing the multilib development packages (e.g. <tt>libc6-dev-i386</tt> 353target OS differ, or you'll get assembler or linker errors. E.g. if
350on Debian/Ubuntu) and running: 354you're compiling on a Windows or OSX host for embedded Linux or Android,
355you need to add <tt>TARGET_SYS=Linux</tt> to the examples below. For a
356minimal 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
358below only show some popular targets &mdash; please check the comments
359in <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
353make CC="gcc -m32" 363make CC="gcc -m32"
354</pre> 364
355<p> 365# Cross-compile on Debian/Ubuntu for Windows (mingw32 package)
356You can cross-compile for a <b>Windows target on Debian/Ubuntu</b> by
357installing the <tt>mingw32</tt> package and running:
358</p>
359<pre class="code">
360make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows 366make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows
361</pre> 367</pre>
362<p> 368<p id="cross2">
363You can cross-compile for an <b>ARM target</b> on an x86 or x64 host 369The <tt>CROSS</tt> prefix allows specifying a standard GNU cross-compile
364system using a standard GNU cross-compile toolchain (Binutils, GCC, 370toolchain (Binutils, GCC and a matching libc). The prefix may vary
365EGLIBC). The <tt>CROSS</tt> prefix may vary depending on the 371depending 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
373use the canonical toolchain triplets for Linux.
374</p>
375<p>
376Since there's often no easy way to detect CPU features at runtime, it's
377important to compile with the proper CPU or architecture settings. You
378can specify these when building the toolchain yourself. Or add
379<tt>-mcpu=...</tt> or <tt>-march=...</tt> to <tt>TARGET_CFLAGS</tt>. For
380ARM it's important to have the correct <tt>-mfloat-abi=...</tt> setting,
381too. Otherwise LuaJIT may not run at the full performance of your target
382CPU.
367</p> 383</p>
368<pre class="code"> 384<pre class="code">
369make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- 385# ARM soft-float
386make 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)
390make 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)
394make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabihf-
395
396# PPC
397make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu-
398# PPC/e500v2 (fast interpreter only)
399make HOST_CC="gcc -m32" CROSS=powerpc-e500v2-linux-gnuspe-
400# PS3 (fast interpreter only)
401make HOST_CC="gcc -m32" CROSS=ppu-lv2-
402
403# MIPS big-endian
404make HOST_CC="gcc -m32" CROSS=mips-linux-
405# MIPS little-endian
406make HOST_CC="gcc -m32" CROSS=mipsel-linux-
370</pre> 407</pre>
371<p> 408<p>
372You 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">&raquo;</span>&nbsp;Android NDK</a>. 409You 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">&raquo;</span>&nbsp;Android NDK</a>.
@@ -393,51 +430,14 @@ much slower than the JIT compiler. Please complain to Apple, not me.
393Or use Android. :-p 430Or use Android. :-p
394</p> 431</p>
395<pre class="code"> 432<pre class="code">
396ISDK=/Developer/Platforms/iPhoneOS.platform/Developer 433IXCODE=/Applications/Xcode45-DP4.app/Contents
397ISDKVER=iPhoneOS4.3.sdk 434ISDK=$IXCODE/Developer/Platforms/iPhoneOS.platform/Developer
435ISDKVER=iPhoneOS6.0.sdk
398ISDKP=$ISDK/usr/bin/ 436ISDKP=$ISDK/usr/bin/
399ISDKF="-arch armv6 -isysroot $ISDK/SDKs/$ISDKVER" 437ISDKF="-arch armv7 -isysroot $ISDK/SDKs/$ISDKVER"
400make HOST_CC="gcc -m32 -arch i386" CROSS=$ISDKP TARGET_FLAGS="$ISDKF" \ 438make 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>
404You 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
406GNU cross-compile toolchain (Binutils, GCC, EGLIBC).
407The <tt>CROSS</tt> prefix may vary depending on the <tt>--target</tt>
408of the toolchain:
409</p>
410<pre class="code">
411# PPC
412make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu-
413</pre>
414<pre class="code">
415# PPC/e500v2
416make HOST_CC="gcc -m32" CROSS=powerpc-e500v2-linux-gnuspe-
417</pre>
418<p>
419You 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
421GNU cross-compile toolchain (Binutils, GCC, EGLIBC).
422The <tt>CROSS</tt> prefix may vary depending on the <tt>--target</tt>
423of the toolchain:
424</p>
425<pre class="code">
426# MIPS big-endian
427make HOST_CC="gcc -m32" CROSS=mips-linux-
428</pre>
429<pre class="code">
430# MIPS little-endian
431make HOST_CC="gcc -m32" CROSS=mipsel-linux-
432</pre>
433<p>
434Whenever 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
436you're compiling on a Windows or OSX host for embedded Linux or Android,
437you need to add <tt>TARGET_SYS=Linux</tt> to the examples above. For a
438minimal 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>