Bug 61318

Summary: Can't compile GLU 32bit on 64bit
Product: Mesa Reporter: Alexandre Demers <alexandre.f.demers>
Component: GLUAssignee: mesa-dev
Status: RESOLVED WORKSFORME QA Contact:
Severity: critical    
Priority: medium    
Version: git   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Alexandre Demers 2013-02-22 23:42:36 UTC
When crosscompiling, building GLU 32 bit on 64 bit system fails:
  CXXLD    libGLU.la
/usr/lib/x86_64-linux-gnu/libGL.so: could not read symbols: File in wrong format
collect2: error: ld returned 1 exit status
make: *** [libGLU.la] Error 1

I use the following to build:
if [ "$BUILD32" = "true" ]; then
	echo "Building 32 bit"
	export CFLAGS='-m32'
	export CXXFLAGS='-m32'
	export LLVM_CONFIG='/usr/bin/llvm-config32'
	./autogen.sh --build=x86_64-pc-linux-gnu --host=i686-pc-linux-gnu --prefix=/usr --libdir=/usr/lib/i386-linux-gnu --includedir=/usr/include/i386-linux-gnu
fi

	make -j $NUM_THREADS
Comment 1 Matt Turner 2013-02-23 01:14:47 UTC
I built with both

CFLAGS="-m32" CXXFLAGS="-m32" ./autogen.sh --prefix=/usr --libdir=/usr/lib32 --build=x86_64-pc-linux-gnu --host=i686-pc-linux-gnu

and

CFLAGS="-m32" CXXFLAGS="-m32" ./autogen.sh --prefix=/usr --libdir=/usr/lib32

locally and it works. This is some kind of problem local to you.
Comment 2 Matt Turner 2013-02-23 01:14:57 UTC
I built with both

CFLAGS="-m32" CXXFLAGS="-m32" ./autogen.sh --prefix=/usr --libdir=/usr/lib32 --build=x86_64-pc-linux-gnu --host=i686-pc-linux-gnu

and

CFLAGS="-m32" CXXFLAGS="-m32" ./autogen.sh --prefix=/usr --libdir=/usr/lib32

locally and it works. This is some kind of problem local to you.
Comment 3 Alexandre Demers 2013-02-23 06:23:24 UTC
(In reply to comment #2)
> I built with both
> 
> CFLAGS="-m32" CXXFLAGS="-m32" ./autogen.sh --prefix=/usr --libdir=/usr/lib32
> --build=x86_64-pc-linux-gnu --host=i686-pc-linux-gnu
> 
> and
> 
> CFLAGS="-m32" CXXFLAGS="-m32" ./autogen.sh --prefix=/usr --libdir=/usr/lib32
> 
> locally and it works. This is some kind of problem local to you.

Maybe you can help me identify my problem then.

Doing ldconfig -p | grep libGL.so returns
	libGL.so.1 (libc6,x86-64, OS ABI: Linux 2.4.20) => /usr/lib/libGL.so.1
	libGL.so.1 (libc6) => /usr/lib32/libGL.so.1
	libGL.so (libc6,x86-64, OS ABI: Linux 2.4.20) => /usr/lib/libGL.so
	libGL.so (libc6) => /usr/lib32/libGL.so

so the linker knows it exists. Everything is where it is expected to be from what I can see. Any clue where I should dig?
Comment 4 Alexandre Demers 2013-02-23 06:50:58 UTC
I've found out what is wrong. By comparing Makefile with another project, it seems GL_LIBS is defined as GL_LIBS = -L/usr/lib/x86_64-linux-gnu -lGL, but it should only be GL_LIBS = -lGL. If GL_LIBS was only defined as -lGL, it would work for both 32 and 64 bit (tested).
Comment 5 Tapani Pälli 2013-02-25 07:08:37 UTC
This sounds to me like a libtool issue, bug #50754 has possible fix you could try for this.
Comment 6 Alexandre Demers 2013-02-25 14:56:43 UTC
(In reply to comment #5)
> This sounds to me like a libtool issue, bug #50754 has possible fix you
> could try for this.

For now, I'm just setting PKG_CONFIG_PATH to the 32 bit or the 64 bit path as needed. However, I know by default both my paths are set in the PKG_CONFIG_PATH variable and I was a trick I used to fix a similar problem with mesa.

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.