-   Linux From Scratch (
-   -   Error with Mesalib (

spiky0011 04-03-2011 04:54 PM

Error with Mesalib
I have a problem with mesalib. Blfs Chapter23 using live cd

mklib: Making Linux shared library:
g++ -O2 -Wall -Wmissing-prototypes -std=c99 -ffast-math -fvisibility=hidden -fno-strict-aliasing  -fPIC  -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN -DUSE_XCB -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS -DHAVE_XCB_DRI2 -DHAVE_LIBUDEV -o ../../../../src/mesa/drivers/dri/common/dri_test.o  -ldrm  -lexpat -lm -lpthread -ldl -ltalloc  ;
mv -f
/usr/bin/install -c ../../../../lib/gallium
make[3]: Leaving directory `/home/martyn/Downloads/xc/Mesa-7.9/src/gallium/targets/dri-swrast'
make[2]: Leaving directory `/home/martyn/Downloads/xc/Mesa-7.9/src/gallium/targets'
make[1]: Leaving directory `/home/martyn/Downloads/xc/Mesa-7.9/src'
make[1]: Entering directory `/home/martyn/Downloads/xc/Mesa-7.9/xdemos'
gcc -L../lib -lGL -o glxinfo glxinfo.c
glxinfo.c:41:19: fatal error: GL/gl.h: No such file or directory
compilation terminated.
make[1]: *** [glxinfo] Error 1
make[1]: Leaving directory `/home/martyn/Downloads/xc/Mesa-7.9/xdemos'
make: *** [default] Error 1

I got this error while doing

sed 's@FLAGS=\"-g@FLAGS=\"@' -i configure &&
patch -Np1 -i ../MesaLib-7.9-add_xdemos-1.patch &&
./configure $XORG_CONFIG --enable-xcb &&

I also found other errors in config log regarding xorg server missing. I tried to install xorg server but got more errors, I didn't think it needed the server as a dependency

druuna 04-04-2011 12:45 AM


First thing I noticed: Why are you still using the liveCD?

Once you finish LFS you have a fully bootable and working LFS. Do use the newly build LFS and build BLFS on top of that. The problem could be related to this (not 100% sure though).

Did you check if the required dependencies are (correctly) installed and did you check the User Notes.

The message about the missing Xorg server is strange (it isn't installed yet, that is done a few chapters later), but it could be that that specific error can be ignored.

Hope this helps.

spiky0011 04-04-2011 03:54 AM

I,m not using live cd it was for reference sorry for miss leading. I will check the previous packages. I thought the server error strange as not installed yet

spiky0011 04-04-2011 12:24 PM

I take it I have to go through the log files and check for errors, Will the errors be at the end of log? Anything else i need to check

druuna 04-04-2011 12:51 PM


As shown in the error message posted GL/gl.h is missing, if I look at the Xorg Protocol Headers chapter $XORG_PREFIX/include/GL/ is mentioned.

I do believe that GL/gl.h is part of Xorg Protocol Headers. Check if it is present on your system. If it is not you know something went wrong with the build of the Xorg Protocol Headers.

Hope this helps.

spiky0011 04-04-2011 03:29 PM

Ok I checked /usr/include/GL dir the files where there

thing to be done for `install-exec-am'.
test -z "/usr/include/GL" || /bin/mkdir -p "/usr/include/GL"
/usr/bin/install -c -m 644 glxint.h glxmd.h glxproto.h glxtokens.h '/usr/include/GL'
test -z "/usr/include/GL/internal" || /bin/mkdir -p "/usr/include/GL/internal"
 /usr/bin/install -c -m 644 glcore.h '/usr/include/GL/internal'
test -z "/usr/lib/pkgconfig" || /bin/mkdir -p "/usr/lib/pkgconfig"
 /usr/bin/install -c -m 644 glproto.pc '/usr/lib/pkgconfig'
make[1]: Leaving directory `/home/martyn/Downloads/xc/proto/glproto-1.4.12'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for a sed that does not truncate output... /bin/sed
configure: creating ./config.status
config.status: creating Makefile
config.status: creating glproto.pc

This is from the log, As far as I can tell the files are all there, even pkgconfig is in lib dir, so where to go now? Maybe redo Protocol headers???

spiky0011 04-04-2011 04:59 PM

Found this in mesa log

nclude <inttypes.h>
| #endif
| #ifdef HAVE_STDINT_H
| # include <stdint.h>
| #endif
| #ifdef HAVE_UNISTD_H
| # include <unistd.h>
| #endif
| #include <udis86.h>
configure:8483: result: no
configure:8483: checking udis86.h presence
configure:8483: gcc -E  conftest.c
conftest.c:10:20: fatal error: udis86.h: No such file or directory
compilation terminated.
configure:8483: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "Mesa"
| #define PACKAGE_TARNAME "mesa"
| #define PACKAGE_VERSION "7.9.0"
| #define PACKAGE_STRING "Mesa 7.9.0"

Dose this help in anyway???

Is it worth trying another version?

druuna 04-05-2011 12:28 AM


One thing that came to mind: You use/used the pdf book and the package versions mentioned in that document. Are you still using the pdf book or are you now (partially??) using the on-line version of the BLFS book?

I'm asking because the version in the pdf book might differ from those on-line. Make sure you use the package versions from one document (using the on-line version changes on a very regular base). Stick to the combination of versions mentioned in one specific book.

If you checked $XORG_PREFIX/include/GL/ and the files are there then that part should be correct (not taking the above into account).

I would not focus on the error you posted in post #7, that is not what stopped the make step posted in post #1.

Not much to go on, but maybe it helps.

spiky0011 04-05-2011 11:49 AM

I,m thinking of starting Chapter 23 again, At 1st I was using PDF book then had trouble with protocal headers due to other things so maybe that might help. I did change to the online book when you pointed it out.

druuna 04-05-2011 12:10 PM


Originally Posted by spiky0011 (Post 4314751)
I,m thinking of starting Chapter 23 again, At 1st I was using PDF book then had trouble with protocal headers due to other things so maybe that might help. I did change to the online book when you pointed it out.

That might be a good idea.

Do remember that:

- You already have a partial installed X by now. You might want to remove what has been installed this far (not all that easy). I think you can safely remove the content of: /usr/include/X11, /usr/include/GL and /usr/lib/X11. There is more, but if you want to delete those you need to check the "Contents" parts of all X you have done this far, locate them and remove them.

- The on-line book does change regularly (mainly the package versions). Do check if the version are what they need to be!

Hope you have more luck this time.

Coelacanth 04-06-2011 08:55 AM

Hi there,

I have had the exact same problem for some time, and stopped working on my system for a while. Just got back to it today, and I think I have it resolved.

It looks to me like a bug in the Mesalib package, but that might be a misinterpretation on might part - just a thought, please don't flame too badly if I'm wrong.

But, the X protocol headers does indeed establish the /usr/include/GL directory (assuming a default XORG_CONFIG of /usr here), but it looks to me like the gl.h header file comes from the Mesalib package itself. But it is also needed to compile the xdemos part of Mesalib, so if you don't have it installed :(

The work around that seemed to work for me is, run the "make" command until it crashes, which is in xdemos, and is towards the end of the build process. Then run "make install", which installs gl.h, and then builds the missing packages, this time without error (since gl.h is now installed).

I guess people aren't having this problem because they have an old version of mesalib installed, so there is already a gl.h file in the proper place? (Possibly a wrong version, but maybe this is a file that doesn't change much over time?)

Just my thoughts. It seems to have worked for me, and I am now on the next dependency failure :( If I have built a hopelessly compromised, unstable, or insecure system by this process, then I am blissfully unaware of the fact.

Hope that helps.

Coelacanth 04-06-2011 09:26 AM

Update - it may be a little more complicated than I realized. I tried to replicate the compile, after removing the /usr/include/GL directory, and although my procedure got me further, it did eventually hit a point where both make and make install would fail, and alternating the two commands made no forward progress. So I think while mucking about, I must have done something that fixed the problem, without realizing what it was, or how to replicate it.

But in any event, just repeatedly running "make", and each time it fails, copying the missing header manually from the Mesalib build directory into /usr/include/GL, seems to do the trick. A rather inelegant solution - I wonder if just installing without the demos, then compiling and installing the demos, would work.

Coelacanth 04-06-2011 10:38 AM

Here is another solution.

spiky0011 04-06-2011 01:56 PM

I removed Mesa-7.9 dir then untar again. I tried this copy gl.h to /usr/include/GL then when I run command

sed 's@FLAGS=\"-g@FLAGS=\"@' -i configure &&
patch -Np1 -i ../MesaLib-7.9-add_xdemos-1.patch &&
./configure $XORG_CONFIG --enable-xcb &&

I get an error

patching file Makefile
The next patch would create the file xdemos/glxgears.c
which already exsists Skipping patch.
1 out of 1 hunk ignored
patching file Makefile
The next patch would create the file xdemos/glxinfo.c
which already exsists Skipping patch.
1 out of 1 hunk ignored
patching file Makefile
The next patch would create the file xdemos/Makefile,
which already exsists Skipping patch.
1 out of 1 hunk ignored

So I,m thinking running the above command without

sed 's@FLAGS=\"-g@FLAGS=\"@' -i configure &&
./configure $XORG_CONFIG --enable-xcb &&

Any thoughts on this?

Coelacanth 04-06-2011 08:11 PM

Are you absolutely sure the Mesalib source tree was removed? Or is it possible the patch command was run twice?

I saw this one several times when mucking around. Even if you untar the source file again, if the old source tree was still there, then the files created by the patch command the last time around are still there, and you get the error you described. Removing the source tree and starting again will do the trick. I think if you just ignore the error and continue, you should be OK, but maybe fully removing the source tree and starting from the beginning is safer.

I think I have to revoke my earlier conclusion that it is a bug in Mesalib, it seems to be a problem with this patch file. It creates the xdemos files, which assume the headers (such as gl.h) are already installed, but if you build xdemos at the same time as Mesalib, they aren't installed.

In any event, I just tried the alternative on a clean (i.e., no Mesalib already installed) system, and it seems to work. After unpacking the tar, and running the patch, edit the makefile in Mesa-lib*/xdemos. For the two commands to compile the c files, just add the option -I($TOP)/include. That seems to do it.

All times are GMT -5. The time now is 03:46 PM.