[Mesa-dev] [PATCH] configure: use $target_cpu, not $host_cpu when setting asm_arch

Marek Olšák maraeo at gmail.com
Wed Jun 24 02:28:00 PDT 2015


Hi,

This is how I build 32-bit Mesa:

# Mandatory for 32-bit
dir=i386-linux-gnu
build=i686-linux-gnu
export CFLAGS="-m32 -O2 -g"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="-L/usr/lib/$dir"
export PKG_CONFIG_PATH="/usr/lib/$dir/pkgconfig"

# Optional
export USER_CFLAGS="-fno-omit-frame-pointer"
export USER_CXXFLAGS="$USER_CFLAGS"
export CPP="ccache cpp"
export CC="ccache gcc"
export CXX="ccache g++"

./autogen.sh \
 --build=$build --prefix=/usr --libdir=/usr/lib/$dir
--with-llvm-prefix=/usr/llvm/$dir \
 --enable-glx-tls --enable-texture-float --enable-debug --enable-vdpau
--disable-xvmc \
 --with-gallium-drivers=r600,radeonsi,swrast --with-dri-drivers= \
 --with-egl-platforms=x11,drm --enable-gles1 --enable-gles2

Marek


On Wed, Jun 24, 2015 at 4:40 AM, Brian Paul <brianp at vmware.com> wrote:
> On 06/23/2015 04:56 PM, Brian Paul wrote:
>>
>> On 06/23/2015 04:25 PM, Matt Turner wrote:
>>>
>>> On Tue, Jun 23, 2015 at 3:04 PM, Brian Paul <brianp at vmware.com> wrote:
>>>>
>>>> Otherwise, if we're trying to build a 32-bit Mesa on a 64-bit host
>>>> we wind up with -DUSE_X86_64_ASM, which is incorrect.
>>>> ---
>>>>   configure.ac | 2 +-
>>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/configure.ac b/configure.ac
>>>> index ddc757e..b12f5f9 100644
>>>> --- a/configure.ac
>>>> +++ b/configure.ac
>>>> @@ -605,7 +605,7 @@ if test "x$enable_asm" = xyes -a
>>>> "x$cross_compiling" = xyes; then
>>>>   fi
>>>>   # check for supported arches
>>>>   if test "x$enable_asm" = xyes; then
>>>> -    case "$host_cpu" in
>>>> +    case "$target_cpu" in
>>>>       i?86)
>>>>           case "$host_os" in
>>>>           linux* | *freebsd* | dragonfly* | *netbsd* | openbsd* | gnu*)
>>>> --
>>>> 1.9.1
>>>
>>>
>>> According to [1], host is "the machine that you are building for" and
>>> target is "the machine that GCC will produce code for". In the context
>>> of building GCC, I think this means that the resulting GCC binaries
>>> will run on $host and will produce code for $target. In the context of
>>> Mesa, I can't come up with a way that host != target makes sense.
>>>
>>> docs/autoconf.html suggests using --build=x86_64-pc-linux-gnu
>>> --host=i686-pc-linux-gnu to build on x86_64 for i686. Is that what
>>> you're doing?
>>
>>
>> Thanks for the pointer to the docs!  I forgot this was mentioned there.
>>   I basically had my --host and --build mixed up.
>>
>> Also, I was using "i686-linux-gnu" instead of "i686-pc-linux-gnu" (is
>> there really a difference)?
>>
>> Let me see how far I get now that you set me straight...
>
>
> OK, so the next problem is Mesa is trying to link with 64-bit libdrm instead
> of the 32-bit one.
>
> The command is:
>
> libtool: link: g++  -fPIC -DPIC -shared -nostdlib
> /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib32/crti.o
> /usr/lib/gcc/x86_64-linux-gnu/4.9/32/crtbeginS.o  -Wl,--whole-archive
> ../../.libs/libmesa.a common/.libs/libmegadriver_stub.a
> common/.libs/libdricommon.a common/.libs/libxmlconfig.a
> swrast/.libs/libswrast_dri.a -Wl,--no-whole-archive
> /usr/lib/x86_64-linux-gnu/libdrm.so -ludev /usr/lib/i386-linux-gnu/libdrm.so
> /usr/lib/x86_64-linux-gnu/libexpat.so -lpthread -ldl
> -L/usr/lib/gcc/x86_64-linux-gnu/4.9/32
> -L/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../i386-linux-gnu
> -L/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib32 -L/lib/i386-linux-gnu
> -L/lib/../lib32 -L/usr/lib/i386-linux-gnu -L/usr/lib/../lib32
> -L/usr/lib/gcc/x86_64-linux-gnu/4.9
> -L/usr/lib/gcc/x86_64-linux-gnu/4.9/../../.. -lstdc++ -lm -lc -lgcc_s
> /usr/lib/gcc/x86_64-linux-gnu/4.9/32/crtendS.o
> /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib32/crtn.o  -O0 -m32
> -Wl,-Bsymbolic -Wl,--gc-sections   -Wl,-soname -Wl,mesa_dri_drivers.so -o
> .libs/mesa_dri_drivers.so
> /usr/lib/x86_64-linux-gnu/libdrm.so: error adding symbols: File in wrong
> format
> collect2: error: ld returned 1 exit status
>
> Note near the middle:
>
> /usr/lib/x86_64-linux-gnu/libdrm.so
>
> shortly followed by:
>
> /usr/lib/i386-linux-gnu/libdrm.so
>
> That's after I added PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
> during configuring.  Without that, it only tries to link with the 64-bit
> libdrm.
>
> Any ideas?
>
>
> -Brian
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list