Bug 38172

Summary: Mesa build errors using build.sh script
Product: Mesa Reporter: David <jdc843>
Component: OtherAssignee: mesa-dev
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description David 2011-06-10 17:39:06 UTC
I am using the build.sh script to install X.
I have modified the script to use local repository mirrors on my HDD.
However, the environment variable assignments of the script are
unchanged.

I have had a problem compiling mesa for the last year (at least).
The problem has to do with gcc not finding the X headers that were
installed by build.sh.
BTW, I have this problem when using ./configure|make|ETC without using
build.sh.

Without confusing you, let's just say that nouveau and gallium are
disabled because enabling those caused drm and mesa to fail to compile.
I had to butcher both drm and the mesa main makefiles to do that.
(The creator of build.sh is going to get my help passing options to
modules when I get my new system up and running.)
Though I think that I did have gallium enabled several months back when
I last installed X and I still had this same problem.

I have two errors that I'm reporting.

I am attaching a partial output from the make showing the errors.

Building to run Linux / i686 ()
Fri Jun 10 22:39:45 America 2011

Environment variables that build.sh sees :
Libdir = lib ??? set via build.sh. I don't know what it's for.
ACLOCAL = aclocal -I /opt/X/share/aclocal
PKG_CONFIG_PATH
= /opt/X/share/pkgconfig:/opt/X/lib/pkgconfig:/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/opt/X/lib/pkgconfig:/opt/GNOME/lib/pkgconfig:/opt/GNOME/share/pkgconfig:/usr/local/apr/lib/pkgconfig:/opt/QT/lib/pkgconfig
LD_LIBRARY_PATH
= /opt/X/lib:/lib:/usr/lib:/usr/local/lib:/opt/X/lib:/opt/GNOME/lib:/usr/local/apr/lib:/opt/JAVA/lib/i386:/srv/mysql/lib/mysql:/opt/QT/lib
PATH = /opt/X/bin:/bin:/usr/bin:/usr/local/bin:/opt/X/bin:/opt/GNOME/bin:/opt/JAVA/bin:/opt/QT/bin SHELL=/bin/bash
MAKEFLAGS=-j 1

======================================================================
==  Processing module/component:  "mesa/"
.
.
.
checking for X11... yes
checking for GLPROTO... yes
checking for LIBDRM... yes
checking for DRI2PROTO... yes
checking for XF86VIDMODE... yes
checking for DRIGL... yes
checking for LIBDRM_RADEON... yes
checking expat.h usability... yes
checking expat.h presence... yes
checking for expat.h... yes
checking for XML_ParserCreate in -lexpat... yes
checking for INTEL... yes
checking for LIBUDEV... yes
checking for XCB_DRI2... yes
checking for xcb_dri2_connect_alignment_pad in -lxcb-dri2... no
checking for GLW... yes
checking for GLUT... yes
checking for llvm-config... no <---- What is this ???
checking for XORG... no
configure: creating ./config.status
config.status: creating configs/autoconf
config.status: executing configs commands

        prefix:          /opt/X
        exec_prefix:     ${prefix}
        libdir:          /opt/X/lib
        includedir:      ${prefix}/include

        OpenGL:          yes (ES1: no ES2: no)
        OpenVG:          no

        Driver:          dri
        OSMesa:          no
        DRI drivers:     i810 i915 i965 mach64 mga r128 r200 r300 r600
        radeon savage sis tdfx unichrome swrast DRI driver dir:
        ${libdir}/dri Use XCB:         no
        Shared dricore:  no

        GLU:             yes
        GLw:             yes (Motif: no)
        glut:            yes

        EGL:             yes
        EGL platforms:   x11 drm
        EGL drivers:     builtin:egl_glx builtin:egl_dri2 egl_gallium
        EGL Gallium STs: $(GL_LIB)

        llvm:            no

        Gallium:         yes
        Gallium dirs:    auxiliary drivers state_trackers
        Target dirs:      egl
        Winsys dirs:     sw sw/xlib sw/dri
        Driver dirs:     softpipe failover galahad trace rbug noop
        identity Trackers dirs:   dri egl

        Shared libs:     yes
        Static libs:     no

        CFLAGS:          -g -O2 -Wall -Wmissing-prototypes -std=c99
        -ffast-math -fno-strict-aliasing -fPIC CXXFLAGS:        -g -O2
        -Wall -fno-strict-aliasing -fPIC Macros:          -D_GNU_SOURCE
        -DPTHREADS -DHAVE_POSIX_MEMALIGN -DUSE_EXTERNAL_DXTN_LIB=1
        -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING
        -DHAVE_ALIAS -DHAVE_LIBUDEV -DHAVE_XCB_DRI2
        -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN -DUSE_X86_ASM
        -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM

        PYTHON2:         python

        Run 'make' to build Mesa
