I am trying to compile rrdtool from the source package. I don't use RPM packages, so don't ask me to install packages ;)

I compile all the required software before rrdtool according to http://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html

./configure of rrdtool is OK.

But when I do make I got the following error :

      CC     rrdcached-rrd_daemon.o
rrd_daemon.c:108:27: erreur: glib-2.0/glib.h : Aucun fichier ou dossier de ce type
rrd_daemon.c:246: erreur: expected â=â, â,â, â;â, âasmâ or â__attribute__â before â*â token
rrd_daemon.c: In function âadd_response_infoâ:
rrd_daemon.c:540: attention : implicit declaration of function âva_startâ
rrd_daemon.c:540: attention : nested extern declaration of âva_startâ
rrd_daemon.c:546: attention : implicit declaration of function âva_endâ
rrd_daemon.c:546: attention : nested extern declaration of âva_endâ

glib-2.0/glib.h exist in my system, in /usr/local/glib-2.34.0/glib/glib.h

I set up env variable PKG_CONFIG_PATH which contain glib's path. /usr/local/glib-2.34.0/lib/pkgconfig/

I saw some topic about it but nothing for my case.

Looking in config.log everything seems Ok!

1 Answer 1


"Aucun fichier ou dossier de ce type" == "No such file or directory"

PKG_CONFIG_PATH contains (non-default) paths to add in order to find extra .pc files, not the packages themselves. If you have the correct .pc file in that directory it should work.

Check the output of:

pkg-config --cflags --libs glib-2.0

(with and without setting PKG_CONFIG_PATH)

It should show your glib-2.0 install path for includes & libraries, this is mine, installed to /usr/local/:

-I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include  \
-L/usr/local/lib -lglib-2.0

If it's wrong then check the .pc file.

However, the path you give for glib.h looks more like it's just the unpacked source, not a complete installation of glib-2.0. Did you have glib-2.0 installed and built already? If you are building it following the instructions URL then it does not seem correct, and you need to repeat that step.

There's no reason not to do a normal configure/make/install of some of these packages to /usr/local, especially glib-2.0, zlib, libpng, libXML2 -- unless they conflict with something you already have installed.

The logic behind the RRDtool build document is to build everything under /tmp and install everything under /opt to make it as self-contained as possible. While it's likely to be a reasonably robust method, there are some drawbacks to it (including the requirement to set various magic environment variables).

Update: the problem is the install path of glib-2.0 is conflicting with the includes used in rrdtool . When you install it to /usr/local/glib-2.34.0/ the .pc is built to specify an include directory of /usr/local/glib-2.34.0/include/glib-2.0. This path already contains the sub-directory glib-2.0 so when rrdtool tries to include <glib-2.0/glib.h> it fails. I believe this to be an rrdtool issue, it is masked when glib-2.0 is installed to an "expected" place under /usr or /usr/local (and presumably when you use the build guideline paths exactly).

If you install to /usr/local, an include path of /usr/local/include will cause "#include <glib-2.0/glib.h>" to work correctly.

As a fix I suggest either building and installing all the dependencies in /usr/local (then you only need to set PKG_CONFIG_PATH=/usr/local/lib/pkgconfig) or following the rrdtool build instructions exactly, or you can set CFLAGS to where you installed glib-2.0 before you run configure, e.g.:

export CFLAGS="-I/usr/local/glib-2.34.0/include"

(i.e. one directory above that reported by pkg-config --cflags glib-2.0)

You can see better what's going on if the compile breaks by running:


just after an error, the commands used will be retried and printed this time, so you can check the gcc -I flags.

OK, Found a bug report, it's fixed (though the title "Fix build with non-standard glib location" is slightly misleading). There has been no new stable release since then though. FWIW, there are several unanswered questions on the user list that seem to be this same problem.

  • Thank you for your answer. PKG_CONFIG_PATH seems to be correctly configured, as if I set it empty, I get "Package glib-2.0 was not found in the pkg-config search path". I checked that my glib-2.0 is correctly build and installed : no problem. Any other idea ? All the software I built has been added to PKG_CONFIG_PATH. any other idea ?
    – Hugo
    Commented Mar 14, 2013 at 13:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .