Bug 82539

Summary: vmw_screen_dri.lo In file included from vmw_screen_dri.c:41: vmwgfx_drm.h:32:17: error: drm.h: No such file or directory
Product: Mesa Reporter: Vinson Lee <vlee>
Component: OtherAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: emil.l.velikov
Version: gitKeywords: bisected, regression
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Makefile

Description Vinson Lee 2014-08-13 01:18:38 UTC
mesa: 52901ec2615761390f5ef97b11516dae330d27d1 (master 10.3.0-devel)

$ ./autogen.sh --disable-dri --disable-egl --disable-gallium-llvm --with-dri-drivers=swrast --with-gallium-drivers=svga,swrast

$ make
[...]
  CC     vmw_screen_dri.lo
In file included from vmw_screen_dri.c:41:
vmwgfx_drm.h:32:17: error: drm.h: No such file or directory
Comment 1 Emil Velikov 2014-08-13 01:29:30 UTC
The only recent commit remotely possible of doing this is fd7da27a43182169e6306d9df39e7e9498e38d28. Can you please confirm ?

Where is drm.h located on your system ? Does libdrm.pc point to it ?
Comment 2 Vinson Lee 2014-08-13 18:41:00 UTC
fd7da27a43182169e6306d9df39e7e9498e38d28 is the first bad commit
commit fd7da27a43182169e6306d9df39e7e9498e38d28
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Wed Aug 13 00:00:50 2014 +0100

    automake: compact gallium/drivers and gallium/winsys makefiles
    
    Rather than having two separate almost empty and identical makefiles,
    compact them thus improving the configure and build time.
    Additionally this makes the automake build symmetrical to the scons
    and android one.
    
    v2: Rebase on top of vc4, compact drivers + winsys on a single line.
    
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
    Reviewed-by: Matt Turner <mattst88@gmail.com>

:100644 100644 2fc38ef709df6ecfef1b00ae35f2bad037d1fdf8 b4e32a70c7462866b689b4254c4ecd81e07b25cc M	configure.ac
:040000 040000 536ed7e80b32bab70fd3f4655d28c082a9c5c98e cda7dc4291e0b5a2bebd639eb85908af2c0d88da M	src
bisect run success
Comment 3 Vinson Lee 2014-08-13 19:06:55 UTC
drm.h is at /usr/include/drm/drm.h

$ pkg-config --cflags libdrm
-I/usr/include/drm
Comment 4 Emil Velikov 2014-08-13 20:10:18 UTC
Hmm I still don't see how this can even remotely happen. To make things even "better" it builds like a charm on my system :\

Can you attach src/gallium/winsys/svga/drm/Makefile and pastebin the output of
 $ make V=1
