Bug 47967

Summary: gallium driver svga doesn't compile with LIBDRM_LIBS=-L/usr/lib/x86_64-linux-gnu/
Product: Mesa Reporter: Alexandre Demers <alexandre.f.demers>
Component: OtherAssignee: mesa-dev
Status: RESOLVED NOTABUG QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Alexandre Demers 2012-03-27 15:53:19 UTC
When specifying --with-gallium-drivers=r600,swrast,svga, I'm able to compile correctly. However, when I specifying "export LIBDRM_LIBS=-L/usr/lib/x86_64-linux-gnu/" before building, the svga driver is unable to compile and results in the following error:

make[3]: Entering directory `/home/dema1701/projects/display/mesa/src/gallium/targets/dri-vmwgfx'
../Makefile.dri:110: depend: No such file or directory
rm -f depend
touch depend
/usr/bin/makedepend -fdepend -I/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.3/include -I/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.3/include-fixed -DGALLIUM_RBUG -DGALLIUM_TRACE -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/x86_64-linux-gnu -I/usr/include/x86_64-linux-gnu/libdrm    target.c vmw_powf.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
make[3]: Leaving directory `/home/dema1701/projects/display/mesa/src/gallium/targets/dri-vmwgfx'
make[3]: Entering directory `/home/dema1701/projects/display/mesa/src/gallium/targets/dri-vmwgfx'
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/x86_64-linux-gnu -I/usr/include/x86_64-linux-gnu/libdrm    -g -O2 -Wall -std=c99 -Werror=implicit-function-declaration -Werror=missing-prototypes -fno-strict-aliasing -fno-builtin-memcmp -m64 -g -O2  -fPIC  -DUSE_X86_64_ASM -D_GNU_SOURCE -DPTHREADS -DTEXTURE_FLOAT_ENABLED -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_XEXTPROTO_71 -fvisibility=hidden -DGALLIUM_RBUG -DGALLIUM_TRACE target.c -o target.o
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/x86_64-linux-gnu -I/usr/include/x86_64-linux-gnu/libdrm    -g -O2 -Wall -std=c99 -Werror=implicit-function-declaration -Werror=missing-prototypes -fno-strict-aliasing -fno-builtin-memcmp -m64 -g -O2  -fPIC  -DUSE_X86_64_ASM -D_GNU_SOURCE -DPTHREADS -DTEXTURE_FLOAT_ENABLED -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_XEXTPROTO_71 -fvisibility=hidden -DGALLIUM_RBUG -DGALLIUM_TRACE vmw_powf.c -o vmw_powf.o
/bin/sh ../../../../bin/mklib -o vmwgfx_dri.so.tmp -noprefix -linker 'g++' -ldflags '' \
	target.o vmw_powf.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/state_trackers/dri/drm/libdridrm.a ../../../../src/gallium/winsys/svga/drm/libsvgadrm.a ../../../../src/gallium/winsys/sw/wrapper/libwsw.a ../../../../src/gallium/drivers/trace/libtrace.a ../../../../src/gallium/drivers/rbug/librbug.a ../../../../src/gallium/drivers/svga/libsvga.a \
                -Wl,--start-group ../../../../src/mesa/libmesagallium.a ../../../../src/gallium/auxiliary/libgallium.a -Wl,--end-group \
                  -L../../../../x86_64-linux-gnu -Wl,-R/usr/lib/x86_64-linux-gnu/dri -ldricore -lglsl  -L/usr/lib/x86_64-linux-gnu/ -lexpat -lm -lpthread -ldl 
mklib: Making Linux shared library:  vmwgfx_dri.so.tmp
g++ -g -O2 -Wall -std=c99 -Werror=implicit-function-declaration -Werror=missing-prototypes -fno-strict-aliasing -fno-builtin-memcmp -m64 -g -O2  -fPIC  -DUSE_X86_64_ASM -D_GNU_SOURCE -DPTHREADS -DTEXTURE_FLOAT_ENABLED -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_XEXTPROTO_71 -fvisibility=hidden -o vmwgfx_dri.so.test ../../../../src/mesa/drivers/dri/common/dri_test.o vmwgfx_dri.so.tmp  -L../../../../x86_64-linux-gnu -Wl,-R/usr/lib/x86_64-linux-gnu/dri -ldricore -lglsl  -L/usr/lib/x86_64-linux-gnu/ -lexpat -lm -lpthread -ldl ;
vmwgfx_dri.so.tmp: undefined reference to `drmFreeVersion'
vmwgfx_dri.so.tmp: undefined reference to `drmCommandRead'
vmwgfx_dri.so.tmp: undefined reference to `drmCommandWriteRead'
vmwgfx_dri.so.tmp: undefined reference to `drmGetVersion'
vmwgfx_dri.so.tmp: undefined reference to `drmCommandWrite'
collect2: ld returned 1 exit status
make[3]: *** [vmwgfx_dri.so] Error 1


I tried removing manually "-L/usr/lib/x86_64-linux-gnu/", but the error was still happening.

However, if I remove svga from the gallium drivers list and recompile with the export still in place, I'm able to finish compiling correctly.
Comment 1 Alexandre Demers 2012-03-27 21:41:34 UTC
By the way, you'll have understood by now that whatever you export into LIBDRM_LIBS breaks the build.
Comment 2 Michel Dänzer 2012-03-28 00:10:53 UTC
As the name implies, LIBDRM_LIBS should contain any flags necessary for linking libdrm. According to the output of

 grep LIBDRM_LIBS *

in my Mesa tree, you need to add at least -ldrm to it.
Comment 3 Alexandre Demers 2012-03-28 11:48:13 UTC
While I understand the possible need for -Ldrm, why would it be the only driver behaving like that? I mean, shouldn't the use of LIBS_LIBDRM=-L... replace the need for -Ldrm in a way, as it does for other drivers?

I'll be testing this solution later at home.
Comment 4 Alexandre Demers 2012-03-28 20:57:26 UTC
Confirmed, I understood what you meant (have both -L... and -ldrm exported).
Thanks.

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.