Building db44 using MacPorts
September 18, 2007
MacPorts provides an extremely convenient way to install/uninstall various open-source software packages that have been ported to the Mac. It’s sort of like
apt-get for Debian or
yum for RH/CentOS/Fedora. For a developer like me who uses (and likes to use) open-source software on the Mac, MacPorts is a godsend.
If you were brought to this article, chances are you’ve encountered the same problem as I have when trying to install certain packages that depend on db44 (Version 4.4 of the Berkeley Data Base library). (Chances are, you’re also running on an Intel Mac like me – as I haven’t seen any complaints from people on PPC Macs)
If you simply go
sudo port install db44 you may be encountering this:
---> Building db44 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_databases_db44/work/db-4.4.20/build_unix" && make all " returned error 2
Command output: /bin/sh ./libtool --mode=compile /usr/bin/gcc-4.0 -c -O2 -I../dist/.. -I/opt/local/include ../dist/../db_dump185/db_dump185.c
/usr/bin/gcc-4.0 -c -O2 -I../dist/.. -I/opt/local/include ../dist/../db_dump185/db_dump185.c -fno-common -DPIC -o .libs/db_dump185.o
../dist/../db_dump185/db_dump185.c: In function 'main':
../dist/../db_dump185/db_dump185.c:212: warning: assignment makes pointer from integer without a cast
../dist/../db_dump185/db_dump185.c:214: warning: assignment makes pointer from integer without a cast
../dist/../db_dump185/db_dump185.c:229: error: 'struct __db' has no member named 'seq'
../dist/../db_dump185/db_dump185.c:229: error: 'R_NEXT' undeclared (first use in this function)
../dist/../db_dump185/db_dump185.c:229: error: (Each undeclared identifier is reported only once
../dist/../db_dump185/db_dump185.c:229: error: for each function it appears in.)
../dist/../db_dump185/db_dump185.c:234: error: 'struct __db' has no member named 'seq'
../dist/../db_dump185/db_dump185.c: In function 'db_hash':
../dist/../db_dump185/db_dump185.c:262: error: 'struct __db' has no member named 'internal'
../dist/../db_dump185/db_dump185.c:264: error: 'struct __db' has no member named 'internal'
../dist/../db_dump185/db_dump185.c: In function 'db_btree':
../dist/../db_dump185/db_dump185.c:289: error: 'struct __db' has no member named 'internal'
make: *** [db_dump185.lo] Error 1
Error: The following dependencies failed to build: db44
Error: Status 1 encountered during processing.
I searched high and low for this before and couldn’t find a solution, so I ‘worked around’ it by simply building whatever package I needed minus the dependency (apr-util, I think) that depended on db44 in the first place.
Today, I needed to build something that again dependend on db44 and fortunately, through more diligent Googling I came upon this page that has a working solution, posted by Ralph Deguelle.
Simply install the port with variant
sudo port -v install db44 +darwin_8 +universal
NOTE (added 1/12/2008): Some users on Leopard (OS X 10.5) have been reporting that this doesn’t work for them either. I guess the only thing I can think of now is to build
apr-util without Berkeley DB support, as in:
sudo port install apr_util +no_bdb
Or, for Subversion:
sudo port install subversion +no_bdb
Otherwise, if you really need Berkeley DB then you might have some luck downloading it directly from the Oracle Berkeley DB site and building it by hand.