From 1878d17f1966f3368f1600865b15b449beb3a596 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Thu, 9 Aug 2012 13:15:28 +0200 Subject: [PATCH] Update cross-compilation docs. --- doc/install.html | 124 +++++++++++++++++++++++------------------------ 1 file changed, 62 insertions(+), 62 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: MSVC + SDK v7.0
WinSDK v7.0 -ARMv5+
ARM9E+
+ARMv5+
ARM9E+
GCC 4.2+ GCC 4.2+ GCC 4.2+   -PPC -GCC 4.3+ +PPC GCC 4.3+ +GCC 4.3+
GCC 4.1 (PS3)     -PPC/e500v2 +PPC/e500v2 GCC 4.3+ GCC 4.3+     -MIPS +MIPS GCC 4.3+ GCC 4.3+   @@ -341,32 +341,69 @@ directory where luajit.exe is installed

Cross-compiling LuaJIT

-The build system has limited support for cross-compilation. For details -check the comments in src/Makefile. Here are some popular examples: +The GNU Makefile-based build system allows cross-compiling on any host +for any supported target, as long as both architectures have the same +pointer size. If you want to cross-compile to any 32 bit target on an +x64 OS, you need to install the multilib development package (e.g. +libc6-dev-i386 on Debian/Ubuntu) and build a 32 bit host part +(HOST_CC="gcc -m32").

-You can cross-compile to a 32 bit binary on a multilib x64 OS by -installing the multilib development packages (e.g. libc6-dev-i386 -on Debian/Ubuntu) and running: +You need to specify TARGET_SYS whenever the host OS and the +target OS differ, or you'll get assembler or linker errors. E.g. if +you're compiling on a Windows or OSX host for embedded Linux or Android, +you need to add TARGET_SYS=Linux to the examples below. For a +minimal target OS, you may need to disable the built-in allocator in +src/Makefile and use TARGET_SYS=Other. The examples +below only show some popular targets — please check the comments +in src/Makefile for more details.

+# Cross-compile to a 32 bit binary on a multilib x64 OS
 make CC="gcc -m32"
-
-

-You can cross-compile for a Windows target on Debian/Ubuntu by -installing the mingw32 package and running: -

-
+
+# Cross-compile on Debian/Ubuntu for Windows (mingw32 package)
 make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows
 
+

+The CROSS prefix allows specifying a standard GNU cross-compile +toolchain (Binutils, GCC and a matching libc). The prefix may vary +depending on the --target the toolchain was built for (note the +CROSS prefix has a trailing "-"). The examples below +use the canonical toolchain triplets for Linux. +

-You can cross-compile for an ARM target on an x86 or x64 host -system using a standard GNU cross-compile toolchain (Binutils, GCC, -EGLIBC). The CROSS prefix may vary depending on the ---target of the toolchain: +Since there's often no easy way to detect CPU features at runtime, it's +important to compile with the proper CPU or architecture settings. You +can specify these when building the toolchain yourself. Or add +-mcpu=... or -march=... to TARGET_CFLAGS. For +ARM it's important to have the correct -mfloat-abi=... setting, +too. Otherwise LuaJIT may not run at the full performance of your target +CPU.

-make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi-
+# ARM soft-float
+make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- \
+     TARGET_CFLAGS="-mfloat-abi=soft"
+
+# ARM soft-float ABI with VFP (example for Cortex-a8)
+make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- \
+     TARGET_CFLAGS="-mcpu=cortex-a8 -mfloat-abi=softfp"
+
+# ARM hard-float ABI with VFP (armhf, requires recent toolchain)
+make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabihf-
+
+# PPC
+make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu-
+# PPC/e500v2 (fast interpreter only)
+make HOST_CC="gcc -m32" CROSS=powerpc-e500v2-linux-gnuspe-
+# PS3 (fast interpreter only)
+make HOST_CC="gcc -m32" CROSS=ppu-lv2-
+
+# MIPS big-endian
+make HOST_CC="gcc -m32" CROSS=mips-linux-
+# MIPS little-endian
+make HOST_CC="gcc -m32" CROSS=mipsel-linux-
 

You can cross-compile for Android (ARM) using the » Android NDK. @@ -393,51 +430,14 @@ much slower than the JIT compiler. Please complain to Apple, not me. Or use Android. :-p

-ISDK=/Developer/Platforms/iPhoneOS.platform/Developer
-ISDKVER=iPhoneOS4.3.sdk
+IXCODE=/Applications/Xcode45-DP4.app/Contents
+ISDK=$IXCODE/Developer/Platforms/iPhoneOS.platform/Developer
+ISDKVER=iPhoneOS6.0.sdk
 ISDKP=$ISDK/usr/bin/
-ISDKF="-arch armv6 -isysroot $ISDK/SDKs/$ISDKVER"
+ISDKF="-arch armv7 -isysroot $ISDK/SDKs/$ISDKVER"
 make HOST_CC="gcc -m32 -arch i386" CROSS=$ISDKP TARGET_FLAGS="$ISDKF" \
      TARGET_SYS=iOS
 
-

-You can cross-compile for a PPC target or a -PPC/e500v2 target on x86 or x64 host systems using a standard -GNU cross-compile toolchain (Binutils, GCC, EGLIBC). -The CROSS prefix may vary depending on the --target -of the toolchain: -

-
-# PPC
-make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu-
-
-
-# PPC/e500v2
-make HOST_CC="gcc -m32" CROSS=powerpc-e500v2-linux-gnuspe-
-
-

-You can cross-compile for a big-endian or little-endian -MIPS target on x86 or x64 host systems using a standard -GNU cross-compile toolchain (Binutils, GCC, EGLIBC). -The CROSS prefix may vary depending on the --target -of the toolchain: -

-
-# MIPS big-endian
-make HOST_CC="gcc -m32" CROSS=mips-linux-
-
-
-# MIPS little-endian
-make HOST_CC="gcc -m32" CROSS=mipsel-linux-
-
-

-Whenever the host OS and the target OS differ, you need to specify -TARGET_SYS or you'll get assembler or linker errors. E.g. if -you're compiling on a Windows or OSX host for embedded Linux or Android, -you need to add TARGET_SYS=Linux to the examples above. For a -minimal target OS, you may need to disable the built-in allocator in -src/Makefile and use TARGET_SYS=Other. -

Embedding LuaJIT