in while in src/gallium/winsys/svga/drm/ directory ?
Comment 5 Vinson Lee 2014-08-13 22:57:05 UTC
$ make V=1 -C src/gallium/winsys/svga/drm
make: Entering directory `mesa/src/gallium/winsys/svga/drm'
/bin/bash ../../../../../libtool  --tag=CC   --mode=compile gcc -DPACKAGE_NAME=\"Mesa\" -DPACKAGE_TARNAME=\"mesa\" -DPACKAGE_VERSION=\"10.3.0-devel\" -DPACKAGE_STRING=\"Mesa\ 10.3.0-devel\" -DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi\?product=Mesa\" -DPACKAGE_URL=\"\" -DPACKAGE=\"mesa\" -DVERSION=\"10.3.0-devel\" -DYYTEXT_POINTER=1 -DHAVE___BUILTIN_BSWAP32=1 -DHAVE___BUILTIN_BSWAP64=1 -DHAVE_DLADDR=1 -DHAVE_PTHREAD=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -I.    -I../../../../../src/gallium/drivers/svga -I../../../../../src/gallium/drivers/svga/include -I../../../../../src/gallium/drivers -I../../../../../include -I../../../../../src/gallium/include -I../../../../../src/gallium/auxiliary -DUSE_EXTERNAL_DXTN_LIB=1 -D_GNU_SOURCE -DHAVE_PTHREAD -DUSE_SSE41 -DDEBUG -DTEXTURE_FLOAT_ENABLED -DUSE_X86_64_ASM -DHAVE_DLOPEN -DHAVE_POSIX_MEMALIGN -DMESA_EGL_NO_X11_HEADERS -fvisibility=hidden  -g -O2 -Wall -std=c99 -Werror=implicit-function-declaration -Werror=missing-prototypes -fno-strict-aliasing -fno-builtin-memcmp  -std=gnu99 -D_FILE_OFFSET_BITS=64 -MT vmw_screen_dri.lo -MD -MP -MF .deps/vmw_screen_dri.Tpo -c -o vmw_screen_dri.lo vmw_screen_dri.c
libtool: compile:  gcc -DPACKAGE_NAME=\"Mesa\" -DPACKAGE_TARNAME=\"mesa\" -DPACKAGE_VERSION=\"10.3.0-devel\" "-DPACKAGE_STRING=\"Mesa 10.3.0-devel\"" "-DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\"" -DPACKAGE_URL=\"\" -DPACKAGE=\"mesa\" -DVERSION=\"10.3.0-devel\" -DYYTEXT_POINTER=1 -DHAVE___BUILTIN_BSWAP32=1 -DHAVE___BUILTIN_BSWAP64=1 -DHAVE_DLADDR=1 -DHAVE_PTHREAD=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -I. -I../../../../../src/gallium/drivers/svga -I../../../../../src/gallium/drivers/svga/include -I../../../../../src/gallium/drivers -I../../../../../include -I../../../../../src/gallium/include -I../../../../../src/gallium/auxiliary -DUSE_EXTERNAL_DXTN_LIB=1 -D_GNU_SOURCE -DHAVE_PTHREAD -DUSE_SSE41 -DDEBUG -DTEXTURE_FLOAT_ENABLED -DUSE_X86_64_ASM -DHAVE_DLOPEN -DHAVE_POSIX_MEMALIGN -DMESA_EGL_NO_X11_HEADERS -fvisibility=hidden -g -O2 -Wall -std=c99 -Werror=implicit-function-declaration -Werror=missing-prototypes -fno-strict-aliasing -fno-builtin-memcmp -std=gnu99 -D_FILE_OFFSET_BITS=64 -MT vmw_screen_dri.lo -MD -MP -MF .deps/vmw_screen_dri.Tpo -c vmw_screen_dri.c  -fPIC -DPIC -o .libs/vmw_screen_dri.o
In file included from vmw_screen_dri.c:41:
vmwgfx_drm.h:32:17: error: drm.h: No such file or directory
In file included from vmw_screen_dri.c:41:
vmwgfx_drm.h:701: error: field ‘base’ has incomplete type
In file included from vmw_screen_dri.c:42:
/usr/include/xf86drm.h:268: error: expected specifier-qualifier-list before ‘drm_context_t’
/usr/include/xf86drm.h:281: error: expected specifier-qualifier-list before ‘drm_handle_t’
/usr/include/xf86drm.h:546: error: expected declaration specifiers or ‘...’ before ‘drm_magic_t’
/usr/include/xf86drm.h:550: error: expected declaration specifiers or ‘...’ before ‘drm_handle_t’
/usr/include/xf86drm.h:552: error: expected declaration specifiers or ‘...’ before ‘drm_handle_t’
/usr/include/xf86drm.h:570: error: expected declaration specifiers or ‘...’ before ‘drm_magic_t’
/usr/include/xf86drm.h:572: error: expected declaration specifiers or ‘...’ before ‘drm_handle_t’
/usr/include/xf86drm.h:576: error: expected declaration specifiers or ‘...’ before ‘drm_handle_t’
/usr/include/xf86drm.h:577: error: expected declaration specifiers or ‘...’ before ‘drm_handle_t’
/usr/include/xf86drm.h:578: error: expected declaration specifiers or ‘...’ before ‘drm_context_t’
/usr/include/xf86drm.h:579: error: expected declaration specifiers or ‘...’ before ‘drm_handle_t’
/usr/include/xf86drm.h:585: error: expected declaration specifiers or ‘...’ before ‘drm_context_t’
/usr/include/xf86drm.h:586: error: expected declaration specifiers or ‘...’ before ‘drm_context_t’
/usr/include/xf86drm.h:588: error: expected declaration specifiers or ‘...’ before ‘drm_context_t’
/usr/include/xf86drm.h:590: error: expected declaration specifiers or ‘...’ before ‘drm_context_t’
/usr/include/xf86drm.h:591: error: expected declaration specifiers or ‘...’ before ‘drm_context_t’
/usr/include/xf86drm.h:592: error: expected declaration specifiers or ‘...’ before ‘drm_context_t’
/usr/include/xf86drm.h:593: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/include/xf86drm.h:594: error: expected ‘)’ before ‘*’ token
/usr/include/xf86drm.h:595: error: expected declaration specifiers or ‘...’ before ‘drm_context_t’
/usr/include/xf86drm.h:596: error: expected declaration specifiers or ‘...’ before ‘drm_context_t’
/usr/include/xf86drm.h:597: error: expected declaration specifiers or ‘...’ before ‘drm_drawable_t’
/usr/include/xf86drm.h:598: error: expected declaration specifiers or ‘...’ before ‘drm_drawable_t’
/usr/include/xf86drm.h:599: error: expected declaration specifiers or ‘...’ before ‘drm_drawable_t’
/usr/include/xf86drm.h:600: error: expected declaration specifiers or ‘...’ before ‘drm_drawable_info_type_t’
/usr/include/xf86drm.h:607: error: expected declaration specifiers or ‘...’ before ‘drm_handle_t’
/usr/include/xf86drm.h:617: error: expected declaration specifiers or ‘...’ before ‘drm_context_t’
/usr/include/xf86drm.h:619: error: expected declaration specifiers or ‘...’ before ‘drm_context_t’
/usr/include/xf86drm.h:621: error: expected declaration specifiers or ‘...’ before ‘drm_context_t’
/usr/include/xf86drm.h:622: error: expected declaration specifiers or ‘...’ before ‘drm_handle_t’
/usr/include/xf86drm.h:630: error: expected declaration specifiers or ‘...’ before ‘drm_handle_t’
/usr/include/xf86drm.h:631: error: expected declaration specifiers or ‘...’ before ‘drm_handle_t’
/usr/include/xf86drm.h:632: error: expected declaration specifiers or ‘...’ before ‘drm_handle_t’
/usr/include/xf86drm.h:634: error: expected declaration specifiers or ‘...’ before ‘drm_handle_t’
/usr/include/xf86drm.h:649: error: expected declaration specifiers or ‘...’ before ‘drm_handle_t’
/usr/include/xf86drm.h:650: error: expected declaration specifiers or ‘...’ before ‘drm_handle_t’
vmw_screen_dri.c:134: warning: ‘struct drm_clip_rect’ declared inside parameter list
vmw_screen_dri.c:134: warning: its scope is only this definition or declaration, which is probably not what you want
vmw_screen_dri.c: In function ‘vmw_dri1_intersect_src_bbox’:
vmw_screen_dri.c:139: error: dereferencing pointer to incomplete type
vmw_screen_dri.c:139: error: dereferencing pointer to incomplete type
vmw_screen_dri.c:139: error: dereferencing pointer to incomplete type
vmw_screen_dri.c:140: error: dereferencing pointer to incomplete type
vmw_screen_dri.c:141: error: dereferencing pointer to incomplete type
vmw_screen_dri.c:141: error: dereferencing pointer to incomplete type
vmw_screen_dri.c:141: error: dereferencing pointer to incomplete type
vmw_screen_dri.c:142: error: dereferencing pointer to incomplete type
vmw_screen_dri.c:146: error: dereferencing pointer to incomplete type
vmw_screen_dri.c:147: error: dereferencing pointer to incomplete type
vmw_screen_dri.c:149: error: dereferencing pointer to incomplete type
vmw_screen_dri.c:149: error: dereferencing pointer to incomplete type
vmw_screen_dri.c:149: error: dereferencing pointer to incomplete type
vmw_screen_dri.c:150: error: dereferencing pointer to incomplete type
vmw_screen_dri.c:151: error: dereferencing pointer to incomplete type
vmw_screen_dri.c:151: error: dereferencing pointer to incomplete type
vmw_screen_dri.c:151: error: dereferencing pointer to incomplete type
vmw_screen_dri.c:152: error: dereferencing pointer to incomplete type
vmw_screen_dri.c:156: error: dereferencing pointer to incomplete type
vmw_screen_dri.c:157: error: dereferencing pointer to incomplete type
vmw_screen_dri.c: In function ‘vmw_drm_surface_from_handle’:
vmw_screen_dri.c:261: error: implicit declaration of function ‘drmPrimeFDToHandle’
vmw_screen_dri.c: In function ‘vmw_drm_surface_get_handle’:
vmw_screen_dri.c:362: error: implicit declaration of function ‘drmPrimeHandleToFD’
vmw_screen_dri.c:362: error: ‘DRM_CLOEXEC’ undeclared (first use in this function)
vmw_screen_dri.c:362: error: (Each undeclared identifier is reported only once
vmw_screen_dri.c:362: error: for each function it appears in.)
make: *** [vmw_screen_dri.lo] Error 1
make: Leaving directory `mesa/src/gallium/winsys/svga/drm'
Comment 6 Vinson Lee 2014-08-13 22:58:37 UTC
Created attachment 104593 [details]
Makefile
Comment 7 Emil Velikov 2014-08-13 23:34:45 UTC
OK apart from hacking a ton of printfs into configure.ac there is one more thing which you can try:
Please revert 2af28040d639dddbb7c258981a00eaf3dfcbcf03 on top of master, cleanup everything (make clean && git clean -fxd) and give a bash ?
Comment 8 Emil Velikov 2014-08-14 14:59:51 UTC
The revert is already in master, so a fetch/rebase & test should suffice.
Thank you
Comment 9 Vinson Lee 2014-08-14 18:34:09 UTC
(In reply to comment #8)
> The revert is already in master, so a fetch/rebase & test should suffice.
> Thank you

The same build error occurs. The error also occurs on FreeBSD. Perhaps the error occurs with an older libdrm?
Comment 10 Emil Velikov 2014-08-14 23:06:36 UTC
It seems to me that you disable every possible user for the svga driver yet you want to build it. Can you list the libraries that a successful build produces ?
Comment 11 Emil Velikov 2014-08-28 14:11:30 UTC
In case the previous came as "your fault not mine".

There are some loose things in our current build, but in order to fix it properly I would need to now what the expected result of the described build config is. Otherwise another 10+ bug-reports are likely to appear.
Comment 12 Emil Velikov 2014-09-09 20:27:02 UTC
While vmwgfx does not depend on libdrm for their header, they do depend on it for the normal headers as well as linking purposes. The following commit should appropriately error out.

commit 40bb6f93139971a459dadf88d6dfc05791071e37
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Fri Sep 5 14:06:20 2014 +0100

    configure: bail out if building svga without libdrm

    With recent commit we removed the NEED_NONNULL_WINSYS checks when
    selecting the hardware (inc svga) winsys. svga has only one winsys
    that explicitly requires libdrm (via it's bundled version of
    vmwgfx_drm.h) but configure.ac never really checks for it.

    Add the check early to prevent people from shooting themselves when
    they select the driver but lack libdrm.

    $ ./autogen.sh --disable-dri --disable-egl --disable-gallium-llvm
    --with-dri-drivers=swrast --with-gallium-drivers=svga,swrast

    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82539
    Cc: "10.2 10.3" <mesa-stable@lists.freedesktop.org>
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>

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.