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

Brian Paul brianp at vmware.com
Tue Jun 23 19:40:36 PDT 2015


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



More information about the mesa-dev mailing list