This post is half aide-mémoire and half public service announcement! I use nmon at work to gather performance data, and I use customised version of nmon2web to graph it. nmon2web relies on rrdtool, and I do a lot of my UNIX stuff these days using Cygwin. Rather than use the Windows rrdtool binaries, I wanted to compile the latest version to run directly under Cygwin.
I’ve done this a few times now, with different Cygwin installs on both Windows XP and Windows 7, and every time I have to fight against various compilation issues. I’ll cut to the chase, I hack at options and compiler settings and configure flags until it works, and I turn off most of the additional stuff to get it in. But, it does work.
Get the Pre-requisites
All of the libraries and pre-requisites you need can be installed directly within Cygwin. You’ll obviously need the regular development stuff (gcc, make, etc.) and you’ll also need the various libraries used by rrdtool. Rather than worry about what you do and don’t need, I just whack on everything. This is what I’ve got installed for each of the pre-reqs.
- cairo (libcairo-devel, libcairo2)
- glib (glib, glib-devel, glib2, glib2-devel, libglib1.2-devel, libglib1.2_0, libglib2.0-devel, libglib2.0_0)
- libpng (libpng, libpng12, libpng14, libpng14-devel)
- libxml2 (libxml2, libxml2-devel)
- pango (libpango1.0-devel, libpango1.0_0, pango, pango-devel)
- zlib (zlib, zlib-devel)
- fontconfig (fontconfig, libfontconfig-devel, libfontconfig1)
- freetype (libfreetype-devel, libfreetype6)
- expat (expat, libexpat1, libexpat1-devel)
I’m certain that’s overkill, I had some of those installed already and installed a few extra libraries to get the compile working, but better safe than sorry!
The next step is working out what options to pass configure. Some of these are required (on Windows 7 there are issues if you don’t use -no-undefined)
configure doesn’t seem to find the pango and cairo libraries under Cygwin unless I add these.
export CPPFLAGS="-I /usr/include/pango-1.0/pango/ -I /usr/include/cairo/cairo/"
and as I said, you need to prevent any undefined symbols in the libraries,
and then I basically turn off all the additional modules (perl, tcl, python, ruby) as well as mmap which doesn’t seem to work well under Cygwin anyway. –prefix here is optional, it defaults to /opt, but I prefer everything under /usr/local.
./configure --disable-mmap --prefix=/usr/local/ --disable-tcl --disable-perl --disable-ruby --disable-python
Once that’s done, you can go for the compile.
Run the usual make, you’ll get a whole bunch of warnings. Such as,
warning: ‘optarg’ redeclared without dllimport attribute: previous dllimport ignored
No idea what they mean, but they don’t seem to break anything.
You’ll get a bunch of these,
*** Warning: linker path does not have real file for library -lstdc++. *** I have the capability to make that library automatically link in when *** you link to this library. But I can only do this if you have a *** shared version of the library, which you do not appear to have *** because I did check the linker path looking for a file starting *** with libstdc++ and none of the candidates passed a file format test *** using a file magic. Last file checked: /usr/lib/libpthread.a
because of the -no-undefined flag. But again, doesn’t seem to break anything.
On Windows 7 (can’t remember if I got this on Windows XP) you’ll also get,
CCLD rrdupdate.exe ../libtool: line 8354: ./rrdupdate.exe: Permission denied CC rrdcached-rrd_daemon.o
and you won’t be able to use rrdupdate.exe. Running it gives the same permission denied error. I’m not sure why yet, but I don’t use rrdupdate so it’s not been a big issue yet1.
Installing it all
Finally, after it all scrolls by, you can do a make install.
In /usr/local/bin you should end up with,
-rwxr-xr-x 1 User None 332K Jan 19 23:39 rrdcached.exe* -rwxr-xr-x 1 User None 428K Jan 19 23:39 rrdcgi.exe* -rwxr-xr-x 1 User None 641K Jan 19 23:39 rrdtool.exe* -rwxr-xr-x 1 User None 14K Jan 19 23:39 rrdupdate.exe*
and rrdtool should work quite happily.
So, know a better way? Know why some bits still don’t work? Know a sure fire way of fixing the warnings (if necessary), or getting rrdupdate to work, or being able to compile the additional modules? Let me know!
- this only appears to be an issue with 64 bit Windows 7 [↩]