diff options
author | Mike Pall <mike> | 2016-05-26 13:54:58 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2016-05-26 13:57:12 +0200 |
commit | 9fa843aefbf4eb1bc91dd6ca4f947365b5393e26 (patch) | |
tree | d9973b50dd053b77c7e27e7f5c6e92817a0c1efb | |
parent | 3f1031c34ba840e2c1f6000d709ed4a6102b40a9 (diff) | |
download | luajit-9fa843aefbf4eb1bc91dd6ca4f947365b5393e26.tar.gz luajit-9fa843aefbf4eb1bc91dd6ca4f947365b5393e26.tar.bz2 luajit-9fa843aefbf4eb1bc91dd6ca4f947365b5393e26.zip |
Cleanup install docs.
-rw-r--r-- | doc/install.html | 77 |
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: | |||
202 | make | 202 | make |
203 | </pre> | 203 | </pre> |
204 | <p> | 204 | <p> |
205 | This always builds a native x86, x64 or PPC binary, depending on the host OS | 205 | This always builds a native binary, depending on the host OS |
206 | you're running this command on. Check the section on | 206 | you'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> |
336 | First, 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> | ||
336 | The GNU Makefile-based build system allows cross-compiling on any host | 346 | The GNU Makefile-based build system allows cross-compiling on any host |
337 | for any supported target, as long as both architectures have the same | 347 | for any supported target: |
338 | pointer size. If you want to cross-compile to any 32 bit target on an | ||
339 | x64 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> |
344 | You need to specify <tt>TARGET_SYS</tt> whenever the host OS and the | 356 | You need to specify <tt>TARGET_SYS</tt> whenever the host OS and the |
345 | target OS differ, or you'll get assembler or linker errors. E.g. if | 357 | target OS differ, or you'll get assembler or linker errors: |
346 | you're compiling on a Windows or OSX host for embedded Linux or Android, | ||
347 | you need to add <tt>TARGET_SYS=Linux</tt> to the examples below. For a | ||
348 | minimal 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 | ||
350 | specify 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> |
353 | The examples below only show some popular targets — please check | 365 | Here are some examples where host and target have the same CPU: |
354 | the 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> |
371 | Since there's often no easy way to detect CPU features at runtime, it's | 382 | Since there's often no easy way to detect CPU features at runtime, it's |
372 | important to compile with the proper CPU or architecture settings. You | 383 | important to compile with the proper CPU or architecture settings: |
373 | can 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> |
375 | ARM 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> |
376 | too. 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> |
377 | CPU. | 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> | ||
392 | Here 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 |
381 | make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- \ | 396 | make 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) |
385 | make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- \ | 400 | make 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) |
389 | make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabihf- | 404 | make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabihf- |
390 | 405 | ||
391 | # ARM64 (requires x64 host) | 406 | # ARM64 |
392 | make CROSS=aarch64-linux- | 407 | make CROSS=aarch64-linux- |
393 | 408 | ||
394 | # PPC | 409 | # PPC |
@@ -400,7 +415,7 @@ make HOST_CC="gcc -m32" CROSS=mips-linux- | |||
400 | make HOST_CC="gcc -m32" CROSS=mipsel-linux- | 415 | make HOST_CC="gcc -m32" CROSS=mipsel-linux- |
401 | </pre> | 416 | </pre> |
402 | <p> | 417 | <p> |
403 | You can cross-compile for <b id="android">Android</b> using the <a href="http://developer.android.com/sdk/ndk/index.html"><span class="ext">»</span> Android NDK</a>. | 418 | You can cross-compile for <b id="android">Android</b> using the <a href="https://developer.android.com/ndk/index.html">Android NDK</a>. |
404 | The environment variables need to match the install locations and the | 419 | The environment variables need to match the install locations and the |
405 | desired target platform. E.g. Android 4.0 corresponds to ABI level 14. | 420 | desired target platform. E.g. Android 4.0 corresponds to ABI level 14. |
406 | For details check the folder <tt>docs</tt> in the NDK directory. | 421 | For 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) |
415 | NDK=/opt/android/ndk | 430 | NDK=/opt/android/ndk |
416 | NDKABI=8 | 431 | NDKABI=8 |
417 | NDKVER=$NDK/toolchains/arm-linux-androideabi-4.6 | 432 | NDKVER=$NDK/toolchains/arm-linux-androideabi-4.9 |
418 | NDKP=$NDKVER/prebuilt/linux-x86/bin/arm-linux-androideabi- | 433 | NDKP=$NDKVER/prebuilt/linux-x86/bin/arm-linux-androideabi- |
419 | NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm" | 434 | NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm" |
420 | make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF" | 435 | make 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) |
423 | NDK=/opt/android/ndk | 438 | NDK=/opt/android/ndk |
424 | NDKABI=14 | 439 | NDKABI=14 |
425 | NDKVER=$NDK/toolchains/arm-linux-androideabi-4.6 | 440 | NDKVER=$NDK/toolchains/arm-linux-androideabi-4.9 |
426 | NDKP=$NDKVER/prebuilt/linux-x86/bin/arm-linux-androideabi- | 441 | NDKP=$NDKVER/prebuilt/linux-x86/bin/arm-linux-androideabi- |
427 | NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm" | 442 | NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm" |
428 | NDKARCH="-march=armv7-a -mfloat-abi=softfp -Wl,--fix-cortex-a8" | 443 | NDKARCH="-march=armv7-a -mfloat-abi=softfp -Wl,--fix-cortex-a8" |
429 | make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF $NDKARCH" | 444 | make 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) |
432 | NDK=/opt/android/ndk | 447 | NDK=/opt/android/ndk |
433 | NDKABI=14 | 448 | NDKABI=14 |
434 | NDKVER=$NDK/toolchains/mipsel-linux-android-4.6 | 449 | NDKVER=$NDK/toolchains/mipsel-linux-android-4.9 |
435 | NDKP=$NDKVER/prebuilt/linux-x86/bin/mipsel-linux-android- | 450 | NDKP=$NDKVER/prebuilt/linux-x86/bin/mipsel-linux-android- |
436 | NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-mips" | 451 | NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-mips" |
437 | make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF" | 452 | make 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) |
440 | NDK=/opt/android/ndk | 455 | NDK=/opt/android/ndk |
441 | NDKABI=14 | 456 | NDKABI=14 |
442 | NDKVER=$NDK/toolchains/x86-4.6 | 457 | NDKVER=$NDK/toolchains/x86-4.9 |
443 | NDKP=$NDKVER/prebuilt/linux-x86/bin/i686-linux-android- | 458 | NDKP=$NDKVER/prebuilt/linux-x86/bin/i686-linux-android- |
444 | NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-x86" | 459 | NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-x86" |
445 | make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF" | 460 | make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF" |