.
.
.
make[3]: Entering directory
        `/home/david/sources/XSOURCES/mesa/src/egl/main'
        running /opt/X/bin/makedepend
/opt/X/bin/makedepend -fdepend
-I/usr/lib/gcc/i686-pc-linux-gnu/4.6.0/include
-I/usr/lib/gcc/i686-pc-linux-gnu/4.6.0/include-fixed
-D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN
-DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER
-DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS
-DHAVE_LIBUDEV -DHAVE_XCB_DRI2
-DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN -I../../../include \
eglapi.c eglarray.c eglconfig.c eglcontext.c eglcurrent.c 
egldisplay.c egldriver.c eglfallbacks.c eglglobals.c eglimage.c 
egllog.c eglmisc.c eglmode.c eglscreen.c eglstring.c 
eglsurface.c eglsync.c eglcompiler.h eglconfig.h eglcontext.h 
eglcurrent.h egldefines.h egldisplay.h egldriver.h eglglobals.h 
eglimage.h egllog.h eglmisc.h eglmode.h eglmutex.h eglscreen.h 
eglstring.h eglsurface.h eglsync.h > /dev/null 2>/dev/null
make[3]: Leaving directory
        `/home/david/sources/XSOURCES/mesa/src/egl/main'
make[3]: Entering directory
        `/home/david/sources/XSOURCES/mesa/src/egl/main'
gcc -c -I../../../include -g -O2 -Wall -Wmissing-prototypes -std=c99
-ffast-math -fno-strict-aliasing  -fPIC  -DUSE_X86_ASM
-DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -D_GNU_SOURCE
-DPTHREADS -DHAVE_POSIX_MEMALIGN -DUSE_EXTERNAL_DXTN_LIB=1
-DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING
-DHAVE_ALIAS -DHAVE_LIBUDEV -DHAVE_XCB_DRI2
-DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN -fvisibility=hidden
-D_EGL_OS_UNIX=1 -D_EGL_BUILT_IN_DRIVER_DRI2
-D_EGL_BUILT_IN_DRIVER_GLX
-D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_X11
-D_EGL_DRIVER_SEARCH_DIR=\"/opt/X/lib/egl\" eglapi.c -o eglapi.o
In file included from ../../../include/EGL/egl.h:36:0, from
        egltypedefs.h:6,
 from eglcontext.h:5,
 from eglapi.c:60: ../../../include/EGL/eglplatform.h:98:22:
 fatal error: X11/Xlib.h: No such file or directory
compilation terminated.
make[3]: *** [eglapi.o] Error 1


Problem : Can't find X11/Xlib.h :
6x Confirmed 10 Jun 2011 : /mesa/src/egl/main/Makefile :
Add -I/opt/X/include to INCLUDE_DIRS
Or Add $(X11_INCLUDES) to INCLUDE_DIRS

Did that and started over.
.
.
.
make[4]: Entering directory
`/home/david/sources/XSOURCES/mesa/src/gallium/state_trackers/egl'
rm -f depend
touch depend
/opt/X/bin/makedepend -fdepend
-I/usr/lib/gcc/i686-pc-linux-gnu/4.6.0/include
-I/usr/lib/gcc/i686-pc-linux-gnu/4.6.0/include-fixed -I.
-I../../../../src/gallium/include -I../../../../src/gallium/auxiliary
-I../../../../src/egl/main -I../../../../src/egl/wayland/wayland-drm/
-I../../../../include -I../../../../src/gallium/drivers
-I../../../../src/glx -I../../../../src/mapi -I../../../../src/mesa
-I/opt/X/include   -I/opt/X/include -I/opt/X/include/libdrm
-I../../../../src/gallium/winsys -I/opt/X/include
-I/opt/X/include/libdrm   -I../../../../src/gallium/winsys/sw
common/native_wayland_drm_bufmgr_helper.c common/egl_g3d_image.c
common/egl_g3d_st.c common/egl_g3d_api.c common/native_helper.c
common/egl_g3d.c common/egl_g3d_sync.c x11/native_ximage.c
x11/native_dri2.c x11/x11_screen.c x11/native_x11.c
x11/glxinit.c ../../../../src/glx/dri2.c drm/native_drm.c drm/modeset.c
fbdev/native_fbdev.c 2> /dev/null
make[4]: Leaving directory
`/home/david/sources/XSOURCES/mesa/src/gallium/state_trackers/egl'
make[4]: Entering directory
`/home/david/sources/XSOURCES/mesa/src/gallium/state_trackers/egl'
gcc -c -I. -I../../../../src/gallium/include
-I../../../../src/gallium/auxiliary -I../../../../src/egl/main
-I../../../../src/egl/wayland/wayland-drm/ -I../../../../include
-DHAVE_X11_BACKEND -DHAVE_DRM_BACKEND -D_GNU_SOURCE -DPTHREADS
-DHAVE_POSIX_MEMALIGN -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER
-DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS
-DHAVE_LIBUDEV -DHAVE_XCB_DRI2 -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN -g
-O2 -Wall -Wmissing-prototypes -std=c99 -ffast-math
-fno-strict-aliasing  -fPIC  -DUSE_X86_ASM -DUSE_MMX_ASM
-DUSE_3DNOW_ASM -DUSE_SSE_ASM -D_GNU_SOURCE -DPTHREADS
-DHAVE_POSIX_MEMALIGN -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER
-DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS
-DHAVE_LIBUDEV -DHAVE_XCB_DRI2 -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN
-fvisibility=hidden common/native_wayland_drm_bufmgr_helper.c -o
common/native_wayland_drm_bufmgr_helper.o
In file included from ../../../../include/EGL/egl.h:36:0,
 from common/native.h:29,
 from common/native_wayland_drm_bufmgr_helper.c:4:
