Building db44 using MacPorts
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)
The problem
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 darwin_8 and universal:
sudo port -v install db44 +darwin_8 +universal
That’ll work!
NOTE (added 1/12/200
: 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.
Good luck!
September 19, 2007 at 3:51 pm
[...] Alistair Israel Just another developer blog. « Building db44 using MacPorts [...]
September 20, 2007 at 7:59 am
Thanks for posting this, you saved my day! I was having the same problem and this solved it.
September 20, 2007 at 12:12 pm
@Joe P: No problem. Glad it helped!
September 24, 2007 at 5:08 am
hi, i was having the same problem, on a PPC powerbook. solution worked here as well. thanks.
October 4, 2007 at 5:30 am
Thank you very much. You saved me a lot of time.
October 23, 2007 at 3:38 pm
Hey, thanks a lot for this post! It helped me a lot getting apache2 installed on my PB G4 (so another person with a PPC).
Have a good day!
November 20, 2007 at 10:45 am
you are a beautiful man.
November 28, 2007 at 7:13 am
great tip! Thanks!!!
December 17, 2007 at 12:42 am
I just tried this on Leopard and it doesn’t seem to fix the problem any more. I’m on an MacBookPro. Any advice, or suggestions?
January 4, 2008 at 5:27 am
Thanks a lot! saved me a bunch of time too!
January 12, 2008 at 4:21 pm
This didn’t work for me on Leopard-
sudo port install +darwin_8 +universal
I got it working with:
sudo port install apr-util +no_bdb
sudo port install apache2
January 12, 2008 at 10:45 pm
Thanks for the heads up. I don’t have Leopard yet so I haven’t been able to check this myself. In the mean time, I’ll update the original post with notes on ‘+no_bdb’.
February 6, 2008 at 2:01 am
this worked for me on Leopard:
sudo port install db44 +darwin_8 +universal +macosx
February 6, 2008 at 2:15 am
sorry, there shouldn’t be a +darwin_8 in there, so it’s just:
sudo port install db44 +universal +macosx
February 26, 2008 at 11:08 am
As with Matt above, the original command didn’t work for me on leopard, but:
sudo port install db44 +universal +macosx
did. However, it only worked after I had run a “port selfupgrade” to get the newest version of MacPorts.
April 1, 2008 at 5:04 am
it seems to just work now.