Compiling rrdtool on Cygwin

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!

configure options

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,

export LDFLAGS=-no-undefined

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.

Compiling

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 yet ((this only appears to be an issue with 64 bit Windows 7)).

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.

Finished!

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!

NetFlix in the UK – going to be any good?

So, I know it’s early days, but NetFlix has just opened it’s doors in the UK and quite frankly, I thought they would have had a better line up to open with.

For the most part, the TV selection falls into four categories – old stuff of varying quality (Cracker, Fawlty Towers, 12 episodes of Men Behaving Badly), huge amounts of Kids TV and Animated stuff (Moschops, Thomas and Friends, X-Men), TV comedy shows like Saturday Night Live and a small, tiny amount of ‘new’ stuff (Dollhouse).

The movies don’t fare much better.  It’s not easy to list every movie, but here are the 2010-2011 movies on Netflix in various categories (this is every movie the interface returns, in that category for that year).

Action & Adventure 2010 & 2011

  • Blitz
  • Drive Angry
  • Delhi Belly
  • Thor: Tales of Asgard
  • Woochi
  • Shaolin
  • Red Hill
  • Fists of Rage
  • The Expendables
  • Little Big Soldier
  • Locked Down
  • Gotti the Mob Boss
  • Jackie Chan and the Kung Fu Kid
  • 71: Into the Fire
  • Nude Nuns With Big Guns
  • Rakht Charitra
  • Special Ops
  • Tees Maar Khan

Sci-Fi & Fantasy 2010 & 2011

  • Dead Space: Aftermath
  • Woochi
  • Area 51
  • Ticking Clock
  • The Disappearance of Haruhi Suzumiya
  • Hunter Prey

Thrillers 2010 & 2011

  • Blitz
  • Ticking Clock
  • Red Hill
  • Buried
  • My Soul to Take
  • The Disappearance of Haruhi Suzumiya
  • Winter in Wartime
  • Stone
  • Pimp
  • Raajneeti
  • House Under Siege

Maybe I’m missing something?  I mean, Blitz shows up on the main page which is a 2011 movie, but I can’t get it to show up on the basic lists, so perhaps I am missing something, but it still looks like a pretty lame opening gambit from NetFlix.   Unless they significantly improve the content very quickly and provide a more comprehensive way of listing movies (such as the simple LoveFilm A-Z view), I’ll be hard pushed to justify signing up.

Update: Aha, typically, after posting this I worked out what I was doing wrong.  You have to tell it to list things you’ve already seen in the summary lists.  I’ve added some items into the list, in italics, where they were missing first time.

16 days in

My first post of 2012 was a bit whiny, so I thought I’d give you a slightly less whiny update!

Grete’s glasses broke at the end of 2011

Grete got her second set of corrected new glasses on Friday, and she’s very happy with them.  They look great, are very lightweight and have super thin lenses.  She’s much happier!

Grete has a bad back.

And now it’s a lot better!  Still painful, but getting back to her ‘usual painful’ level which is as good as it gets I guess.

My hacked VPS

Tidied up and resolved so far.  Everyone gets hacked eventually, such is the way of things.

Work

Meh.

Bubbles going walkabout

Well you already know she came back as if nothing was wrong, and she’s maintained that stance.  She’s still being bullied by Fizz but that whole relationship is weird anyway.

New Stuff

So that’s all good.  For fun though, the little Atom PC I bought last year from Novatech decided to die at the end of last week (internal 2.5″ drive now making mechanical ‘I’m not happy’ sounds).  I mailed Novatech, and they’ve given me a returns number.  So, we’ll see if they continue to live up to my expectations of them.

First post …

… of 2012 anyway.  If the quality of your year to come is inversely proportional to the quality of the first 14 days, we’ve got a stonkingly awesome 2012 to come.  To be fair, as with all things, the ups and downs in life are all relative.

Grete’s glasses broke at the end of 2011, she can’t see much without them.  Although she had a spare pair, they were tinted and not really suitable in the house or driving in Winter!  Thanks to the holiday period it was pretty fraught trying to get to an optician, but we did.  Sadly, they messed up and the glasses she eventually got have the wrong prescription, so now she’s waiting for them to be redone.  The original glasses broke at the joint between the arm and the spring, so I was cello-taping them together every day and Grete was living with nightmarish headaches.  The opticians we went to, to get new glasses, said they couldn’t be fixed – however when she went in to the local one to see why the new glasses were terrible, an older optician there was able to temporarily put a new arm on the broken ones while the correct new ones are being delivered.  All-in-all, a pretty stressful start to the New Year, which you can appreciate if you have vision which absolutely requires glasses.

Grete has a bad back, has had for a long time, which she copes with day to day, but every now and again she’ll get a muscle spasm and be basically unable to stand-up.  She got one on Saturday night, worst one for a few years, so we’re dealing with that!  She managed to get to the doctor today and has some pretty impressive pain killers, and they’re starting to help.

Yesterday, the VPS I host these blogs on was not responding.  It happens sometimes, the server doesn’t have a huge deal of memory and every now and then the Linux OOM Killer will kill something unimportant like apache2 or mysql.  So I recycled it via Gandi.net’s control panel thing and it came back.  A cursory check suggested everything was fine, and I went about my business.  Today I logged on briefly and found a lot of weird mail.  Turns out the server was hacked a few days ago – using an exploit in a PHP module a slightly out of date template on WordPress was using.  Fortunately, they hadn’t done too much damage, and were mostly using this server to attack other servers.  I got a nice abuse report from Gandi (which was polite, but forceful) while I was actually cleaning up the mess, encouraging me to clean up and reminding me of my legal obligations.  Anyway, I think it’s sorted, but I feel kind of bad, somewhat violated, a little paranoid and sorry that something I manage was used to attack other sites.  But it’s the Internet, everyone gets hacked eventually.  My top tip?  If you’re not using a plugin or theme, delete it.  You’ll forget about it otherwise, it won’t get patched, and just because you’re not using it, doesn’t mean the file isn’t there to be presented by the web browser when the right attacker comes along.

There’s some work related stress, which I won’t talk about, because I try not to on my blog, but it’s there, lurking.

Then finally for the first 9 days of 2012, there’s Bubbles.  She went out at around 11am yesterday.  As you know, it’s been Super Mild other than the wind here.  Yesterday was the first fully dry day for ages, and Bubbles has been stuck indoors.  I think she must have decided it was Spring.  By 22:15 there was still no sign of her which is normal in Spring but not Winter.  So we did the concerned cat owner thing where you shout like an idiot at your back door for an hour.  After that didn’t help, I walked the streets for another hour.  I got back, shone my torch down to the bottom of the garden ((I was waiting to get arrested, walking the streets around here, at 11pm, with a torch in my hand, up and down dead end roads, but it never happened)), and I could see her eyes glaring back balefully.  Even then she didn’t come in, and we got to spend the rest of the night wondering if I’d mistakenly seen another cat ((second tip, don’t watch Sherlock’s The Hounds of Baskerville before you walk the streets in the dark looking for animals)).

I was pretty sure it was her, but if you love your pets there’s always doubt.

Anyway, she’s always there in the morning when she does this – ready to come in and eat – except not this morning.  So we’d started thinking the worst.  Grete was in pain, trying to organise a GP appointment, we left the house wondering where she was ((yes, I made Grete drive me to work when she can barely stand)).  When Grete got back from the docs, initially there was still no sign, but as she got to the kitchen door, Bubbles came running up from the garden, her flabby little tummy swinging from side to side.  Grete swears she could hear Ride of the Valkyries playing in the background.  Bubbles then promptly ate half a bowl of dried food, drank half a bowl of water, and has been sleeping all day since.  Little shit.

So, all in all a pretty stressful start to 2012, which is a shame because 2011 finished pretty fucking well to be fair.  Sorry it’s a bit of a whiny start to what I hope is going to be a year blogging more than last year.  Twitter really has sucked the blogging desire from me, just because I end up writing down what I was thinking in a couple of 140 character tweets instead of a 1000 word blog post.  I suppose the world is actually better off as a result.

Anyway, here’s to the rest of 2012, may it improve for us, and be awesome for you.