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 8) : 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!

Tags: , ,

16 Responses to “Building db44 using MacPorts”

  1. Using the Subversion Ruby Bindings « Alistair Israel Says:

    [...] Alistair Israel Just another developer blog. « Building db44 using MacPorts [...]

  2. Joe P Says:

    Thanks for posting this, you saved my day! I was having the same problem and this solved it.

  3. Alistair Says:

    @Joe P: No problem. Glad it helped!

  4. emil tin Says:

    hi, i was having the same problem, on a PPC powerbook. solution worked here as well. thanks.

  5. Rob Evans Says:

    Thank you very much. You saved me a lot of time.

  6. Daniel Says:

    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!

  7. Nate Says:

    you are a beautiful man.

  8. Dan Says:

    great tip! Thanks!!!

  9. Pete Says:

    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?

  10. Anders Fredriksson Says:

    Thanks a lot! saved me a bunch of time too!

  11. jeff Says:

    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

  12. Alistair Says:

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

  13. Matt Says:

    this worked for me on Leopard:

    sudo port install db44 +darwin_8 +universal +macosx

  14. Matt Says:

    sorry, there shouldn’t be a +darwin_8 in there, so it’s just:

    sudo port install db44 +universal +macosx

  15. Andrew Says:

    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.

  16. matthiasr Says:

    it seems to just work now.

Leave a Reply