Bug 52136

Summary: Mesa fails to link r600_dri.so with LLVM
Product: Mesa Reporter: Niels Ole Salscheider <niels_ole>
Component: Drivers/Gallium/r600Assignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: niels_ole, vcunat
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Full build log
Full build log

Description Niels Ole Salscheider 2012-07-16 07:06:18 UTC
Created attachment 64258 [details]
Full build log

When I try to build Mesa, it fails with the following error:


make[3]: Entering directory `/var/tmp/paludis/build/x11-dri-mesa-scm/work/C/64/mesa-scm/src/gallium/targets/dri-r600'
rm -f depend
touch depend
/usr/bin/makedepend -fdepend -I/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.1/include -I/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.1/include-fixed -DGALLIUM_RBUG -DGALLIUM_TRACE -DGALLIUM_NOOP -I. -I../../../../src/mesa/drivers/dri/common -Iserver -I../../../../include -I../../../../include/GL/internal -I../../../../src/mapi -I../../../../src/gallium/include -I../../../../src/gallium/auxiliary -I../../../../src/gallium/drivers -I../../../../src/gallium/winsys -I../../../../src/mesa -I../../../../src/mesa/main -I../../../../src/mesa/math -I../../../../src/mesa/transform -I../../../../src/mesa/shader -I../../../../src/mesa/swrast -I../../../../src/mesa/swrast_setup -I../../../../src/egl/main -I../../../../src/egl/drivers/dri -I/usr/include/libdrm    target.c ../../../../src/mesa/drivers/dri/common/utils.c ../../../../src/mesa/drivers/dri/common/dri_util.c ../../../../src/mesa/drivers/dri/common/xmlconfig.c  \
         2> /dev/null
../Makefile.dri:110: depend: No such file or directory
make[3]: Leaving directory `/var/tmp/paludis/build/x11-dri-mesa-scm/work/C/64/mesa-scm/src/gallium/targets/dri-r600'
make[3]: Entering directory `/var/tmp/paludis/build/x11-dri-mesa-scm/work/C/64/mesa-scm/src/gallium/targets/dri-r600'
x86_64-pc-linux-gnu-gcc -c -I. -I../../../../src/mesa/drivers/dri/common -Iserver -I../../../../include -I../../../../include/GL/internal -I../../../../src/mapi -I../../../../src/gallium/include -I../../../../src/gallium/auxiliary -I../../../../src/gallium/drivers -I../../../../src/gallium/winsys -I../../../../src/mesa -I../../../../src/mesa/main -I../../../../src/mesa/math -I../../../../src/mesa/transform -I../../../../src/mesa/shader -I../../../../src/mesa/swrast -I../../../../src/mesa/swrast_setup -I../../../../src/egl/main -I../../../../src/egl/drivers/dri -I/usr/include/libdrm    -march=native -pipe -O2 -Wall -std=c99 -Werror=implicit-function-declaration -Werror=missing-prototypes -fno-strict-aliasing -fno-builtin-memcmp -m64 -march=native -pipe -O2  -fPIC  -D_GNU_SOURCE -DPTHREADS -DTEXTURE_FLOAT_ENABLED -DUSE_X86_64_ASM -DHAVE_POSIX_MEMALIGN -DIN_DRI_DRIVER -DUSE_XCB -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_TLS -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DHAVE_ALIAS -DHAVE_MINCORE -DHAVE_LIBUDEV -DHAVE_LLVM=0x0301 -fvisibility=hidden -DGALLIUM_RBUG -DGALLIUM_TRACE -DGALLIUM_NOOP target.c -o target.o
/bin/sh ../../../../bin/mklib -o r600_dri.so.tmp -noprefix -linker 'x86_64-pc-linux-gnu-g++' -ldflags ' -L/usr/lib   -ldl -lpthread' \
        target.o ../../../../src/mesa/drivers/dri/common/utils.o ../../../../src/mesa/drivers/dri/common/dri_util.o ../../../../src/mesa/drivers/dri/common/xmlconfig.o   ../../../../src/gallium/drivers/r600/libr600.a ../../../../src/gallium/state_trackers/dri/drm/libdridrm.a ../../../../src/gallium/winsys/radeon/drm/libradeonwinsys.a ../../../../src/gallium/drivers/trace/libtrace.a ../../../../src/gallium/drivers/rbug/librbug.a ../../../../src/gallium/drivers/noop/libnoop.a \
                -Wl,--start-group ../../../../src/mesa/libmesagallium.a ../../../../src/gallium/auxiliary/libgallium.a -Wl,--end-group \
                  ../../../../lib64/libdricore8.1.0.so  -ldrm   -lexpat -lm -lpthread -ldl -ldrm_radeon -lLLVMBitWriter -lLLVMX86AsmParser -lLLVMX86Disassembler -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMJIT -lLLVMRuntimeDyld -lLLVMExecutionEngine -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMObject -lLLVMCore -lLLVMSupport -lLLVMInstrumentation -lLLVMLinker -lLLVMArchive -lLLVMBitReader -lLLVMipo -lLLVMVectorize -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMObject -lLLVMCore -lLLVMSupport -lLLVMAsmParser -lLLVMBitReader -lLLVMCore -lLLVMSupport
mklib: Making Linux shared library:  r600_dri.so.tmp
x86_64-pc-linux-gnu-g++ -march=native -pipe -O2 -Wall -std=c99 -Werror=implicit-function-declaration -Werror=missing-prototypes -fno-strict-aliasing -fno-builtin-memcmp -m64 -march=native -pipe -O2  -fPIC  -D_GNU_SOURCE -DPTHREADS -DTEXTURE_FLOAT_ENABLED -DUSE_X86_64_ASM -DHAVE_POSIX_MEMALIGN -DIN_DRI_DRIVER -DUSE_XCB -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_TLS -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DHAVE_ALIAS -DHAVE_MINCORE -DHAVE_LIBUDEV -DHAVE_LLVM=0x0301 -fvisibility=hidden -o r600_dri.so.test ../../../../src/mesa/drivers/dri/common/dri_test.o r600_dri.so.tmp  ../../../../lib64/libdricore8.1.0.so  -ldrm   -lexpat -lm -lpthread -ldl -ldrm_radeon  -L/usr/lib   -ldl -lpthread;
make[3]: Leaving directory `/var/tmp/paludis/build/x11-dri-mesa-scm/work/C/64/mesa-scm/src/gallium/targets/dri-r600'
r600_dri.so.tmp: undefined reference to `llvm::isCurrentDebugType(char const*)'
r600_dri.so.tmp: undefined reference to `typeinfo for llvm::SelectionDAGISel'
r600_dri.so.tmp: undefined reference to `typeinfo for llvm::TargetInstrInfoImpl'
r600_dri.so.tmp: undefined reference to `typeinfo for llvm::TargetPassConfig'
r600_dri.so.tmp: undefined reference to `typeinfo for llvm::MCAsmInfo'
r600_dri.so.tmp: undefined reference to `typeinfo for llvm::TargetSubtargetInfo'
r600_dri.so.tmp: undefined reference to `typeinfo for llvm::LLVMTargetMachine'
r600_dri.so.tmp: undefined reference to `typeinfo for llvm::MachineFunctionInfo'
r600_dri.so.tmp: undefined reference to `typeinfo for llvm::TargetFrameLowering'
r600_dri.so.tmp: undefined reference to `llvm::DebugFlag'
r600_dri.so.tmp: undefined reference to `typeinfo for llvm::MachineFunctionPass'
r600_dri.so.tmp: undefined reference to `typeinfo for llvm::TargetIntrinsicInfo'
r600_dri.so.tmp: undefined reference to `typeinfo for llvm::TargetRegisterInfo'
r600_dri.so.tmp: undefined reference to `typeinfo for llvm::TargetLowering'
collect2: error: ld returned 1 exit status
make[3]: *** [r600_dri.so] Error 1

