Compiling method and mysql on OSX

John Ralls jralls at ceridwen.us
Mon Oct 14 14:03:38 EDT 2013


On Oct 13, 2013, at 10:53 PM, John Ralls <jralls at ceridwen.us> wrote:

> 
> On Oct 13, 2013, at 9:04 PM, Benjamin Martens <bdmartens at gmail.com> wrote:
> 
>> Hi John,
>> I went back and re-compliled the mysql driver as i386 with the -f (force) option (needed to make it actually compile again), and replaced the driver in the expected /Applications/Gnucash.app/Contents/Resources/lib/dbd/
>> 
>> Gnucash starts, and I am able to select the mysql option.  Unfortunately after entering the information, gnucash crashes with the below information.  Do you have any further suggestions on how to proceed?   I looked at the date stamp on the libdbdmysql.so , and it did appear to be the new, therefore i386 version.  In looking back through the compile comments, though, it looks like there were several items noted to have been made for a different architecture (ie, mysql and many others that appeared to be components of gtk-osx)
>> 
>> Is there a reason why the libdbmysql.so driver cannot be supplied/distributed?  (ie, legal with respect to the mysql c and headers?)
> Cannot? No. It's in the Windows package, and I'm pretty sure you can get it through MacPorts as well. But there's nowhere near enough demand to make it worth my time to maintain it in the MacOSX bundle: You're the third person in 4 years who's asked, and one of the others wanted Postgres, not MySql.
> 
>> 
>> (given this headache, I went back and tried to compile a 64 bit version, and was eventually able to make it to step 38/72, but kept on getting obscure unhanded exception / missing files (that are not missing and and are where they are expected) - so I left that end alone.  Perhaps it is because development has happened for 32 bit architectures.)
>> 
>> FYI, the output from otool was apparently normal/appropriate:
>> otool -L /Applications/Gnucash.app/Contents/Resources/lib/dbd/libdbdmysql.so/Applications/Gnucash.app/Contents/Resources/lib/dbd/libdbdmysql.so:
> 
>> 	/Users/macuser/gnucash-stable/lib/libdbi.0.dylib (compatibility version 1.0.0, current version 1.5.0)
>> 	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)
> 
> No, it's not. Where's libmysqlclient.dylib?


I'm in a more charitable mood this morning, so I decided to try it myself. I frankly don't understand how you got to where you did. 
Following what you did, I downloaded MySql instead of building it with jhbuild,
and added 
  autogen_args.append('libdbi-drivers', '--with-mysql --with-mysql-incdir=/usr/local/mysql/include --with-mysql-libdir=/usr/local/mysql/lib')

to my .jhbuildrc-custom and ran
  jhbuild buildone -f libdbi-drivers
which failed, because MySql has apparently moved mysql.h out of .../include/mysql.
I had to edit libdbi-drivers-0.8.3-1/drivers/mysql/dbd_mysql.c to get it to compile:
--- /Users/john/Development/gtk-sources/libdbi-drivers-0.8.3-1/drivers/mysql/dbd_mysql.c~	Mon Jan 14 16:27:29 2008
+++ /Users/john/Development/gtk-sources/libdbi-drivers-0.8.3-1/drivers/mysql/dbd_mysql.c	Mon Oct 14 10:25:54 2013
@@ -51,7 +51,7 @@
 #include <dbi/dbi-dev.h>
 #include <dbi/dbd.h>
 
-#include <mysql/mysql.h>
+#include <mysql.h>
 #include "dbd_mysql.h"
 
 static const dbi_info_t driver_info = {

After that it built without errors. Here's what otool -L is supposed to report:
> otool -L Development/Gnucash-Build/Gnucash-2.5/inst/lib/dbd/libdbdmysql.so
Development/Gnucash-Build/Gnucash-2.5/inst/lib/dbd/libdbdmysql.so:
	libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0)
	/Users/john/Development/Gnucash-Build/Gnucash-2.5/inst/lib/libdbi.0.dylib (compatibility version 1.0.0, current version 1.5.0)
	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)

I copied libdbdmysql.so to Gnucash.app/Contents/Resources/lib/dbd and ran Gnucash from the command line: it reported 
Library not loaded: libmysqlclient.18.dylib
  Referenced from: /Users/john/Gnucash.app/Contents/Resources/lib/dbd/libdbdmysql.so
  Reason: image not found
libdbi: Failed to load driver: /Users/john/Gnucash.app/Contents/Resources/lib/dbd/libdbdmysql.so

After all of the noise from the GSettings migration routine. Adding /usr/local/mysql/lib to $DYLD_LIBRARY_PATH didn't resolve it, so I copied libmysqlclient.18.so into Gnucash.app/Contents/Resources/lib and tried again.
It worked, at least to the point of telling me that the server didn't respond,
which is because I didn't set it up.

Regards,
John Ralls


More information about the gnucash-user mailing list