MacPorts selfupdate fails on Mac OS X Lion
I recently upgraded my Mac Book Pro to Lion and faced challenges with MacPorts application that I had with me. I had downloaded and installed XCode 4.2 from the app store (very un - appstore like installation BTW - you click install on the app store but it only downloaded the app. You need to separately install it) before I did the selfupdate but it does not seem to matter. The application fails with the following errors (relevant sections below) -
/Library/Frameworks/Mono.framework/Versions/2.10.6/include/sqlite3.h:252: warning: ISO C90 does not support ‘long long’
/Library/Frameworks/Mono.framework/Versions/2.10.6/include/sqlite3.h:253: warning: ISO C90 does not support ‘long long’
/usr/bin/cc -c -DUSE_TCL_STUBS -DTCL_NO_DEPRECATED -g -O2 -W -Wall -pedantic -I/Library/Frameworks/Mono.framework/Versions/2.10.6/include -DHAVE_CONFIG_H -I.. -I. -I"/usr/include" -fno-common util.c -o util.o
In file included from util.h:36,
from util.c:37:
/Library/Frameworks/Mono.framework/Versions/2.10.6/include/sqlite3.h:252: warning: ISO C90 does not support ‘long long’
/Library/Frameworks/Mono.framework/Versions/2.10.6/include/sqlite3.h:253: warning: ISO C90 does not support ‘long long’
.
.
.
/usr/bin/cc -dynamiclib -g -O2 -W -Wall -pedantic -I/Library/Frameworks/Mono.framework/Versions/2.10.6/include -Wl,-single_module registry.o util.o entry.o entryobj.o ../cregistry/cregistry.a -o registry.dylib -L/System/Library/Frameworks/Tcl.framework/Versions/8.5 -ltclstub8.5 -L/Library/Frameworks/Mono.framework/Versions/2.10.6/lib -lsqlite3
ld: warning: ignoring file
/Library/Frameworks/Mono.framework/Versions/2.10.6/lib/libsqlite3.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols for architecture x86_64:
"_sqlite3_errmsg", referenced from:
_set_sqlite_result in util.o
_reg_sqlite_error in cregistry.a(registry.o)
_reg_detach in cregistry.a(registry.o)
_reg_close in cregistry.a(registry.o)
_reg_attach in cregistry.a(registry.o)
_reg_open in cregistry.a(registry.o)
.
.
.
.
"_sqlite3_create_collation", referenced from:
_init_db in cregistry.a(sql.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[2]: *** [registry.dylib] Error 1
make[1]: *** [all] Error 1
make: *** [all] Error 1
shell command "cd /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/base && CC=/usr/bin/cc ./configure --prefix=/opt/local --with-tclpackage=/Library/Tcl --with-install-user=root --with-install-group=admin --with-directory-mode=0755 --enable-readline && make &&
make install" returned error 2
Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: shell command failed (see log for details)
As far as I tell I should not be having issues but it looks like I do not have any option but to reinstall MacPorts and all the applications under it.
Solution 1:
I found the answer when I was searching on Google using the error messages as search queries.
Basically the problem is because I had installed the Mono framework as well and for some weird reason MacPorts was using the version of SQL Lite bundled in the Mono Framework during its make and install steps. This version of SQL Lite is not compatible with the MacPorts application and as result the install failed.
The workaround is to temporarily move the /Library/Frameworks/Mono.framework/ somewhere else and then run the selfupdate command. Once the selfupdate is done move the folder back to /Library/Frameworks/Mono.framework/.
I got the solution from Mark who had kindly blogged about it here - http://itandbiscuits.blogspot.com/2011/09/macports-mono.html