OS X != unix, and don’t you forget it…

I love my OS X laptop, don’t get me wrong. I run OS X Leopard as my primary OS, but I use parallels and Windows XP for some of those annoying Windows tools I need for my job (MS SQL Enterprise Manager, for example). I also love that I can compile and install just about any unix package that I would regularly use as a sysadmin. A decent OS X laptop is enough to spoil anyone.

Still, there are the little annoyances that bite you when you get too comfortable and complacent. For example… A few weeks back I tried to install the Pari math library using Darwin Ports. The build failed on a dependency, with the following output:

[h4606edac:ports/math/pari] root# port install pari
Portfile changed since last build; discarding previous state.
—> Fetching fontconfig
—> Attempting to fetch fontconfig-2.5.0.tar.gz from http://fontconfig.org/release/
—> Verifying checksum(s) for fontconfig
—> Extracting fontconfig
—> Configuring fontconfig
—> Building fontconfig with target all
Error: Target org.macports.build returned: shell command ” cd “/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_graphics_fontconfig/work/fontconfig-2.5.0″ && make all ” returned error 2
Command output: fcaliastail.h:520:2: error: #endif without #if
fcaliastail.h:522: error: only weak aliases are supported in this configuration
fcaliastail.h:523:2: error: #endif without #if
fcaliastail.h:525: error: only weak aliases are supported in this configuration
fcaliastail.h:526:2: error: #endif without #if
fcaliastail.h:528: error: only weak aliases are supported in this configuration
fcaliastail.h:529:2: error: #endif without #if
fcaliastail.h:531: error: only weak aliases are supported in this configuration
fcaliastail.h:532:2: error: #endif without #if
fcaliastail.h:534: error: only weak aliases are supported in this configuration
fcaliastail.h:535:2: error: #endif without #if
fcaliastail.h:537: error: only weak aliases are supported in this configuration
fcaliastail.h:538:2: error: #endif without #if
fcaliastail.h:540: error: only weak aliases are supported in this configuration
fcaliastail.h:541:2: error: #endif without #if
fcaliastail.h:543: error: only weak aliases are supported in this configuration
fcaliastail.h:544:2: error: #endif without #if
fcaliastail.h:546: error: only weak aliases are supported in this configuration
fcaliastail.h:547:2: error: #endif without #if
fcaliastail.h:549: error: only weak aliases are supported in this configuration
fcaliastail.h:550:2: error: #endif without #if
fcaliastail.h:552: error: only weak aliases are supported in this configuration
fcaliastail.h:553:2: error: #endif without #if
fcaliastail.h:555: error: only weak aliases are supported in this configuration
fcaliastail.h:556:2: error: #endif without #if
fcaliastail.h:557:2: error: #endif without #if
make[3]: *** [fcatomic.lo] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Error: The following dependencies failed to build: teTeX ghostscript fontconfig gsed texi2html texinfo
Error: Status 1 encountered during processing.

It was late, I was tired, and ports are frequently broken; so I figured I would come back to it later. Tonight I had time, so I updated my ports collection and tried again. Same error. Bugger…

Darwin Ports hides 99% of the build output from you, so I cleaned the ports and tried again with teh -v option:

port clean pari
port clean fontconfig
port -v install pari

As I watched the output something pretty obvious caught my eye. Pages and pages of the same text scrolled by:

Unknown option: 1
Usage: head [-options]
-m use method for the request (default is ‘HEAD’)
-f make request even if head believes method is illegal
-b Use the specified URL as base
-t Set timeout value
-i

send this HTTP header (you can specify several)

-u Display method and URL before any response
-U Display request headers (implies -u)
-s Display response status code
-S Display response status chain
-e Display response headers
-d Do not display content
-o Process HTML content in various ways

-v Show program version
-h Print this message

-x Extra debugging output

This is not just any error output, this is the output of the Perl LWP library’s HEAD command that is an optional install when you install the LWP library. There is no reason at all that this Darwin Port build of fontconfig should be invoking HEAD, but there are lots of reasons it would be invoking the unix command ‘head’. You see, the default OS X file system, HFS+, defaults to being a case-insensitive file system. HEAD is the same as head is the same as Head; and this is NOT the way a traditional unix file system works. It’s one of those subtle differences many OS X users don’t know that will bite them in the arse if they try to treat OS X like it is 100% unix under the covers.

I renamed HEAD to LWP-HEAD and everything is installing correctly now.

mv /opt/local/bin/HEAD /opt/local/bin/LWP-HEAD

If you found this page because you had the same problem and were looking for a solution, please add a comment and let me know if this worked for you.

-Chris

[ad#adsense-horizontal]

Comments are closed.

I use Amazon affiliate links in some of my posts. I think it is fair to say my writing is not influenced by the $0.40 I earned in 2022.