Lion Upgrade -- Recovering mac ports, ncurses and mongodb

Lion ate my mac ports install. On the other hand, mac ports has never been very robust when it comes to operating system upgrades.

Earlier this week, I did a time machine restore to a new mac book pro from an (much older) mac book pro -- I spent the next four hours or so recovering and rebuilding my XCode and mac ports environment.

So, it wasn't really that much a surprise to see that my mac ports installation failed to selfupdate or upgrade outdated following the Lion OS update.

The first thing I had to do was grab the new (OX X 10.8) version of XCode from the Apple AppStore.  This, as it turned out, was a bit of a challenge.  I couldn't see to get the new rev to download from the AppStore and, Apple being Apple, there's no such thing as  a mirror site.   Long story short, it took about 36 hours of repeated download requests/attempts to get the upgrade downloaded.

Once I installed the XCode update, the next step was to re-build mac ports from scratch.

[cc lang='bash' line_numbers='false']

# sudo svn checkout

# cd trunk/base

# sudo ./configure --enable-readline

# sudo make install

# sudo make distclean

# sudo port -v selfupdate

# sudo port upgrade outdated


...and this is where I started getting a lot of errors...  Basically, ncurses was failing to install returning with a shell-error command.  If I tried to install individual packages that depended on ncurses like, say, mongodb, then I got returned to this error.

About 30 minutes of reading in the mac ports bug filings, and I learned that there is an issue between ncurses -> libiconv -> gawk.  The tl;dr of the issue is (if I remember right) that libiconv was looking for awk and finding gawk and wasn't building.  Since it didn't build, then nurses won't build, and if ncurses won't build, you're pretty much screwing the pooch on your mongodb install.

So, through trial-and-error, and you may have to repeat the sequence, I figured out the following commands to get all the innards back into the stomach of mac ports:

(note: either sudo these commands or exec as root.)

  1. port clean gawk
  2. port uninstall gawk
  3. port clean libiconv
  4. port uninstall libiconv
  5. port install gawk
    1. this will automagically reinstall libiconv
  6. port clean ncurses
  7. port install ncurses

This should result in a clean build and installation of ncurses.  Earlier in the process, since ncurses is dependent on ncursesw, I cleaned, uninstalled, and installed ncursesw.  But I'm not convinced that was a necessary step.  If the above process is failing for you, then maybe you should try r&r'ing ncursesw first.

I'm still having issues with mongodb...and I'll document the solutions as I figure them out -- but the ncurses dependency is, for the moment, addressed.

[cc lang='bash' line_numbers='false']

In file included from util/processinfo_darwin.cpp:30:
/usr/include/mach/shared_memory_server.h:48:2: warning: #warning "<mach/shared_memory_server.h> is deprecated.  Please use <mach/shared_region.h> instead."
In file included from util/processinfo_darwin.cpp:23:
/usr/include/mach/task_info.h:252: error: 'vm_extmod_statistics_data_t' does not name a type
/opt/local/include/boost/system/error_code.hpp:214: warning: 'boost::system::posix_category' def


And I see there's a bug reported for this issue with the comment that they're kicking it over to the folks at mongodb for a fix.

Stay tuned...

[Edit 8/1/2011]

I did a Lion upgrade on a fresh Leopard system - there's been some changes since I wrote the article, most notably, the problems with ncurses, gawk, et. all., seemed to have been fixed.  The steps are pretty simple, actually:

  1. download (holy constipated broadband! anyone else notice the slow-as-frozen-cement download speeds Apple squicks out for this application?)  and install XCode for Lion from Apple's AppStore application.
  2. check and, if necessary, modify your PATH variable to include the mondodb bin path (for me: /opt/local/bin).
  3. self-update the mac port install  (sudo port selfupdate)
  4. update the outdated ports  (sudo port upgrade outdated)
  5. Follow the steps left by Peter in the comments below to patch and install mongodb.  (Thank-you, Peter!)
Once I did this, I had a fully-functional port installation, complete with mongodb and all the other cool kids. (Apache2, mysql5, php5, etc.)
Hope this helps!