I had some serious unexpected fun trying to install erlang on my OS X box using MacPorts. In general it’s usually a no brainer you usually type sudo port install <foo> and you have a new package installed without that much fuss. However here is the partial log of trying to install erlang and it blowing up…
$ sudo port install icu erlang ... ICU installs without a problem ... ---> Fetching tcl ---> Attempting to fetch tcl8.5.1-src.tar.gz from http://downloads.sourceforge.net/tcl ---> Verifying checksum(s) for tcl ---> Extracting tcl ---> Configuring tcl ---> Building tcl 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_lang_tcl/work/tcl8.5.1/unix" && make all " returned error 2 Command output: /usr/bin/gcc-4.0 -c -Os -O2 -pipe -Wall -Wno-implicit-int -fno-common -I. -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../generic -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../libtommath -DPACKAGE_NAME=\"tcl\" - ... ... ... _opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c:62: /usr/local/include/mach-o/arch.h:35: error: nested redefinition of 'enum NXByteOrder' /usr/local/include/mach-o/arch.h:35: error: redeclaration of 'enum NXByteOrder' /usr/local/include/mach-o/arch.h:36: error: redeclaration of enumerator 'NX_UnknownByteOrder' /usr/include/architecture/byte_order.h:137: error: previous definition of 'NX_UnknownByteOrder' was here /usr/local/include/mach-o/arch.h:37: error: redeclaration of enumerator 'NX_LittleEndian' /usr/include/architecture/byte_order.h:138: error: previous definition of 'NX_LittleEndian' was here /usr/local/include/mach-o/arch.h:39: error: redeclaration of enumerator 'NX_BigEndian' /usr/include/architecture/byte_order.h:140: error: previous definition of 'NX_BigEndian' was here /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c: In function 'TclpFindSymbol': /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c:382: warning: 'NSLookupSymbolInImage' is deprecated (declared at /usr/include/mach-o/dyld.h:182) /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c:415: warning: 'NSLinkEditError' is deprecated (declared at /usr/include/mach-o/dyld.h:217) /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c:419: warning: 'NSLookupSymbolInModule' is deprecated (declared at /usr/include/mach-o/dyld.h:181) /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c:428: warning: 'NSAddressOfSymbol' is deprecated (declared at /usr/include/mach-o/dyld.h:188) /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c: In function 'TclpUnloadFile': /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c:493: warning: 'NSUnLinkModule' is deprecated (declared at /usr/include/mach-o/dyld.h:169) /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c: In function 'TclpLoadMemory': /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c:697: warning: 'NSCreateObjectFileImageFromMemory' is deprecated (declared at /usr/include/mach-o/dyld.h:146) /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c:730: warning: 'NSLinkModule' is deprecated (declared at /usr/include/mach-o/dyld.h:161) /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c:732: warning: 'NSDestroyObjectFileImage' is deprecated (declared at /usr/include/mach-o/dyld.h:147) /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c:740: warning: 'NSLinkEditError' is deprecated (declared at /usr/include/mach-o/dyld.h:217) make: *** [tclLoadDyld.o] Error 1 Error: The following dependencies failed to build: tk tcl Error: Status 1 encountered during processing.
Pretty sucky, huh? My first lazy thought was, “I thought the point of a package manager was to avoid all these problems.”
After a little bit of thinking and staring at the error message, I did the workaround and moved the /usr/local/include directory away and tried rebuilding which made things much happier. Check the log below…
$ cd /usr/local l$ ls arm-apple-darwin include man bin info share docs lib etc libexec $ sudo mv include include.ignore l$ sudo port install icu erlang Skipping org.macports.activate (icu ) since this port is already active ---> Cleaning icu ---> Building tcl with target all ---> Staging tcl into destroot ---> Installing tcl 8.5.1_0 ---> Activating tcl 8.5.1_0
Voila. A working erlang install. Don’t forget to move back the include directory back to its old place.