Bug 35609

Summary: Mesa DRI fails to build for nouveau
Product: Mesa Reporter: jordan.yelloz+fdo
Component: Drivers/DRI/nouveauAssignee: Nouveau Project <nouveau>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Here's a one-line patch that makes it build for me.

Description jordan.yelloz+fdo 2011-03-23 17:44:35 UTC
Created attachment 44772 [details] [review]
Here's a one-line patch that makes it build for me.

I am using the latest mesa (commit 81992010b57e5b137c9319b47f282e267a086582).

I am configuring it with:
####################################################

./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --libdir=/usr/lib64 --enable-shared-dricore --disable-option-checking --with-driver=dri --disable-glut --without-demos --enable-xcb --disable-debug --enable-glw --enable-motif --enable-glx-tls --disable-asm --with-dri-drivers=,swrast,i810,i915,i965,nouveau,r600 --enable-gallium --with-state-trackers=glx,dri,egl,vega --enable-gallium-llvm --enable-gles1 --enable-gles2 --enable-gles-overlay --disable-gallium-svga --enable-gallium-nouveau --enable-gallium-i915 --enable-gallium-i965 --enable-gallium-radeon --enable-gallium-r600 --enable-gallium-i915 --enable-gallium-i965 --enable-gallium-radeon --enable-gallium-r600

####################################################

The error is:

####################################################

x86_64-pc-linux-gnu-gcc -c -I. -I../../../../../src/mesa/drivers/dri/common -Iserver -I../../../../../include -I../../../../../src/mapi -I../../../../../src/mesa -I../../../../../src/egl/main -I../../../../../src/egl/drivers/dri -I/usr/include/libdrm    -g -O2 -Wall -Wmissing-prototypes -std=c99 -ffast-math -fno-strict-aliasing  -fPIC   -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN -DUSE_XCB -DGLX_USE_TLS -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS -DHAVE_XCB_DRI2 -DHAVE_LIBUDEV -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS -DHAVE_LLVM=0x0208 -DUSE_DRICORE  nouveau_screen.c -o nouveau_screen.o
In file included from nouveau_screen.c:27:0:
nouveau_driver.h:41:28: fatal error: nouveau_device.h: No such file or directory
compilation terminated.
gmake[6]: *** [nouveau_screen.o] Error 1

####################################################


It looks like commit d1e28b22673777fe1290cda899abf73aad02e4aa (http://cgit.freedesktop.org/mesa/mesa/commit/?id=d1e28b22673777fe1290cda899abf73aad02e4aa) doesn't allow the CFLAGS set in the dri/nouveau/Makefile to be respected and I guess it needs to be updated to LIBDRM_CFLAGS.

Am I the only one who is experiencing this?
Comment 1 Francisco Jerez 2011-03-23 18:33:48 UTC
(In reply to comment #0)
> Created an attachment (id=44772) [details]
> Here's a one-line patch that makes it build for me.
> 
> I am using the latest mesa (commit 81992010b57e5b137c9319b47f282e267a086582).
> 
> I am configuring it with:
> ####################################################
> 
> ./configure --prefix=/usr --build=x86_64-pc-linux-gnu
> --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info
> --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib
> --libdir=/usr/lib64 --enable-shared-dricore --disable-option-checking
> --with-driver=dri --disable-glut --without-demos --enable-xcb --disable-debug
> --enable-glw --enable-motif --enable-glx-tls --disable-asm
> --with-dri-drivers=,swrast,i810,i915,i965,nouveau,r600 --enable-gallium
> --with-state-trackers=glx,dri,egl,vega --enable-gallium-llvm --enable-gles1
> --enable-gles2 --enable-gles-overlay --disable-gallium-svga
> --enable-gallium-nouveau --enable-gallium-i915 --enable-gallium-i965
> --enable-gallium-radeon --enable-gallium-r600 --enable-gallium-i915
> --enable-gallium-i965 --enable-gallium-radeon --enable-gallium-r600
> 
> ####################################################
> 
> The error is:
> 
> ####################################################
> 
> x86_64-pc-linux-gnu-gcc -c -I. -I../../../../../src/mesa/drivers/dri/common
> -Iserver -I../../../../../include -I../../../../../src/mapi
> -I../../../../../src/mesa -I../../../../../src/egl/main
> -I../../../../../src/egl/drivers/dri -I/usr/include/libdrm    -g -O2 -Wall
> -Wmissing-prototypes -std=c99 -ffast-math -fno-strict-aliasing  -fPIC  
> -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN -DUSE_XCB -DGLX_USE_TLS
> -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING
> -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS -DHAVE_XCB_DRI2 -DHAVE_LIBUDEV
> -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN -DGALLIUM_LLVMPIPE
> -D__STDC_CONSTANT_MACROS -DHAVE_LLVM=0x0208 -DUSE_DRICORE  nouveau_screen.c -o
> nouveau_screen.o
> In file included from nouveau_screen.c:27:0:
> nouveau_driver.h:41:28: fatal error: nouveau_device.h: No such file or
> directory
> compilation terminated.
> gmake[6]: *** [nouveau_screen.o] Error 1
> 
> ####################################################
> 
> 
> It looks like commit d1e28b22673777fe1290cda899abf73aad02e4aa
> (http://cgit.freedesktop.org/mesa/mesa/commit/?id=d1e28b22673777fe1290cda899abf73aad02e4aa)
> doesn't allow the CFLAGS set in the dri/nouveau/Makefile to be respected and I
> guess it needs to be updated to LIBDRM_CFLAGS.
> 
> Am I the only one who is experiencing this?

Hm, this doesn't make much sense to me. Did you remember to run "autogen.sh" and "configure" after that commit?
Comment 2 jordan.yelloz+fdo 2011-03-23 18:57:22 UTC
(In reply to comment #1)
> Hm, this doesn't make much sense to me. Did you remember to run "autogen.sh"
> and "configure" after that commit?

Well, in general I build it using Gentoo Portage and that does autoreconf (http://git.overlays.gentoo.org/gitweb/?p=proj/x11.git;a=blob;f=media-libs/mesa/mesa-9999.ebuild;h=bd4d163649427051aec4b9c771b671503b7f695c;hb=HEAD#l155) on a clean git export every time a build is attempted and that is where I first experienced this.

I then cloned my own copy of mesa and ran all of the autotools (autogen.sh and configure with the previously stated options) and I was able to reproduce the issue.

The problem I see is that src/mesa/drivers/dri/nouveau/Makefile modifies CFLAGS but it includes ../Makefile.template .
I'm not very experienced with make but it looks like that commit (d1e28b22673777fe1290cda899abf73aad02e4aa) redefined compiling C files without respecting the CFLAGS, instead using the new DRI_CFLAGS (see src/mesa/drivers/dri/Makefile.template:39).
This change seems to make src/mesa/drivers/dri/nouveau/Makefile:6 useless with regard to compiling each source file in the nouveau directory since libdrm' and libdrm_nouveau's includes directories are not searched anymore.
Comment 3 Себастьян Gliţa Κατινα 2011-03-24 02:56:53 UTC
DRI_GFLAGS comes from `configure.ac', so there is where one should append it with nouveau *.pc cflags (like DIR_DIRS); if not, look also in `configs/linux-dri', hence opt correctly for LIBDRM_CFLAGS.

*** This bug has been marked as a duplicate of bug 35441 ***

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.