Bug 59737

Summary: [bisected] 0d108116bd80b757fb01a84a9f1946ef870b57b8 breaks osmesa when cross compiling
Product: Mesa Reporter: Alexandre Demers <alexandre.f.demers>
Component: Mesa coreAssignee: Matt Turner <mattst88>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: medium CC: mesa-dev
Version: git   
Hardware: All   
OS: All   
URL: http://lists.freedesktop.org/archives/mesa-dev/2013-January/033797.html
Whiteboard:
i915 platform: i915 features:

Description Alexandre Demers 2013-01-23 00:49:04 UTC
0d108116bd80b757fb01a84a9f1946ef870b57b8 is the first bad commit
commit 0d108116bd80b757fb01a84a9f1946ef870b57b8
Author: Matt Turner <mattst88@gmail.com>
Date:   Thu Jan 17 23:51:04 2013 -0800

    glsl/build: Build libglcpp and libglslcore in builtin_compiler
    
    And reuse them if not cross compiling.
    
    Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>


The error is as follow:
Making all in osmesa
make[5]: Entering directory `/home/dema1701/projects/display/mesa/src/mesa/drivers/osmesa'
  CXXLD    libOSMesa.la
/usr/bin/ld: i386:x86-64 architecture of input file `../../../../src/mesa/.libs/libmesa.a(ast_expr.o)' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `../../../../src/mesa/.libs/libmesa.a(ast_function.o)' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `../../../../src/mesa/.libs/libmesa.a(ast_to_hir.o)' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `../../../../src/mesa/.libs/libmesa.a(ast_type.o)' is incompatible with i386 output

I'm crosscompiling, building 32bit mesa on 64bit.
Comment 1 Matt Turner 2013-01-23 01:25:36 UTC
Now that all of the build system is converted to automake, we can do real cross compile builds:

CFLAGS="-m32" CXXFLAGS="-m32" ./configure --build=x86_64-pc-linux-gnu --host=i686-pc-linux-gnu

This works for me and builds a 32-bit OSMesa. Let me know if it does for you.
Comment 2 Alexandre Demers 2013-01-23 02:39:02 UTC
(In reply to comment #1)
> Now that all of the build system is converted to automake, we can do real
> cross compile builds:
> 
> CFLAGS="-m32" CXXFLAGS="-m32" ./configure --build=x86_64-pc-linux-gnu
> --host=i686-pc-linux-gnu
> 
> This works for me and builds a 32-bit OSMesa. Let me know if it does for you.

I'll try with the --build and --host options, however it was not needed before. Also, I'm wondering why they should be set if we have --enable-32-bit and --enable-64-bit options we can push at autogen.sh. These two options should take care of it. Otherwise, they are useless and they should be removed.
Comment 3 Matt Turner 2013-01-23 03:30:18 UTC
(In reply to comment #2)
> I'll try with the --build and --host options, however it was not needed
> before. Also, I'm wondering why they should be set if we have
> --enable-32-bit and --enable-64-bit options we can push at autogen.sh.

--build and --host is how autotools cross compiles.

> These
> two options should take care of it. Otherwise, they are useless and they
> should be removed.

They haven't worked in years, so.. :)
Comment 4 Alexandre Demers 2013-01-23 05:07:36 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > I'll try with the --build and --host options, however it was not needed
> > before. Also, I'm wondering why they should be set if we have
> > --enable-32-bit and --enable-64-bit options we can push at autogen.sh.
> 
> --build and --host is how autotools cross compiles.
> 
> > These
> > two options should take care of it. Otherwise, they are useless and they
> > should be removed.
> 
> They haven't worked in years, so.. :)

Good news, it works with the options. I've been able to remove other variables I had to set to make it work before. I still need to set LLVM_CONFIG though.

In the past, I was able to use --enable-XX-bit without any magic until about a year ago. Then, I added CFLAGS and CXXFLAGS with some paths for libraries. But if you tell me the options are broken and won't be fixed, I'm in favor of getting --enable-XX-bit out and documenting how to use the --build and --host options.

I think this bug can be closed, but devs should take position about getting rid of the --enable-XX-bit options.
Comment 5 Matt Turner 2013-01-30 20:42:14 UTC
Patch sent.
Comment 6 Matt Turner 2013-02-01 22:57:16 UTC
(In reply to comment #5)
> Patch sent.

... Anyone able to test the patch?
Comment 7 Alexandre Demers 2013-02-02 01:32:56 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > Patch sent.
> 
> ... Anyone able to test the patch?

Yes I can. What should be tested exactly?
Comment 8 Matt Turner 2013-02-02 01:50:23 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > (In reply to comment #5)
> > > Patch sent.
> > 
> > ... Anyone able to test the patch?
> 
> Yes I can. What should be tested exactly?

Testing that 32-bit builds work on 64-bit systems.
Comment 9 Alexandre Demers 2013-02-02 06:37:32 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > (In reply to comment #6)
> > > (In reply to comment #5)
> > > > Patch sent.
> > > 
> > > ... Anyone able to test the patch?
> > 
> > Yes I can. What should be tested exactly?
> 
> Testing that 32-bit builds work on 64-bit systems.

I should have been more precise: Do you mean I should test it without any CFLAGS="-m32", CXXFLAGS="-m32", --build=x86_64-pc-linux-gnu and --host=i686-pc-linux-gnu flags?
Comment 10 Matt Turner 2013-02-02 06:52:07 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > (In reply to comment #7)
> > > (In reply to comment #6)
> > > > (In reply to comment #5)
> > > > > Patch sent.
> > > > 
> > > > ... Anyone able to test the patch?
> > > 
> > > Yes I can. What should be tested exactly?
> > 
> > Testing that 32-bit builds work on 64-bit systems.
> 
> I should have been more precise: Do you mean I should test it without any
> CFLAGS="-m32", CXXFLAGS="-m32", --build=x86_64-pc-linux-gnu and
> --host=i686-pc-linux-gnu flags?

Oh, I see, sorry.

Try to build the way that you were when you encountered this problem,

CFLAGS="-m32" CXXFLAGS="-m32" ./configure --enable-32-bit
Comment 11 Alexandre Demers 2013-02-02 16:17:40 UTC
(In reply to comment #10)
> (In reply to comment #9)
> > (In reply to comment #8)
> > > (In reply to comment #7)
> > > > (In reply to comment #6)
> > > > > (In reply to comment #5)
> > > > > > Patch sent.
> > > > > 
> > > > > ... Anyone able to test the patch?
> > > > 
> > > > Yes I can. What should be tested exactly?
> > > 
> > > Testing that 32-bit builds work on 64-bit systems.
> > 
> > I should have been more precise: Do you mean I should test it without any
> > CFLAGS="-m32", CXXFLAGS="-m32", --build=x86_64-pc-linux-gnu and
> > --host=i686-pc-linux-gnu flags?
> 
> Oh, I see, sorry.
> 
> Try to build the way that you were when you encountered this problem,
> 
> CFLAGS="-m32" CXXFLAGS="-m32" ./configure --enable-32-bit

When going back to my previous command (the used when I reported this bug), it now works with your patch.
Comment 12 Matt Turner 2013-02-04 17:33:12 UTC
Committed.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.