Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xlib.h not found when building graphviz on Mac OS X 10.8 (Mountain Lion)

When using homebrew to install graphviz, the script gets to the point of "Making install in tkstubs" and then throws the following fatal error:

In file included from tkStubLib.c:15:
/usr/include/tk.h:78:11: fatal error: 'X11/Xlib.h' file not found
#include <X11/Xlib.h>

I have installed XQuartz as X11 has been dropped in Mountain Lion, but I'm unsure if it is installed correctly. The location of Xlib.h is:

/opt/X11/include/X11/Xlib.h

There are also two symlinks to /opt/X11, they are:

/usr/X11
/usr/X11R6

Does this look like the correct setup to you? I've never dealt with X11 or XQuartz until yesterday.

Cheers.

like image 515
AntBrown Avatar asked Jul 13 '12 06:07

AntBrown


4 Answers

After installing XQuartz you may add a symlink to your X11 installation folder by just entering

ln -s /opt/X11/include/X11 /usr/local/include/X11

in terminal. That will fix the problem as well without changing any ruby script.

like image 113
Daniel Münter Avatar answered Oct 14 '22 05:10

Daniel Münter


You need to tell the tkstubs build (and possibly other bits in the package as well) to look for headers in /opt/X11/include; this is not on the standard include path.

Usually this is achieved by passing -I/opt/X11/include as an additional compiler flag, the method to do so is however dependent on the build system.

For reasonably modern configure scripts, the best approach is to pass it in the environment variable CPPFLAGS; if the package uses another build system or this doesn't work for another reason, then you need to look at the Makefile in the build directory.

like image 32
Simon Richter Avatar answered Oct 14 '22 06:10

Simon Richter


You can enter in your shell before the compile/link (or brew) command:

export CPPFLAGS=-I/opt/X11/include

The export line will tell the compile/linker to look in /opt/X11/include for the X11 include files

like image 28
Robert J Berger Avatar answered Oct 14 '22 07:10

Robert J Berger


Had the same issue and running this command on terminal

xcode-select --install 

worked for me. Run this command after installing xQuartz.

like image 7
Abdul Jamil Avatar answered Oct 14 '22 07:10

Abdul Jamil