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 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/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.

Good luck!

18 thoughts on “Building db44 using MacPorts

  1. 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!

  2. 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?

  3. 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

  4. 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’.

  5. 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.

  6. Many, many thanks for this tip.
    I’m on a PPC and I had given up on MacPorts twice already by removing it completely from my system just because of the db44 problem.
    Well, somehow today I came across your tip and after deciding to give it a try it simply solved my problem completely.

    “sudo port -v install db44 +darwin_8 +universal” works great.

    Once again thank you.

  7. I had this problem with db46 but adding the +darwin_8 +universal didn’t help. What I did was edit /opt/local/var/macports/sources/ and removed all references to “dump185”.

    Macports was able to install it then. I’m on a MacBook Pro, Intel Core 2 Duo, OSX 10.4.11.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s