views:

25

answers:

1

I'm trying to set up a development environment on my aging Macbook Pro that matches my Linux EC2 production environment. I'm on the home stretch now, need only to get the mod_auth_mysql plugin for apache working. After a few hours of googling and patching and scratching my head, I think I'm almost there, but I've hit something that nothing I've found online has been able to solve.

nathan@ichigo:/usr/local/mod_auth_mysql-2.9.0$ sudo apxs -c -L/usr/local/mysql/lib -I/usr/local/mysql/include/ -lmysqlclient -lm -lz mod_auth_mysql.c 
/usr/share/apr-1/build-1/libtool --silent --mode=compile gcc    -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -I/usr/local/include -I/usr/include/apache2  -I/usr/include/apr-1   -I/usr/include/apr-1  -I/usr/local/mysql/include/  -c -o mod_auth_mysql.lo mod_auth_mysql.c && touch mod_auth_mysql.slo
/usr/share/apr-1/build-1/libtool --silent --mode=link gcc -o mod_auth_mysql.la  -L/usr/local/mysql/lib -lmysqlclient -lm -lz -rpath /usr/libexec/apache2 -module -avoid-version    mod_auth_mysql.lo
ld: warning: in /usr/local/mysql/lib/libmysqlclient.dylib, file is not of required architecture
ld: warning: in /usr/local/mysql/lib/libz.a, file is not of required architecture
warning: no debug symbols in executable (-arch x86_64)

I think this is complaining because it's trying to build for 64-bit, but I'm on a 32-bit platform? I'm not entirely sure. I've tried forcing a 32-bit build with env ARCHFLAGS and -D arch on apxs, to no avail.

FWIW, I also tried mod_auth_mysql-3.0.0, and hit more or less the same result.

Alternatively, is there a more modern way to auth against mysql in Apache? I didn't find anything else, but this module hasn't gotten any love in a good 5 years, and I had to apply some patches I found scattered about the 'net to even get this far.

+1  A: 

First, check what architectures your libraries support with file /usr/local/mysql/lib/libmysqlclient.dylib, etc. Once you know that, I think you can control what apxs builds for by adding flags like -Wc,"-arch i386" -Wl,"-arch i386"

Gordon Davisson
Great! that got me one step closer, now I have one warning: "warning: no debug symbols in executable (-arch i386)", and no .so in the build directory. I also checked in the libexec/apache for a mod_auth_mysql (not sure if apxs is supposed to dump it there automatically), and no dice.
Nathan
Ok, adding -g to the compiler flags removed the warning, but didn't generate the .so. Did some more reading in apxs man page, and found out that the command I'm executing there isn't the whole deal, you need to run apxs -i -a mod_name.la to finish. So, with that it's all working. Thanks!
Nathan
One more note for anybody that has this problem and lands here: Turns out that even though I'm running on a i386 processor, the apache that's built in is x86_64, along with all its modules. So, after doing all this to get it working, the module wouldn't load. I ended up installed the x86_64 version of mysql, rebuilding mod_auth_mysql without the "-auth i386", and everything just worked.
Nathan