How to compile mdbtools on Mac OS X 10.4 and 10.5

Update: MacPorts appears to have a working port of mdbtools now.

Prerequisites

You’ll need MacPorts, the mdbtools source, and a simple patch. Use macports to install glib2, libtool, and automake:

port install glib2 libtool automake

One commenter reported that he had to upgrade version 2.5.35 of flex. I had no trouble with the version of flex included with Leopard, viz. 2.5.33.

MDB Tools source

You can get the mdbtools source from CVS, via the instructions at the sourceforge site, and my patch here.

Alternatively, use a git repo I started because CVS makes baby Theanthropos cry:

git clone git://gitorious.org/mdbtools/mainline.git mdbtools

autogen.sh && make && make install

cd into the mdbtools directory and run autogen.sh Pass any configuration args to autogen.sh, and it will pass them along to configure. /usr/local is the default prefix. The options below set the install location, enable compilation of the mdb-sql tool, but not gmdb2, the Gnome MDB File Viewer and debugger.

./autogen.sh --prefix=/users/Matthew/local --enable-sql --disable-gmdb2
make
make install

Assume that make and install work: you can test the results like so:

mdb-ver /path/to/thingy.mdb
mdb-tables /path/to/thingy.mdb
mdb-schema /path/to/thingy.mdb
Advertisements
Leave a comment