I have attached the full build log.
Comment 1 Tom Stellard 2012-07-16 13:41:13 UTC
I've seen this before.  The problem is mismatched CXXFLAGS in mesa and llvm.  The typeinfo errors are caused the -fno-rtti flag (or the absence of it) and the isCurrentDebugType and DebugFlag errors are cause by -DNDEBUG.  The problem with -DNDEBUG is that LLVM defines DNDEBUG in public headers, so if you compiled LLVM with it, you have have to compile Mesa with it as well.

If you play with your configure flags you should be able to get this to work.  I'll try to look into a proper solution when I get a chance.
Comment 2 Tom Stellard 2013-11-13 00:24:18 UTC
Is this still an issue?
Comment 3 Niels Ole Salscheider 2013-11-16 13:10:03 UTC
This used to work, but it seems to be broken again since ce8eadb6e8adc24f675b364e0620dbf1c9e079a8:

libtool: link: x86_64-pc-linux-gnu-g++  -fPIC -DPIC -shared -nostdlib /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/crtbeginS.o  .libs/egl.o .libs/egl_pipe.o .libs/egl_st.o  -Wl,--whole-archive ../../../../src/gallium/auxiliary/.libs/libgallium.a ../../../../src/gallium/drivers/identity/.libs/libidentity.a ../../../../src/gallium/drivers/trace/.libs/libtrace.a ../../../../src/gallium/drivers/rbug/.libs/librbug.a ../../../../src/gallium/state_trackers/egl/.libs/libegl.a ../../../../src/gallium/winsys/sw/xlib/.libs/libws_xlib.a ../../../../src/gallium/winsys/sw/wayland/.libs/libws_wayland.a ../../../../src/egl/wayland/wayland-drm/.libs/libwayland-drm.a ../../../../src/mesa/.libs/libmesagallium.a ../../../../src/gallium/state_trackers/vega/.libs/libvega.a ../../../../src/gallium/winsys/radeon/drm/.libs/libradeonwinsys.a ../../../../src/gallium/drivers/r600/.libs/libr600.a ../../../../src/gallium/winsys/radeon/drm/.libs/libradeonwinsys.a ../../../../src/gallium/drivers/radeonsi/.libs/libradeonsi.a ../../../../src/gallium/drivers/softpipe/.libs/libsoftpipe.a ../../../../src/gallium/drivers/llvmpipe/.libs/libllvmpipe.a -Wl,--no-whole-archive  -Wl,-rpath -Wl,/var/tmp/paludis/build/x11-dri-mesa-scm/work/C/64/src/egl/main/.libs -Wl,-rpath -Wl,/var/tmp/paludis/build/x11-dri-mesa-scm/work/C/64/src/gbm/.libs -Wl,-rpath -Wl,/usr/lib64/../lib64 -Wl,-rpath -Wl,/var/tmp/paludis/build/x11-dri-mesa-scm/work/C/64/src/mapi/shared-glapi/.libs -Wl,-rpath -Wl,/var/tmp/paludis/build/x11-dri-mesa-scm/work/C/64/src/mapi/vgapi/.libs -Wl,-rpath -Wl,/usr/lib64/../lib64 -L/var/tmp/paludis/build/x11-dri-mesa-scm/work/C/64/src/gbm/.libs -L/var/tmp/paludis/build/x11-dri-mesa-scm/work/C/64/src/mapi/shared-glapi/.libs -L/usr/lib64 ../../../../src/egl/main/.libs/libEGL.so -L/usr/lib64/../lib64 /usr/lib64/libX11-xcb.so /usr/lib64/libxcb-dri2.so /usr/lib64/libxcb-xfixes.so /usr/lib64/libxcb-render.so /usr/lib64/libxcb-shape.so /var/tmp/paludis/build/x11-dri-mesa-scm/work/C/64/src/gbm/.libs/libgbm.so /usr/lib64/libXext.so /usr/lib64/libXfixes.so /usr/lib64/libX11.so /usr/lib64/libxcb.so /usr/lib64/libXau.so /usr/lib64/libXdmcp.so ../../../../src/gbm/.libs/libgbm.so /usr/lib64/libudev.so /usr/lib64/libwayland-client.so /usr/lib64/libwayland-server.so /usr/lib64/../lib64/libffi.so /var/tmp/paludis/build/x11-dri-mesa-scm/work/C/64/src/mapi/shared-glapi/.libs/libglapi.so ../../../../src/mapi/shared-glapi/.libs/libglapi.so ../../../../src/mapi/vgapi/.libs/libOpenVG.so -lelf /usr/lib64/libdrm_radeon.so /usr/lib64/libdrm.so -lrt -ldl -lcurses -lpthread -lz -lLLVMR600CodeGen -lLLVMR600Desc -lLLVMR600Info -lLLVMR600AsmPrinter -lLLVMOption -lLLVMIRReader -lLLVMBitReader -lLLVMAsmParser -lLLVMInstrumentation -lLLVMLinker -lLLVMipo -lLLVMVectorize -lLLVMMCJIT -lLLVMBitWriter -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMJIT -lLLVMRuntimeDyld -lLLVMExecutionEngine -lLLVMCodeGen -lLLVMObjCARCOpts -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMObject -lLLVMCore -lLLVMSupport -L/usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2 -L/usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/../../.. /usr/lib64/../lib64/libstdc++.so -lm -lc -lgcc_s /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/crtendS.o /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/../../../../lib64/crtn.o  -march=native -O2 -m64 -Wl,--no-undefined -Wl,--allow-multiple-definition -Wl,/var/tmp/paludis/build/x11-dri-mesa-scm/work/mesa-scm/src/gallium/targets/egl-static/egl.link -Wl,--rpath-link -Wl,/lib64 -Wl,--rpath-link -Wl,/lib64 -Wl,--rpath-link -Wl,/lib64   -pthread -Wl,-soname -Wl,egl_gallium.so -o .libs/egl_gallium.so
../../../../src/gallium/auxiliary/.libs/libgallium.a(lp_bld_debug.o):(.data.rel.ro._ZTI17raw_debug_ostream[_ZTI17raw_debug_ostream]+0x10): undefined reference to `typeinfo for llvm::raw_ostream'
../../../../src/gallium/auxiliary/.libs/libgallium.a(lp_bld_debug.o):(.data.rel.ro._ZTI18BufferMemoryObject[_ZTI18BufferMemoryObject]+0x10): undefined reference to `typeinfo for llvm::MemoryObject'
../../../../src/gallium/auxiliary/.libs/libgallium.a(lp_bld_debug.o):(.data.rel.ro._ZTIN4llvm14format_object1ImEE[_ZTIN4llvm14format_object1ImEE]+0x10): undefined reference to `typeinfo for llvm::format_object_base'
collect2: error: ld returned 1 exit status
Comment 4 Niels Ole Salscheider 2013-11-16 13:13:54 UTC
Created attachment 89316 [details]
Full build log
Comment 5 Jan Vesely 2017-02-01 01:54:55 UTC
I'm pretty sure this one builds and links OK.

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.