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

你。 提交于 2019-11-28 04:20:41

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.

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.

Robert J Berger

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

Had the same issue and running this command on terminal

xcode-select --install 

worked for me. Run this command after installing xQuartz.

If you need this to work in your CMake builds:

if(APPLE)
   include_directories(AFTER "/opt/X11/include")
endif()

That worked well for me.

I got it to install by copying the x11 header file directory to the /opt/local/include directory. Probably not the best way to work around it but quick and easy.

Since the make file is looking for X11/xlib.h i.e., it is looking for X11 folder in the current directory, one way to solve this problem is to simply copy the /opt/X11/include/X11 directory to the directory that contains make file.

I found this thread while trying to compile ffmpeg from source on OS X. I needed --enable-x11grab and the homebrew build does not support this option.

I had XQuartz installed already but I kept getting errors from ./configure: ERROR: Xlib not found. I thought the answers here would solve my problem, but they did not!

So, if anyone is ever in the same boat, my solution was this:

I opened up the generated config.log and found lots of errors referring to various includes and header files, including X11/Xlib.h - this is misleading. At the very bottom of the logfile was the key, pkg-config was complaining about looking for xbc.pc, and requested that it be put on the path. However, the error message that is displayed on the terminal says nothing about pkg-config or xbc!

The solution is to add to your PKG_CONFIG_PATH environment variable. Mine was nonexistent, so I just did export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig/ (the folder where I found xbc.pc).

I reran configure and everything worked like a charm!

TL;DR: check config.log - don't trust the terminal output!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!