Compiling things against the Sun Web Stack MySQL
March 6th, 2009
Sun have done an interesting thing with Web Stack 1.4, and have churned out both 32bit and 64bit libraries and binaries for Apache, PHP, MySQL, etc (On Solaris 10 anyway). The 64 bit versions can be found in their amd64 folders, and things like Apache & MySQL can be told to start in 64bit mode by tweaking their manifests. So for example, you have:
In: /opt/webstack/apache2/2.2/bin: ./httpd: ELF 32-bit LSB executable 80386 Version 1 [FPU], dynamically linked, stripped ./amd64/httpd: ELF 64-bit LSB executable AMD64 Version 1 [SSE FXSR CMOV FPU], dynamically linked, stripped
One downside of this is that Sun have forgotten a vital subtlety. There is a header file that ships with MySQL called "my_config.h", which contains SIZEOF_ entries for the data types, eg SIZEOF_LONG. It’s autogenerated by autoconf, and the my_config.h that comes with Sun Web Stack 1.4 contains SIZEOF_ entries that are 64bit sized. There is no 32bit version of the file. This is no good if you want to link against MySQL in 32bit mode. We became aware of this error when compiling MySQL-python 1.3, which includes pyconfig.h as well, which also defines SIZEOF_LONG, so we were getting:
warning: "SIZEOF_LONG" redefined
There are perhaps ways of fixing or getting around this, such as stealing a my_config.h from a 32bit sized MySQL installation and altering the #include statement of whatever you’re compiling. But the safest solution we went with was to compile our own MySQL client from source, doing something along the lines of:
export CC=/opt/SUNWspro/bin/cc export CXX=/opt/SUNWspro/bin/CC ./configure --without-server --enable-thread-safe-client --prefix=/opt/mysql_client gmake gmake install
You can then compile your application against this client library. A lot of things that build against mysql use the mysql_config program to get their compiler options. So if you do compile up your own mysql client, you’ll want to make sure it’s mysql_config is in your path.
Entry Filed under: General

2 Comments Add your own
1. Jeff Trawick | May 6th, 2009 at 4:29 pm
Thanks for the info; I’ve filed a bug for this issue.
BTW, when you find issues with our Solaris 10 or RHEL distributions, please post to http://forums.sun.com/forum.jspa?forumID=980 so we’re aware of it; for the OpenSolaris distribution, use the OpenSolaris Bugzilla or http://opensolaris.org/jive/forum.jspa?forumID=200.
Thanks again!
2. Alasdair | May 6th, 2009 at 6:04 pm
Hi Jeff,
Great - thanks for letting me know. I’ll be sure to file any bugs I find.
Cheers,
Alasdair
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed