Solved!
Probably fairly obvious, the clue is in the config.log here:
sendfile -L/opt/SUNWspro/lib -lCrun -lrt
-L/usr/mysql/5.1/lib/mysql> -R/usr/mysql/5.1/lib/mysql -lmysqlclient -lz -lgen -lsocket -lnsl -lm -lz
> -lm >&5
ld: fatal: library -lCrun: not found
As I understand it, the OpenSolaris distribution of MySQL 5.1.30 is compiled
with the Sun C Compiler, part of Sun Studio (now known as Oracle Solaris
Studio) and it in fact is requiring a library from Sun Studio in order to
compile against the MySQL client library.
I have now installed Oracle Solaris Studio by downloading the .tar.bz2
version of it, exploding all 1GB of it into /opt, and making the requisite
symlink for SUNWspro as follows:
cd /opt
ln -s SolarisStudio12.2-solaris-x86-tar-ML/solstudio12.2 SUNWspro
And now I can configure and build as follows:
./configure --prefix=/opt/dovecot --with-ldap --with-mysql
make
There is no need to specify any environment variables such as CCFLAGS or
what-have-you as mysql_config is already giving the right stuff to
./configure.
Ironically, this only builds when using gcc. If I specify CC=cc then I get
the same error about libmysqlclient:
CC=cc ./configure --prefix=/opt/dovecot --with-ldap --with-mysql
...snip...
checking for mysql_init in -lmysqlclient... no
configure: error: Can't build with MySQL support: libmysqlclient not found
Onwards and upwards.
Jesse
On 12 June 2011 23:57, Jesse Reynolds <jessedreynolds at gmail.com> wrote:
> Hello
>
> I'm hoping someone can give me a pointer as to how to compile Dovecot
with
> MySQL support on Solaris.
>
> I am trying to compile dovecot 2.0.13 (also tried 2.0.9) on Solaris
> (OpenSolaris 2009-06, snv_111b) with the OpenSolaris provided MySQL 5.1.30
> under /usr/mysql. The server is a Sun X2100 M2, which has a dual core AMD
> Opteron processor (amd64).
>
> Running "./configure --with-mysql" stops here:
>
> ...
> checking for mysql_config... mysql_config
> checking for mysql_init in -lmysqlclient... no
> configure: error: Can't build with MySQL support: libmysqlclient not
found
>
> the libmysqlclient.so is to be found here:
>
> /usr/mysql/5.1/lib/mysql/
>
> or for the amd64 version:
>
> /usr/mysql/5.1/lib/amd64/mysql/
>
> And include is at:
>
> /usr/mysql/5.1/include/
>
> I have tried various combinations of things in CFLAGS, CPPFLAGS and
> LDFLAGS, but it doesn't change the configure error above at all. Eg:
>
> export CPPFLAGS="-I/usr/mysql/5.1/include/mysql"
> export CFLAGS="-I/usr/mysql/5.1/include/mysql"
> export LDFLAGS="-R/usr/mysql/5.1/lib/amd64/mysql
> -L/usr/mysql/5.1/lib/amd64/mysql"
> ./configure --prefix=/opt/dovecot --with-ldap --with-mysql
>
> Looking at config.log this section seems relevant:
>
> configure:22993: checking for mysql_config
> configure:23009: found /usr/mysql/bin/mysql_config
> configure:23021: result: mysql_config
> configure:23055: checking for mysql_init in -lmysqlclient
> configure:23080: gcc -o conftest -std=gnu99 -I/usr/mysql/5.1/include/mysql
> -Wall -W -Wmissing-prototypes -Wmissin
> g-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2
> -Wbad-function-cast -I/usr/mysql/5.1/include/mysql -R
> /usr/mysql/5.1/lib/amd64/mysql -L/usr/mysql/5.1/lib/amd64/mysql conftest.c
> -lmysqlclient -lnsl -lsocket -lrt -l
> sendfile -L/opt/SUNWspro/lib -lCrun -lrt -L/usr/mysql/5.1/lib/mysql
> -R/usr/mysql/5.1/lib/mysql -lmysqlclient -lz
> -lgen -lsocket -lnsl -lm -lz -lm >&5
> ld: fatal: library -lCrun: not found
> ld: fatal: file processing errors. No output written to conftest
> collect2: ld returned 1 exit status
> configure:23080: $? = 1
> configure: failed program was:
> | /* confdefs.h */
> ...snip...
> configure:23089: result: no
> configure:23198: error: Can't build with MySQL support: libmysqlclient
not
> found
>
>
> Note, I have not installed the Sun C compiler, so am compiling with gcc
> (/usr/bin/gcc 3.4.3). gmake is at /usr/bin/gmake and sun make is at
> /usr/bin/make. Perhaps I would more more luck with Sun's C compiler?
>
> Thank you
> Jesse
>
>
> --
>
> Jesse Reynolds
> Carbon Planet Limited - http://www.carbonplanet.com/
> Virtual Artists Pty Ltd - http://www.va.com.au/
>
--
Jesse Reynolds
Carbon Planet Limited - http://www.carbonplanet.com/
Virtual Artists Pty Ltd - http://www.va.com.au/