Bug 54326

Summary: When building 32 bit on 64 bit, many lib path variables are not pointing to 32 bit folders.
Product: Mesa Reporter: Alexandre Demers <alexandre.f.demers>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Makefile shows many libs located under 64bit folder instead of 32

Description Alexandre Demers 2012-08-31 14:39:11 UTC
Yesterday, after bug 54234 was fixed, I tried building mesa 32 bit on 64 bit (as I do at least twice a week). The build aborted after complaining about libkms.so being wrong (wrong architecture). Indeed, it had stopped after checking in my 64 bit lib folder, not in my 32 bit folder.

Could this be related to all the Automake patches landing in repo? I'll have to double check, but I'm pretty sure libdrm wasn't changed so it shouldn't come from that side.

I'll be adding the exact error message tonight.
Comment 1 Alexandre Demers 2012-09-01 04:08:24 UTC
Making all in gbm
make[2]: Entering directory `/home/dema1701/projects/display/mesa/src/gbm'
  CCLD     libgbm.la
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libudev.so when searching for -ludev
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libudev.a when searching for -ludev
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/librt.so when searching for -lrt
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/librt.a when searching for -lrt
/usr/lib/x86_64-linux-gnu/libkms.so: could not read symbols: File in wrong format
collect2: error: ld returned 1 exit status
make[2]: *** [libgbm.la] Error 1
Comment 2 Alexandre Demers 2012-09-01 04:11:50 UTC
Pretty sure the culprit commit is a669a5055eadae85ffa000cea19a2241d0699348:
gbm: Use libkms to replace DRI cursor images
Author Jakob Bornecrantz<jakob@vmware.com>
Author date 8/13/12 9:55 AM
Parent i965: Don't set iz_lookup the FS precompile's program key...
Child dri: Remove image write function
Branch master (build: Remove left over echo from GLU removal) 
Branch origin/master (build: Remove left over echo from GLU removal) 
Follows snb-magic (graw: Add struct pipe_surface forward declaration.)

    gbm: Use libkms to replace DRI cursor images
Comment 3 Alexandre Demers 2012-09-06 23:49:00 UTC
Changing 
libgbm_la_LIBADD = $(LIBUDEV_LIBS) $(LIBKMS_LIBS) $(DLOPEN_LIBS)
 to 
libgbm_la_LIBADD = $(LIBUDEV_LIBS) $(DLOPEN_LIBS) -L/usr/lib32/i386-linux-gnu/libkms.so
 in Makefile.am fixes the build. So $(LIBKMS_LIBS) is not defined properly in a previous script it seems.
Comment 4 Alexandre Demers 2012-09-06 23:54:13 UTC
Created attachment 66753 [details]
Makefile shows many libs located under 64bit folder instead of 32

Many paths point to 64bit libraries:
LIBDRM_CFLAGS = -I/usr/include/x86_64-linux-gnu -I/usr/include/x86_64-linux-gnu/libdrm  
LIBDRM_LIBS = -L/usr/lib/i386-linux-gnu/ -ldrm
LIBDRM_XORG_CFLAGS = -I/usr/include/x86_64-linux-gnu -I/usr/include/x86_64-linux-gnu/libdrm  
LIBDRM_XORG_LIBS = -L/usr/lib/x86_64-linux-gnu -ldrm  
LIBKMS_CFLAGS = -I/usr/include/x86_64-linux-gnu/libkms  
LIBKMS_LIBS = -L/usr/lib/x86_64-linux-gnu -lkms  
LIBKMS_XORG_CFLAGS = -I/usr/include/x86_64-linux-gnu/libkms  
LIBKMS_XORG_LIBS = -L/usr/lib/x86_64-linux-gnu -lkms  

However,
LIBUDEV_CFLAGS =  
LIBUDEV_LIBS = -ludev -lrt  
are correctly dynamically found and
LIB_DIR = i386-linux-gnu
points to the good lib folder.
Comment 5 Alexandre Demers 2012-09-07 04:20:54 UTC
OK, things are improving: by specifying
export PKG_CONFIG_PATH='/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig'
Like that, pkg-config will look in both directories to find whatever it needs (32bit or 64bit files). I'm now able to go through the libgbm.so build. However, I don't know how this should properly be fixed in the configure.ac file.

Now I hit a different wall with llvm where it goes through the specified folders, but can't find what it is looking for:

Making all in llvmpipe
make[4]: Entering directory `/home/dema1701/projects/display/mesa/src/gallium/drivers/llvmpipe'
g++  -L/usr/lib/llvm  -lpthread -lffi -ldl -lm  lp_test_format.o lp_test_main.o -o lp_test_format -Wl,--start-group  -L../../auxiliary/ -lgallium libllvmpipe.a -lLLVMMCJIT -lLLVMBitWriter -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMJIT -lLLVMRuntimeDyld -lLLVMExecutionEngine -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMObject -lLLVMCore -lLLVMSupport -L/usr/lib32 -lXext -lXdamage -lXfixes -lX11-xcb -lX11 -lxcb-glx -lxcb -lXxf86vm   -L/usr/lib/i386-linux-gnu/ -ldrm -lm -lpthread -ldl -Wl,--end-group
/usr/bin/ld: skipping incompatible /usr/lib32/libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib32/libpthread.a when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu//libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu//libpthread.a when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib32/libffi.so when searching for -lffi
/usr/bin/ld: skipping incompatible /usr/lib32/libffi.a when searching for -lffi
/usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu//libffi.so when searching for -lffi
/usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu//libffi.a when searching for -lffi
/usr/bin/ld: skipping incompatible /usr/lib32/libdl.so when searching for -ldl
/usr/bin/ld: skipping incompatible /usr/lib32/libdl.a when searching for -ldl
/usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu//libdl.so when searching for -ldl
/usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu//libdl.a when searching for -ldl
/usr/bin/ld: skipping incompatible ../../auxiliary//libgallium.a when searching for -lgallium
/usr/bin/ld: cannot find -lgallium
/usr/bin/ld: skipping incompatible /usr/lib32/libXext.so when searching for -lXext
/usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu//libXext.so when searching for -lXext
/usr/bin/ld: skipping incompatible /usr/lib32/libXdamage.so when searching for -lXdamage
/usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu//libXdamage.so when searching for -lXdamage
/usr/bin/ld: skipping incompatible /usr/lib32/libXfixes.so when searching for -lXfixes
/usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu//libXfixes.so when searching for -lXfixes
/usr/bin/ld: skipping incompatible /usr/lib32/libX11-xcb.so when searching for -lX11-xcb
/usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu//libX11-xcb.so when searching for -lX11-xcb
/usr/bin/ld: skipping incompatible /usr/lib32/libX11.so when searching for -lX11
/usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu//libX11.so when searching for -lX11
/usr/bin/ld: skipping incompatible /usr/lib32/libxcb-glx.so when searching for -lxcb-glx
/usr/bin/ld: skipping incompatible /usr/lib32/libxcb-glx.a when searching for -lxcb-glx
/usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu//libxcb-glx.so when searching for -lxcb-glx
/usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu//libxcb-glx.a when searching for -lxcb-glx
/usr/bin/ld: skipping incompatible /usr/lib32/libxcb.so when searching for -lxcb
/usr/bin/ld: skipping incompatible /usr/lib32/libxcb.a when searching for -lxcb
/usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu//libxcb.so when searching for -lxcb
/usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu//libxcb.a when searching for -lxcb
/usr/bin/ld: skipping incompatible /usr/lib32/libXxf86vm.so when searching for -lXxf86vm
/usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu//libXxf86vm.so when searching for -lXxf86vm
/usr/bin/ld: skipping incompatible /usr/lib32/libdrm.so when searching for -ldrm
/usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu//libdrm.so when searching for -ldrm
/usr/bin/ld: skipping incompatible /usr/lib32/libm.so when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib32/libm.a when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu//libm.so when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu//libm.a when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib32/libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib32/libpthread.a when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu//libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu//libpthread.a when searching for -lpthread
collect2: error: ld returned 1 exit status
make[4]: *** [lp_test_format] Error 1
Comment 6 Alexandre Demers 2012-09-07 04:24:52 UTC
Seems to be related to bug 36242. It seems the best solution is still a chroot environment.
Comment 7 Alexandre Demers 2012-09-07 07:39:40 UTC
Closing since defining PKG_CONFIG_PATH fixes the bug. llvmpipe has a different bug that is not related.

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.