Bug 54626

Summary: [PATCH] llvmpipe's Makefile: CXXFLAGS, CPPFLAGS and LDFLAGS are not properly propagated
Product: Mesa Reporter: Alexandre Demers <alexandre.f.demers>
Component: Mesa coreAssignee: Alexandre Demers <alexandre.f.demers>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Add missing CXXFLAGS
Fix llvmpipe crosscompilation

Description Alexandre Demers 2012-09-07 07:57:24 UTC
When building with --enable-32-bit, I end up with:

make[4]: Entering directory `/home/dema1701/projects/display/mesa/src/gallium/drivers/llvmpipe'
g++  -L/usr/lib32/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

Obviously, I encounter:
collect2: error: ld returned 1 exit status
make[4]: *** [lp_test_format] Error 1

This can easily be fixed by adding "-m32" to g++. Looking through the Makefile lets me think the flag is not properly propagated. Adding "-m32" at the end of LDFLAGS += $(LLVM_LDFLAGS) makes sense.	LLVM_LDFLAGS is defined as 	LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags` in configure.ac.

I don't know about --ldflags, but I'm sure there should be a $CFLASGS or $CCASFLAGS there.
Comment 1 Alexandre Demers 2012-09-28 06:30:25 UTC
A simple solution is to add $(CXXFLAGS) at the end of LDFLAGS += $(LLVM_LDFLAGS) in llvmpipe's Makefile. This gives:
LDFLAGS += $(LLVM_LDFLAGS) $(CXXFLAGS)

and it fixes the build.

Is it the right place to add it? Any comments?

Actually, I think the Makefile itself is wrong compared to others, like under r600.
Comment 2 Alexandre Demers 2012-12-18 03:40:40 UTC
Created attachment 71708 [details]
Add missing CXXFLAGS

Fixes cross compiling 32 bit on 64 bit for llvm driver.
Comment 3 Alexandre Demers 2013-01-11 04:52:21 UTC
Created attachment 72834 [details] [review]
Fix llvmpipe crosscompilation

It fixes architecture used by linker when using --enable-XY-bit options.

Please, review and commit (if the patch is OK). Thank you.
Comment 4 Matt Turner 2013-01-11 05:09:03 UTC
A bunch of automake patches were committed today. Did they fix this, maybe?
Comment 5 Alexandre Demers 2013-01-11 07:07:27 UTC
(In reply to comment #4)
> A bunch of automake patches were committed today. Did they fix this, maybe?

Well, forget that, I had this change for a while laying around and the day I put it correctly as a complete patch, we don't need it anymore. ;) It seems fine with the latest changes committed today. I'm closing this bug, it's invalid anymore.

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.