Compile PHP 5.3.6 with MySql on Sun Blade 1500 Solaris 10

Hello,

I'm trying to compile PHP 5.3.6 with Apache2 and MySql 5.5.12. I hit a problem that I can't seem to resolve by myself and I could not find a solution on the web.

It looks like Apache and MySql installed ok, I can start/stop them with no problem.

When I try to compile PHP the configure script fails with the error related to MySql.

# ./configure --with--apxs2=/usr/apache2/bin/apxs --with-mysql --with-zlib-dir=/usr/local/zlib

checking for mysql_close in -lmysqlclient... no
checking for mysql_error in -lmysqlclient... no
configure: error: mysql configure failed. Please check config.log for more information.

# more config.log

. . .   . . .  . . .

configure:59920: gcc -o conftest -I/usr/include -g -O2  -D_POSIX_PTHREAD_SEMANTICS -L/usr/lib  -R/usr/ucblib -L/usr/ucblib -R/usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3 -L/usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3 -R/usr/local/zlib/lib -L/usr/local/zlib/lib conftest.c -lmysqlclient  -lz -lrt -lm -lnsl -lsocket  -lgcc -lxml2 -lz -lm -lsocket -lnsl -lxml2 -lz -lm -lsocket -lnsl 1>&5
ld: fatal: file /usr/lib/libmysqlclient.so: wrong ELF class: ELFCLASS64
ld: fatal: File processing errors. No output written to conftest
collect2: ld returned 1 exit status
configure: failed program was:
#line 59909 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char mysql_close();

It looks to me that the problem is related to the face that MySql was compiled for 64 bits since the error says "wrong ELF class: ELFCLASS64"

On the web I found recommendations to include option -with-libdir=/usr/lib64
but /usr/lib64 does not exist on my workstation. In fact lib64 cannot be found anywhere on my hard drive.

I can't believe that I'm the first person facing this problem. Does anyone have experience with this?

Thank You,
Pavel.

64 bit libraries should not be in /usr/lib, they should be in /usr/lib/sparcv9 instead. And by the way, if you compile software yourself, it should not be in /usr at all. When I need to compile my own MySQL, I put it in /opt/mysql.

Please change your mysql build, so that the 32- and 64-bit MySQL libaries end up in the proper places. Then your PHP build should succeed too.

1 Like

Thank You,

I installed MySQL as a package (with pkgadm) downloaded from Oracle website. The only software that I'm trying to compile is PHP. MySQL installation directory is /opt/mysql/mysql so if mysql libraries ended up in /usr that's probably because Oracle wanted to put them there. Is it not a correct setup?

Pavel.

If the package you installed puts 64-bit libraries into /usr/lib instead of /usr/lib/sparcv9, then the package configuration is faulty.

As far as I know, the 64-bit MySQL package comes only with the 64-bit client libary and the 32-bit package only with the 32-bit client library. For your PHP configuration, you need the 32-bit library, so you better install the 32-bit MySQL package instead of the 64 bit one. If you don't have a huge database, the 32 bit database engine should work fine too.

1 Like

Thanks!

I will try using 32-bit MySQL. I just noticed that for MySQL 5.1.57 they still provide 32-bit package. It's not available for MySQL 5.5.12. Maybe that's the deal.

Regards,
Pavel.

Edit: This worked! Thank You very much!!