Eradicating a missing dylib dependency in macports

I would’ve put this on the macports wiki because it’s the kind of thing I will probably need again sometime, but since their move to macosforge.org, I can’t modify their wiki.

A few weeks ago, a new version of gettext was committed to macports. This new version installed libintl.8. A whole bunch of macports, particularly all the gnome stuff, links to gettext and uses libintl. Apparently the ports are specifying libintl.3 instead of just taking whatever libintl they can get, so I’ve been having a lot of broken ports and failed builds lately.

I finally got fed up and lazy at the same time.

First, find all the dylibs installed by macports that have the offending library using otool -L. Find out which port installed that dylib, and sort and uniq the results:

#!/bin/bash 
cd /opt/local/lib
for file in *.dylib; do 
  # Skip this match if it's a symbolic link
  if [[ ! -h $file ]]; then
    # Look for references to the missing library
    otool -L $file | grep --silent libintl.3
    if [[ "$?" == "0" ]]; then
      port provides `echo $file`
    fi
  fi
# Grab the name of the port and make sure to list each port just once
done | awk -F: ' { print $2 } ' | sort | uniq

Now you’ve got a list of ports you need to fix.

Force an uninstall of each of these ports with port uninstall -f theport and remove their archived built files with port clean --archive theport. Once that’s done, force an install of each one with port install -f theport. If you’ve got old versions of the port hanging around, this won’t work. Remove the old version first.

Anyone know how to sort some macports in to dependency order?

This entry was posted in Uncategorized and tagged . Bookmark the permalink.