28 Comments

  1. Stockli

     /  March 31, 2008

    Fantastic… Thanks very much for taking the time to post your patch. I’m sure I would have wasted a lot of time trying to figure this out!

  2. Matthew King

     /  March 31, 2008

    You’re welcome. Allow me to commiserate with you on it’s being necessary.

  3. michael bedward

     /  April 2, 2008

    Hail to thee Matthew ! Just got mdbtools working under OSX 10.4.8. This will save me a heap of time. I’m pathetically grateful.

  4. Peter Boye

     /  May 21, 2008

    Running autogen.sh, I get the error: “config.status: error: cannot find input file: Makefile.in” What do I do wrong?

  5. Matthew King

     /  May 21, 2008

    Peter, are you using the git repo, or the CVS + patch?

  6. Peter Boye

     /  May 22, 2008

    I use the CVS, 0.6pre1. But I don’t understand when to use the patch. Maybe that’s the problem. How do I utilise the git repo?

  7. Matthew King

     /  May 22, 2008

    Peter:You’ll need git installed, which you can do with macports for sure, and probably fink. With macports, you do something like:$ sudo port install git-core +svnThe “+svn” part gets you the git-svn tools, which allow near-seamless tracking of Subversion reposOnce you have git installed, cd to the directory where you want to keep mdb-tools source and start following my instructions where it says “git clone …”

  8. Hugh Cayless

     /  May 29, 2008

    I too am pathetically grateful. Had this working months ago, but I had to reinstall recently and lost it in the process, along with all memory of how I got it to build in the first place.Thank you, thank you, thank you!

  9. Mark

     /  June 13, 2008

    Thanks for sharing this information. It’s been very helpful for me.A small note: I followed the instructions and used GIT to get the sourcecode. The only problem I encountered when typing ‘make’ was an error about an ‘invalid token character’ or something.After a bit of Google searching I found that this error was due to a bug in flex. Upgrading flex to 2.5.35 fixed it.Hope this information helps someone else.

  10. Matthew King

     /  June 13, 2008

    Thanks for the information, Mark. I made a note in the main article.

  11. Linker3000

     /  June 20, 2008

    Can I use git to grab the code for a build on CentOS 5 or is the code Mac-specific. cvs made you cry – it’s making me stabby!Thanks

  12. Matthew King

     /  June 20, 2008

    Linker3000, I can’t remember whether I tested the changes on any Linux. Looking at the patch, though, the changes seem pretty straightforward, and not Mac specific. So the git repo should be at least a decent starting point.

  13. Linker3000

     /  June 22, 2008

    Thanks Matthew,As it happens I managed to checkout the code from cvs eventually (2 days of trying!) and got it to compile OK.L3K

  14. k-mac

     /  August 19, 2008

    Don’t know what I’m doing wrong.Have done port install glib2 libtool automkeDownloaded the sources 0.5 and 0.6pre1.Wanted to follow your instructions, but where is autogen.sh? It’s not in the mdbtools-folder, nor anywhere in the system.OSX 10.5.4 :(Isn’t there a working copy of the tools for osx out in the world without compiling, installing a bunch of macports and so forth?

  15. k-mac

     /  August 19, 2008

    was a comment typo. meantport install glib2 libtool automakeof course.btw: doing a simple configure with the options above + make, I get an error:ld: duplicate symbol _mdb_backends in mem.lo and catalog.locollect2: ld returned 1 exit statusmake[2]: *** [libmdb.la] Error 1make[1]: *** [all-recursive] Error 1make: *** [all-recursive] Error 1

  16. Matthew King

     /  August 19, 2008

    k-mac:I don’t think I ever tried the release packages. I went straight to the CVS repo. Have you tried the Git repo I published?

  17. k-mac

     /  August 20, 2008

    Well, don't know about git. Have tried aport install git-core +svnlike it was written somewhere, but I get—> Fetching p5-error—> Attempting to fetch Error-0.17012.tar.gz from (several servers, none working).So I don't have that thing called "git".Have downloaded the cvs repo and fouznd a autogen.sh which I could patch. Done so, I tried a ./autogen.sh, but got the following error:checking Are we using flex … yes ./configure: line 20350: syntax error near unexpected token `2.0.0'./configure: line 20350: `AM_PATH_GLIB_2_0(2.0.0)'looking up I found a message at the very beginning, saying:# ./autogen.sh**Warning**: I am going to run `configure' with no arguments.If you wish to pass any to it, please specify them on the`./autogen.sh' command line.processing .Running aclocal …configure.in:106: warning: macro `AM_PATH_GLIB_2_0' not found in libraryRunning libtoolize…… and so forthAlso tried with –enable-sql –disable-gmdb2no changes

  18. k-mac

     /  August 20, 2008

    Finally I got git installed. Had to patch the Portfile of p5-error to use the Version 17015 rather than 17012 cos I found out that 012 was no longer on the servers.Than I had to make a port install git-core without +svn. The latter brought me other errors building sqlite3.Than I did the git command you posted which gave me another mdbtools folder where I could start autogen.sh…leading to exactly the same error message as in my previous post./configure: line 20350: syntax error near unexpected token `2.0.0′./configure: line 20350: `AM_PATH_GLIB_2_0(2.0.0)’:(Looks like mdbtools are not made for the mac. Damned there is no alternative out in the world.Trying to find a osx binary version of the tools, but whyever noone leaves them for download.

  19. Matthew King

     /  August 20, 2008

    k-mac, I am perplexed.I cloned the git repo anew, then ran autogen.sh, receiving no errors. The configure file that was produced does not have the string “AM_PATH_GLIB_2_0” anywhere in it. I don’t know much about automake, but it seems that AM_PATH_GLIB_2_0 is a macro that shouldn’t be showing up in your configure file.My best guess is that something is wrong with your automake/autoconf system.

  20. Jim Benton

     /  November 3, 2008

    k-mac, sounds like automake isn’t installed. You need to run:sudo port install automake

  21. Greg

     /  November 14, 2008

    @k-macHave you checked to see which version of automake is being used with:which automakemost likely there is another version somewhere else that is being used. To solve the problem temporarily, you can put your mac ports path at the front of your path eg:PATH=/opt/local/bin:$PATHbefore you run autogen.sh

  22. mars

     /  November 19, 2008

    Just got this working as per instructions,using the SF CVS repo and OS X 10.5.5.I also had to get gawk for the man pages to install: port install gawkthanks!

  23. Anonymous

     /  May 28, 2009

    Hello,Thanks for all this very helpful information. Just FYI, the pastie.org link for your patch seems to have gotten fouled somehow.. it links to what looks like diff output, instead of a complete shell script. For the convenience of others, I re-posted the intact version from your git archive: http://pastie.org/492955

  24. Justin

     /  October 6, 2009

    I just thought I'd post and say that the PECL extension mdbtools successfully installed with the patched version of mdbtools that you provide. Thank you.

  25. Matthew King

     /  October 8, 2009

    Justin, that's great. Glad that it's helping the poor souls who must work with Access. Wyrd has decreed that I no longer must suffer so.

  26. Anonymous

     /  December 14, 2009

    $ sudo bashPassword:# port install mdbtools—> Fetching mdbtools—> Attempting to fetch mdbtools-0.6pre1.tar.gz from http://internap.dl.sourceforge.net/mdbtools—> Verifying checksum(s) for mdbtools—> Extracting mdbtools—> Applying patches to mdbtools—> Configuring mdbtools—> Building mdbtools—> Staging mdbtools into destroot—> Installing mdbtools @0.6pre1_0—> Activating mdbtools @0.6pre1_0—> Cleaning mdbtools#

  27. Matthew King

     /  December 15, 2009

    Hooray for MacPorts.

  28. Matthew,

    i have never had a problem compiling mdbtools. The problems i run into are runtime errors: it runs perfectly fine on 32bit platforms, I keep getting segmentation faults on JET# type mdb files and 64bit platforms, such as 10.6 or debianlinux amd64. Simply running “mdb-tables -1 file.mdb” will produce the desired output on the linux i have in a vmware, while it will segfault when i run it with mdbtools on OSX 10.6 or linux64.

    Am i the only one still using mdbtools on 64bit, or is there something i’m not doing right?

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

%d bloggers like this: