Summary: the compilation of some packages fails under OS X exiting with the error ‘RTLD_NEXT’ undeclared.
Solution: rename /usr/local/include/dlfcn.h to /usr/local/include/dlfcn.h.backup
Tested on: Mac OS 10.4.11
Geekiness: 5 / 5
I’m a Mac user who loves the world of Unix software. I can’t live without wget, lynx and the GD2 library (for resizing images in drupal).
However, these packages aren’t natively available on Mac. No problem! I have 2 options: Fink or Macports.
I’ve used Fink for over 4 years and by and large have been happy with it. Just last week I was chatting to caktux in the #drupal channel on irc.freenode.net (my Mac irc client is Colloquy – because I can’t find anything better) and he convinced me to start using subversion to manage my drupal module code. No problem, I fired up Fink…and found a horribly outdated version of svn. Not even the “latest unstable” version was close to what it should have been.
Twice in the last 2 weeks I’ve had people tell me that they prefer MacPorts: caktux and Adrian Rossouw. So I decided to uninstall Fink (by opening Fink Commander, selecting all packages, and making sure that both source and binary installs were removed, and then removing the /sw folder) and install MacPorts, which is painless.
wget and lynx were quickly available (sudo port install wget and sudo port install lynx) but GD2 was another story. I got the same error under MacPorts that I got while attempting to install GNUcash under Fink. Compliation exited with this error:
/usr/bin/gcc-4.0 -o hacklocaledir.so -fPIC -bundle hacklocaledir.c
hacklocaledir.c: In function '__open':
hacklocaledir.c:44: error: 'RTLD_NEXT' undeclared (first use in this function)
hacklocaledir.c:44: error: (Each undeclared identifier is reported only once
hacklocaledir.c:44: error: for each function it appears in.)
hacklocaledir.c: At top level:
hacklocaledir.c:113: warning: alias definitions not supported in Mach-O; ignored
make: *** [hacklocaledir.so] Error 1
‘RTLD_NEXT’ undeclared is the offending bit, which means nothing to me. Last time this happened, I search the C files to see if I could manually declare RTLD_NEXT but gave up. Who knows what its value is supposed to be?
Well, the solution is something completely different. Turns out that everything in /usr/local will influence the compiler, particularly the existence of /usr/local/include/dlfcn.h
I can’t remember why that particular file is there or even why renaming it to dlfcn.h.backup allows GNUcash and GD2 to compile, but it does. Googling the error didn’t return many useful results, except from the MacPorts ticket list, so hopefully this blog post will help someone similarly bewildered.
fink, macports, mac os x, compilation, error, RTLD_NEXT