mesa: fix 32bit cross compilation on a 64bit machine
authorMarc Dietrich <marvin24@gmx.de>
Mon, 31 Aug 2009 15:56:33 +0000 (08:56 -0700)
committerBrian Paul <brianp@vmware.com>
Mon, 31 Aug 2009 16:32:14 +0000 (10:32 -0600)
When cross compiling on a 64bit machine, gen_matypes.c is build
for the host machine (64bit) but must generates code for the target
machine (32bit). This causes wrong offsets all over the place and
crashes googleearth on my machine. Solution is to add -m32 when
cross compiling.

Attached patch is compatible with linux-x86-32 and autoconf based
builds.

configure.ac
src/mesa/x86/Makefile

index 8607ff17a3c1cbbf00a6c524d4e2d500c3120c1f..63cc27eec91c7e57d72dc7ad2a0921f7eb269de0 100644 (file)
@@ -121,6 +121,7 @@ AC_ARG_ENABLE([32-bit],
 if test "x$enable_32bit" = xyes; then
     if test "x$GCC" = xyes; then
         CFLAGS="$CFLAGS -m32"
+        ARCH_FLAGS="$ARCH_FLAGS -m32"
     fi
     if test "x$GXX" = xyes; then
         CXXFLAGS="$CXXFLAGS -m32"
index aa49a9134aa0ea219c79fb4f24caf57e9e5fc5df..69122c114b0cbdafb6cdc3199fc78b2256c5ca4b 100644 (file)
@@ -21,7 +21,7 @@ clean:
 
 
 gen_matypes: gen_matypes.c
-       $(HOST_CC) $(INCLUDE_DIRS) $(HOST_CFLAGS) gen_matypes.c -o gen_matypes
+       $(HOST_CC) $(ARCH_FLAGS) $(INCLUDE_DIRS) $(HOST_CFLAGS) gen_matypes.c -o gen_matypes
 
 # need some special rules here, unfortunately
 matypes.h: ../main/mtypes.h ../tnl/t_context.h gen_matypes