../../../../include/EGL/eglplatform.h:98:22: fatal error: X11/Xlib.h:
No such file or directory
compilation terminated.
make[4]: *** [common/native_wayland_drm_bufmgr_helper.o]
Error 1
make[4]: Leaving directory
`/home/david/sources/XSOURCES/mesa/src/gallium/state_trackers/egl'
make[3]: *** [subdirs] Error 1


Problem : Can't find X11/Xlib.h :
3x confirmed 10 Jun
2011 : /mesa/src/gallium/state_trackers/egl/Makefile :
Add $(shell pkg-config --cflags-only-I x11) to common_INCLUDES.
That 'x' is NOT a typo. It is a lowercase x.


Did that and started over.
Compile successful.
I'm not finished installing X yet. But I've done it 2-3 times the last
few months so I'm sure that it will work. This is the last time BTW.

I've noticed that other problems finding X's includes and libraries
have been fixed over the last few years. I've hesitated to file this
bug report because I'm tired of hearing "Fix it yourself" or "Get a
decent distro". I can't see any difference between what I have and
Redhat,Slackware,ETC-based systems. Other than that I compile
everything myself. I'm not an automake/autoconf expert so I figured
that I'd let someone else do the bug reporting that is. But these two
problems remain and nobody seems to be fixing them. So I'm filing this
report.

Now, if someone could just tell me what gallium is and especially how
to get ATI's or nVidia's headers installed and get X and other apps to
use them, I'd appreciate it. Somebody needs to make a nice chart that
shows how the kernel, X, drm, mesa, cairo, ETC fit together. It won't
be me because I need the chart to figure it all out so that I can make
the chart. Which I then wouldn't have to make because someone already
did it :) Linux and circular dependancies go together like ham and
cheese. haha. Oh well.
Comment 1 Matt Turner 2012-08-18 06:29:00 UTC
This looks like you don't have the Xlib headers installed. I don't know what the problem is, but I don't think it's in Mesa's build system.
Comment 2 David 2012-08-18 09:11:23 UTC
This issue is NOT resolved.

Matt Turner wrote : "This looks like you don't have the Xlib headers installed."

Read what I wrote : "The problem has to do with gcc not finding the X headers that were installed by build.sh."

That means that the Xlib headers ARE installed. Every other package used by the build script can find those headers without problems. Only mesa has this problem.

Try it yourself. Use build.sh to install X into /opt/X

14 months to respond to my bug report. Someone must be busy. Better late than never :)
Comment 3 Dan Nicholson 2012-08-20 12:10:37 UTC
Have you tried this recently without setting INCLUDE_DIRS? The first one in src/egl/main/eglapi.c _should_ be fixed now since XCB_DRI2_CFLAGS are added when building this file and your log shows you got XCB_DRI2.

For the second one, I think a small patch is needed to make sure that WL_EGL_PLATFORM is defined when building for wayland. Otherwise eglplatform.h will fall 

diff --git a/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_hel
index 4365553..e38586b 100644
--- a/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c
+++ b/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c
@@ -7,6 +7,7 @@
 
 #ifdef HAVE_WAYLAND_BACKEND
 
+#include <wayland-egl.h>
 #include <wayland-server.h>
 #include <wayland-drm-server-protocol.h>
 
Can you try this fix? src/gallium/state_trackers/egl/Makefile looks like it might need some other fixes, too.
Comment 4 Dan Nicholson 2012-08-20 12:15:12 UTC
I'd also just like to quickly say that this situation creeps in frequently because almost everyone doing graphics development has /usr/include/X11/Xlib.h installed and doesn't notice when the build system is ignoring their just installed copy. So, it is helpful for you to report these issues to help them get resolved. We don't want to be preferring the system headers to the just installed headers.
Comment 5 Knut Petersen 2012-08-20 14:17:18 UTC
(In reply to comment #2)
> This issue is NOT resolved.
> 
> Matt Turner wrote : "This looks like you don't have the Xlib headers
> installed."
> 
> Read what I wrote : "The problem has to do with gcc not finding the X headers
> that were installed by build.sh."
> 
> That means that the Xlib headers ARE installed. Every other package used by the
> build script can find those headers without problems. Only mesa has this
> problem.
> 
> Try it yourself. Use build.sh to install X into /opt/X
> 
> 14 months to respond to my bug report. Someone must be busy. Better late than
> never 

I think Bug 37423 is a duplicate, but I cannot remember which configuration switches I changed at that time to solve the problem. Today I cannot verify that bug any longer, with my compile script definitely the right headers are included.

Add "-H" to CFLAGS CXXFLAGS, redirect everything to a file and use grep to find problems. If you build to a dir somewhere beneath /home, you could use e.g.

buildscript &> buildlog
cat buildlog | grep -n "/usr/include/X11" | grep -v home

As -H, -v and similar flags that increase the verbosity of gcc can break xorg module loading you probably have to include a Section "Module" somewhere in your configuration if you want to use the compiled server or you have to rebuild without those flags.

cu,
 Knut

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.