aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2016-05-26 13:54:58 +0200
committerMike Pall <mike>2016-05-26 13:57:12 +0200
commit9fa843aefbf4eb1bc91dd6ca4f947365b5393e26 (patch)
treed9973b50dd053b77c7e27e7f5c6e92817a0c1efb
parent3f1031c34ba840e2c1f6000d709ed4a6102b40a9 (diff)
downloadluajit-9fa843aefbf4eb1bc91dd6ca4f947365b5393e26.tar.gz
luajit-9fa843aefbf4eb1bc91dd6ca4f947365b5393e26.tar.bz2
luajit-9fa843aefbf4eb1bc91dd6ca4f947365b5393e26.zip
Cleanup install docs.
-rw-r--r--doc/install.html77
1 files changed, 46 insertions, 31 deletions
diff --git a/doc/install.html b/doc/install.html
index 9921258e..9963010d 100644
--- a/doc/install.html
+++ b/doc/install.html
@@ -122,7 +122,7 @@ operating systems, CPUs and compilers:
122<tr class="even"> 122<tr class="even">
123<td class="compatcpu">x64 (64 bit)</td> 123<td class="compatcpu">x64 (64 bit)</td>
124<td class="compatos">GCC 4.2+</td> 124<td class="compatos">GCC 4.2+</td>
125<td class="compatos">ORBIS (<a href="#ps4">PS4</a>)</td> 125<td class="compatos">GCC 4.2+<br>ORBIS (<a href="#ps4">PS4</a>)</td>
126<td class="compatos">XCode 5.0+<br>Clang</td> 126<td class="compatos">XCode 5.0+<br>Clang</td>
127<td class="compatos">MSVC + SDK v7.0<br>WinSDK v7.0<br>Durango (<a href="#xboxone">Xbox One</a>)</td> 127<td class="compatos">MSVC + SDK v7.0<br>WinSDK v7.0<br>Durango (<a href="#xboxone">Xbox One</a>)</td>
128</tr> 128</tr>
@@ -202,7 +202,7 @@ which is probably the default on your system, anyway. Simply run:
202make 202make
203</pre> 203</pre>
204<p> 204<p>
205This always builds a native x86, x64 or PPC binary, depending on the host OS 205This always builds a native binary, depending on the host OS
206you're running this command on. Check the section on 206you're running this command on. Check the section on
207<a href="#cross">cross-compilation</a> for more options. 207<a href="#cross">cross-compilation</a> for more options.
208</p> 208</p>
@@ -333,25 +333,36 @@ directory where <tt>luajit.exe</tt> is installed
333 333
334<h2 id="cross">Cross-compiling LuaJIT</h2> 334<h2 id="cross">Cross-compiling LuaJIT</h2>
335<p> 335<p>
336First, let's clear up some terminology:
337</p>
338<ul>
339<li>Host: This is your development system, usually based on a x64 or x86 CPU.</li>
340<li>Target: This is the target system you want LuaJIT to run on, e.g. Android/ARM.</li>
341<li>Toolchain: This comprises a C compiler, linker, assembler and a matching C library.</li>
342<li>Host (or system) toolchain: This is the toolchain used to build native binaries for your host system.</li>
343<li>Cross-compile toolchain: This is the toolchain used to build binaries for the target system. They can only be run on the target system.</li>
344</ul>
345<p>
336The GNU Makefile-based build system allows cross-compiling on any host 346The GNU Makefile-based build system allows cross-compiling on any host
337for any supported target, as long as both architectures have the same 347for any supported target:
338pointer size. If you want to cross-compile to any 32 bit target on an
339x64 OS, you need to install the multilib development package (e.g.
340<tt>libc6-dev-i386</tt> on Debian/Ubuntu) and build a 32 bit host part
341(<tt>HOST_CC="gcc -m32"</tt>).
342</p> 348</p>
349<ul>
350<li>Yes, you need a toolchain for both your host <em>and</em> your target!</li>
351<li>Both host and target architectures must have the same pointer size.</li>
352<li>E.g. if you want to cross-compile to a 32 bit target on a 64 bit host, you need to install the multilib development package (e.g. <tt>libc6-dev-i386</tt> on Debian/Ubuntu) and build a 32 bit host part (<tt>HOST_CC="gcc -m32"</tt>).</li>
353<li>64 bit targets always require compilation on a 64 bit host.</li>
354</ul>
343<p> 355<p>
344You need to specify <tt>TARGET_SYS</tt> whenever the host OS and the 356You need to specify <tt>TARGET_SYS</tt> whenever the host OS and the
345target OS differ, or you'll get assembler or linker errors. E.g. if 357target OS differ, or you'll get assembler or linker errors:
346you're compiling on a Windows or OSX host for embedded Linux or Android,
347you need to add <tt>TARGET_SYS=Linux</tt> to the examples below. For a
348minimal target OS, you may need to disable the built-in allocator in
349<tt>src/Makefile</tt> and use <tt>TARGET_SYS=Other</tt>. Don't forget to
350specify the same <tt>TARGET_SYS</tt> for the install step, too.
351</p> 358</p>
359<ul>
360<li>E.g. if you're compiling on a Windows or OSX host for embedded Linux or Android, you need to add <tt>TARGET_SYS=Linux</tt> to the examples below.</li>
361<li>For a minimal target OS, you may need to disable the built-in allocator in <tt>src/Makefile</tt> and use <tt>TARGET_SYS=Other</tt>.</li>
362<li>Don't forget to specify the same <tt>TARGET_SYS</tt> for the install step, too.</li>
363</ul>
352<p> 364<p>
353The examples below only show some popular targets &mdash; please check 365Here are some examples where host and target have the same CPU:
354the comments in <tt>src/Makefile</tt> for more details.
355</p> 366</p>
356<pre class="code"> 367<pre class="code">
357# Cross-compile to a 32 bit binary on a multilib x64 OS 368# Cross-compile to a 32 bit binary on a multilib x64 OS
@@ -369,26 +380,30 @@ use the canonical toolchain triplets for Linux.
369</p> 380</p>
370<p> 381<p>
371Since there's often no easy way to detect CPU features at runtime, it's 382Since there's often no easy way to detect CPU features at runtime, it's
372important to compile with the proper CPU or architecture settings. You 383important to compile with the proper CPU or architecture settings:
373can specify these when building the toolchain yourself. Or add 384</o>
374<tt>-mcpu=...</tt> or <tt>-march=...</tt> to <tt>TARGET_CFLAGS</tt>. For 385<ul>
375ARM it's important to have the correct <tt>-mfloat-abi=...</tt> setting, 386<li>The best way to get consistent results is to specify the correct settings when building the toolchain yourself.</li>
376too. Otherwise LuaJIT may not run at the full performance of your target 387<li>For a pre-built, generic toolchain add <tt>-mcpu=...</tt> or <tt>-march=...</tt> and other necessary flags to <tt>TARGET_CFLAGS</tt>.</li>
377CPU. 388<li>For ARM it's important to have the correct <tt>-mfloat-abi=...</tt> setting, too. Otherwise LuaJIT may not run at the full performance of your target CPU.</li>
389<li>For MIPS it's important to select a supported ABI (o32 on MIPS32) and consistently compile your project either with hard-float or soft-float compiler settings. Do not use <tt>-mips16</tt>.</li>
390</ul>
391<p>
392Here are some examples for targets with a different CPU than the host:
378</p> 393</p>
379<pre class="code"> 394<pre class="code">
380# ARM soft-float 395# ARM soft-float
381make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- \ 396make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- \
382 TARGET_CFLAGS="-mfloat-abi=soft" 397 TARGET_CFLAGS="-mfloat-abi=soft"
383 398
384# ARM soft-float ABI with VFP (example for Cortex-A8) 399# ARM soft-float ABI with VFP (example for Cortex-A9)
385make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- \ 400make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- \
386 TARGET_CFLAGS="-mcpu=cortex-a8 -mfloat-abi=softfp" 401 TARGET_CFLAGS="-mcpu=cortex-a9 -mfloat-abi=softfp"
387 402
388# ARM hard-float ABI with VFP (armhf, requires recent toolchain) 403# ARM hard-float ABI with VFP (armhf, most modern toolchains)
389make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabihf- 404make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabihf-
390 405
391# ARM64 (requires x64 host) 406# ARM64
392make CROSS=aarch64-linux- 407make CROSS=aarch64-linux-
393 408
394# PPC 409# PPC
@@ -400,7 +415,7 @@ make HOST_CC="gcc -m32" CROSS=mips-linux-
400make HOST_CC="gcc -m32" CROSS=mipsel-linux- 415make HOST_CC="gcc -m32" CROSS=mipsel-linux-
401</pre> 416</pre>
402<p> 417<p>
403You can cross-compile for <b id="android">Android</b> using the <a href="http://developer.android.com/sdk/ndk/index.html"><span class="ext">&raquo;</span>&nbsp;Android NDK</a>. 418You can cross-compile for <b id="android">Android</b> using the <a href="https://developer.android.com/ndk/index.html">Android NDK</a>.
404The environment variables need to match the install locations and the 419The environment variables need to match the install locations and the
405desired target platform. E.g. Android&nbsp;4.0 corresponds to ABI level&nbsp;14. 420desired target platform. E.g. Android&nbsp;4.0 corresponds to ABI level&nbsp;14.
406For details check the folder <tt>docs</tt> in the NDK directory. 421For details check the folder <tt>docs</tt> in the NDK directory.
@@ -414,7 +429,7 @@ to build/deploy or which lowest common denominator you want to pick:
414# Android/ARM, armeabi (ARMv5TE soft-float), Android 2.2+ (Froyo) 429# Android/ARM, armeabi (ARMv5TE soft-float), Android 2.2+ (Froyo)
415NDK=/opt/android/ndk 430NDK=/opt/android/ndk
416NDKABI=8 431NDKABI=8
417NDKVER=$NDK/toolchains/arm-linux-androideabi-4.6 432NDKVER=$NDK/toolchains/arm-linux-androideabi-4.9
418NDKP=$NDKVER/prebuilt/linux-x86/bin/arm-linux-androideabi- 433NDKP=$NDKVER/prebuilt/linux-x86/bin/arm-linux-androideabi-
419NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm" 434NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm"
420make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF" 435make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"
@@ -422,16 +437,16 @@ make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"
422# Android/ARM, armeabi-v7a (ARMv7 VFP), Android 4.0+ (ICS) 437# Android/ARM, armeabi-v7a (ARMv7 VFP), Android 4.0+ (ICS)
423NDK=/opt/android/ndk 438NDK=/opt/android/ndk
424NDKABI=14 439NDKABI=14
425NDKVER=$NDK/toolchains/arm-linux-androideabi-4.6 440NDKVER=$NDK/toolchains/arm-linux-androideabi-4.9
426NDKP=$NDKVER/prebuilt/linux-x86/bin/arm-linux-androideabi- 441NDKP=$NDKVER/prebuilt/linux-x86/bin/arm-linux-androideabi-
427NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm" 442NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm"
428NDKARCH="-march=armv7-a -mfloat-abi=softfp -Wl,--fix-cortex-a8" 443NDKARCH="-march=armv7-a -mfloat-abi=softfp -Wl,--fix-cortex-a8"
429make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF $NDKARCH" 444make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF $NDKARCH"
430 445
431# Android/MIPS, mips (MIPS32R1 hard-float), Android 4.0+ (ICS) 446# Android/MIPS, mipsel (MIPS32R1 hard-float), Android 4.0+ (ICS)
432NDK=/opt/android/ndk 447NDK=/opt/android/ndk
433NDKABI=14 448NDKABI=14
434NDKVER=$NDK/toolchains/mipsel-linux-android-4.6 449NDKVER=$NDK/toolchains/mipsel-linux-android-4.9
435NDKP=$NDKVER/prebuilt/linux-x86/bin/mipsel-linux-android- 450NDKP=$NDKVER/prebuilt/linux-x86/bin/mipsel-linux-android-
436NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-mips" 451NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-mips"
437make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF" 452make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"
@@ -439,7 +454,7 @@ make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"
439# Android/x86, x86 (i686 SSE3), Android 4.0+ (ICS) 454# Android/x86, x86 (i686 SSE3), Android 4.0+ (ICS)
440NDK=/opt/android/ndk 455NDK=/opt/android/ndk
441NDKABI=14 456NDKABI=14
442NDKVER=$NDK/toolchains/x86-4.6 457NDKVER=$NDK/toolchains/x86-4.9
443NDKP=$NDKVER/prebuilt/linux-x86/bin/i686-linux-android- 458NDKP=$NDKVER/prebuilt/linux-x86/bin/i686-linux-android-
444NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-x86" 459NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-x86"
445make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF" 460make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"