<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
Overall the build process for dovecot is very clean. I did however run
into a significant problem when it came to locating the mysql
libraries, especially when building a 64 bit executable but similar
problems&nbsp; occured building a 32 bit executable. I am describing the 64
bit build issues below since that is the worst case scenario. Fixing
the 64 bit build will automatically fix the 32 bit build.<br>
<br>
In the Solaris world it is fairly common for software packages to be
installed in the /opt tree rather than under /usr or /usr/local. In
addition 64 bit libs are typically located under a path like
/opt/lib/64 or /opt/lib/sparcv9 and of course mysql libs are under
/opt/lib/mysql or /opt/lib/sparcv9 | 64/mysql. The configure script for
dovecot tries only a lib64 or /usr/lib64 path<br>
<br>
I suggest that the conifgure script for dovecot offer a
--with-mysql[=DIR] option so that it would be possible to provide the
base location of the mysql installation as --with-mysql=/opt in the
same manner that it is done for php.<br>
<br>
I patched the configure script to search the /opt tree for mysql but
unfortunately a side effect occured during the build which was compiled
as 64 bit with the necessary CFLAGS and LDFLAGS input to the configure
script.<br>
<br>
Here is the configure. Note that the library search paths also include
the Solaris specific sparcv9 paths so nothing special is required in
the configure script to account for these platform specific paths. This
is exactly the same method the we use to build php as a 64 bit app
successfully. However, the configrue script needs to locate the
/opt/include/mysql directory and also needs to find /opt/lib/mysql to
at least trigger that it found the mysql installation. Even though
/opt/lib/mysql is the path to the 32 bit library, the link tests will
pass because the supplied LDFLAGS contain the path to the 64 bit
library.<br>
<br>
CFLAGS="-O3 -m64 -mcpu=ultrasparc -L/opt/lib/sparcv9
-L/opt/lib/sparcv9/mysql -R/opt/lib/sparcv9 -R/opt/lib/sparcv9/mysql" \<br>
CXXFLAGS="-O3 -m64 -mcpu=ultrasparc -L/opt/lib/sparcv9
-L/opt/lib/sparcv9/mysql -R/opt/lib/sparcv9 -R/opt/lib/sparcv9/mysql" \<br>
LDFLAGS="-O3 -m64 -mcpu=ultrasparc -L/opt/lib/sparcv9
-L/opt/lib/sparcv9/mysql -R/opt/lib/sparcv9 -R/opt/lib/sparcv9/mysql" \<br>
./configure --prefix=/opt \<br>
--localstatedir=/var \<br>
--enable-shared \<br>
--disable-static \<br>
--libdir=/opt/lib/sparcv9 \<br>
--with-ssldir=/opt/ssl \<br>
--with-ssl=openssl \<br>
--with-storages=maildir,mbox \<br>
--with-mysql<br>
<br>
<br>
The next problem was that dovecot-auth failed to link:<br>
<br>
/bin/bash ../../libtool --tag=CC&nbsp;&nbsp; --mode=link gcc&nbsp; -std=gnu99 -O3 -m64
-mcpu=ultrasparc -L/opt/lib/sparcv9 -R/opt/lib/sparcv9 -Wall -W
-Wmissing-prototypes -Wmissing-declarations -Wpointer-arith
-Wchar-subscripts -Wformat=2 -Wbad-function-cast -I/opt/include&nbsp;&nbsp;&nbsp;
-export-dynamic -O3 -m64 -mcpu=ultrasparc -L/opt/lib/sparcv9
-R/opt/lib/sparcv9 -o dovecot-auth auth.o auth-cache.o
auth-client-connection.o auth-master-connection.o
auth-master-listener.o auth-module.o auth-request.o
auth-request-handler.o auth-stream.o auth-worker-client.o
auth-worker-server.o db-ldap.o db-sql.o db-passwd-file.o main.o mech.o
mech-anonymous.o mech-plain.o mech-login.o mech-cram-md5.o
mech-digest-md5.o mech-ntlm.o mech-gssapi.o mech-rpa.o mech-apop.o
passdb.o passdb-blocking.o passdb-bsdauth.o passdb-cache.o
passdb-ldap.o passdb-passwd.o passdb-passwd-file.o passdb-pam.o
passdb-checkpassword.o passdb-shadow.o passdb-sia.o passdb-vpopmail.o
passdb-sql.o userdb.o userdb-blocking.o userdb-ldap.o userdb-passwd.o
userdb-passwd-file.o userdb-prefetch.o userdb-static.o
userdb-vpopmail.o userdb-sql.o libpassword.a
../lib-settings/libsettings.a ../lib-ntlm/libntlm.a ../lib-sql/libsql.a
../lib/liblib.a -lpam&nbsp; -L -L/opt/lib/mysql -L/opt/lib/sparcv9/mysql
-lmysqlclient -lz -lm&nbsp; -export-dynamic -ldl -lsocket -lnsl -lrt<br>
mkdir .libs<br>
gcc -std=gnu99 -O3 -m64 -mcpu=ultrasparc -Wall -W -Wmissing-prototypes
-Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2
-Wbad-function-cast -I/opt/include -O3 -m64 -mcpu=ultrasparc -o
dovecot-auth auth.o auth-cache.o auth-client-connection.o
auth-master-connection.o auth-master-listener.o auth-module.o
auth-request.o auth-request-handler.o auth-stream.o
auth-worker-client.o auth-worker-server.o db-ldap.o db-sql.o
db-passwd-file.o main.o mech.o mech-anonymous.o mech-plain.o
mech-login.o mech-cram-md5.o mech-digest-md5.o mech-ntlm.o
mech-gssapi.o mech-rpa.o mech-apop.o passdb.o passdb-blocking.o
passdb-bsdauth.o passdb-cache.o passdb-ldap.o passdb-passwd.o
passdb-passwd-file.o passdb-pam.o passdb-checkpassword.o
passdb-shadow.o passdb-sia.o passdb-vpopmail.o passdb-sql.o userdb.o
userdb-blocking.o userdb-ldap.o userdb-passwd.o userdb-passwd-file.o
userdb-prefetch.o userdb-static.o userdb-vpopmail.o userdb-sql.o&nbsp;
-L/opt/lib/sparcv9 libpassword.a ../lib-settings/libsettings.a
../lib-ntlm/libntlm.a ../lib-sql/libsql.a ../lib/liblib.a -lpam
-L/db/src/dovecot/dovecot-1.0.rc17_64bit/src/auth -L/opt/lib/mysql
-L/opt/lib/sparcv9/mysql /opt/lib/mysql/libmysqlclient.so -L/opt/lib
-lposix4 -lgen -lssl -lcrypto -lz -lm -ldl -lsocket -lnsl -lrt
-R/opt/lib/mysql -R/opt/lib/mysql -R/opt/lib/sparcv9<br>
ld: fatal: file /opt/lib/mysql/libmysqlclient.so: wrong ELF class:
ELFCLASS32<br>
ld: fatal: File processing errors. No output written to dovecot-auth<br>
<br>
What is odd about the above is that the input to libtool is completely
correct but the resulting gcc command converted -lmysqlclient to an
absolute path of /opt/lib/mysql/libmysqlclient.so which is wrong for a
64 bit build - hence the link failure. Why this happened is a mystery
to me? If it had been left alone as -lmysqlclient the link would have
been successful because the correct 64 bit library would have been
found automatically.<br>
<br>
To get around this problem I added&nbsp; -lmysqlclient to the LDFLAGS input
to the configure script which works but isn't very conventional.<br>
<br>
It would be much cleaner if the --with-mysql had a [=DIR] option and
the configure script used the same basic logic that is used in the php
configure script for locating the mysql stuff. In addition it is
essential that hard paths, especially to shared objects don't get
generated during the build since that will block the automatic
searching of libraries.<br>
<br>
<div class="moz-signature">-- <br>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<table border="0" cellpadding="2" cellspacing="0" width="569">
  <tbody>
    <tr bgcolor="#000099" valign="middle">
      <td colspan="2"><font color="#ffffff"
 face="Verdana, Arial, Helvetica, sans-serif" size="2"><strong>Bob
Atkins </strong></font><font color="#ffffff">&nbsp;</font></td>
    </tr>
    <tr valign="middle">
      <td colspan="2"><font face="Verdana, Arial, Helvetica, sans-serif"
 size="1"><em>President/CEO</em></font></td>
    </tr>
    <tr valign="middle">
      <td width="233">
      <p align="center"><font
 face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font
 color="#000080"><span
 style="font-weight: bold; font-family: Trebuchet MS;"><a
 href="http://www.digilink.net"><img
 src="cid:part1.05080003.08060100@digilink.net" alt="DigiLink, Inc."
 style="border: 0px solid ; width: 216px; height: 48px;"></a></span></font></b><br>
      <font color="#006600">Business Inter-net-working</font><br>
      <font color="#000099"><strong><em>The Cure for the Common ISP!</em></strong></font></font></p>
      </td>
      <td width="328">
      <p align="right"><font color="#666666"
 face="Verdana, Arial, Helvetica, sans-serif" size="1">Phone: </font><font
 face="Verdana, Arial, Helvetica, sans-serif" size="1">(310) 577-9450<br>
      </font><font color="#666666"
 face="Verdana, Arial, Helvetica, sans-serif" size="1">Fax: </font><font
 face="Verdana, Arial, Helvetica, sans-serif" size="1">(310) 577-3360</font><font
 face="Verdana, Arial, Helvetica, sans-serif" size="1"><br>
      <font color="#666666">eMail:</font> <a class="moz-txt-link-abbreviated" href="mailto:bob@digilink.net">bob@digilink.net</a><br>
      </font></p>
      </td>
    </tr>
  </tbody>
</table>
<p>&nbsp; </p>
</div>
</body>
</html>