[Mesa-dev] llvm-config on a biarch machine

Brian Paul brianp at vmware.com
Mon Aug 29 09:23:06 PDT 2011


On 08/24/2011 09:34 AM, Kevin DeKorte wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On a biarch machine like Fedora llvm-config defaults to outputting the
> values for a 64bit build. With a recent patch to llvm-devel there are
> now arch specific versions of llvm-config and this patch should use them
> properly. With this patch I the proper llvm-config is used for 64 bit
> and 32bit builds. There may be a better way to do this, so this is an
> example that worked for me.
>
>
> diff --git a/configure.ac b/configure.ac
> index ea58dae..e3d9d5a 100644
> - - --- a/configure.ac
> +++ b/configure.ac
> @@ -1745,7 +1745,15 @@ if test "x$enable_gallium_llvm" = xauto; then
>      esac
>   fi
>   if test "x$enable_gallium_llvm" = xyes; then
> - - -    AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
> +    if test "x$enable_32bit" = xyes; then
> +        AC_PATH_PROG([LLVM_CONFIG], [llvm-config-32], [no])
> +    fi
> +    if test "x$enable_64" = xyes; then
> +        AC_PATH_PROG([LLVM_CONFIG], [llvm-config-64], [no])
> +    fi
> +    if test "x$LLVM_CONFIG" = x; then
> +        AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
> +    fi
>
>      if test "x$LLVM_CONFIG" != xno; then
>         LLVM_VERSION=`$LLVM_CONFIG --version`
>

That part looks OK to me.


>
> However, when building the 32 bit version of mesa (--enable-32-bit) it
> seems that the CFLAGS are not properly passed to the llvmpipe
> Makefile. So I had to manually add in the compiler flags as follows,
> which is incorrect for 64bit.
>
> diff --git a/src/gallium/drivers/llvmpipe/Makefile
> b/src/gallium/drivers/llvmpip
> index f930135..047fbf6 100644
> - - --- a/src/gallium/drivers/llvmpipe/Makefile
> +++ b/src/gallium/drivers/llvmpipe/Makefile
> @@ -70,7 +70,8 @@ PROGS_DEPS := ../../auxiliary/libgallium.a
>   lp_tile_soa.c: lp_tile_soa.py ../../auxiliary/util/u_format_parse.py
> ../../auxi
>          $(PYTHON2) $(PYTHON_FLAGS) lp_tile_soa.py
> ../../auxiliary/util/u_format.
>
> - - -LDFLAGS += $(LLVM_LDFLAGS)
> +CFLAGS += -m32
> +LDFLAGS += -m32 $(LLVM_LDFLAGS)
>   LIBS += -L../../auxiliary/ -lgallium libllvmpipe.a $(LLVM_LIBS)
> $(GL_LIB_DEPS)
>   LD=$(CXX)
>
> So some work needs to be done to llvmpipe to properly include the
> CFLAGS/LDFLAGS

Yeah, we can't just force -m32 there.  I don't have time to 
investigate this, maybe somone else can.

-Brian


More information about the mesa-dev mailing list