On Mon, Aug 31, 2009 at 8:56 AM, Marc Dietrich<[email protected]> wrote:
> 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          |    1 +
>  src/mesa/x86/Makefile |    2 +-
>  2 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 9d318b3..c5ef676 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -126,6 +126,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"
> diff --git a/src/mesa/x86/Makefile b/src/mesa/x86/Makefile
> index aa49a91..69122c1 100644
> --- a/src/mesa/x86/Makefile
> +++ b/src/mesa/x86/Makefile
> @@ -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

Hmm, this is a little unfortunate. If you use -m32, then you're going
to generate a native 32 bit binary, right? That works for the x86_64
case when you have multilib setup, but what if I was cross compiling
from PPC or something? I'm guessing not too many people are cross
compiling mesa for x86 or this would have come up sooner.

Not sure what the general solution is. --enable-32-bit was just a
quick fix hack and not really intended to be the only way for people
to build successfully. Definitely configure should set it up that if
you're not cross compiling, HOST_CC=$CC and HOST_CFLAGS=$CFLAGS. I'd
never noticed that before.

--
Dan

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to