Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We are currently running PHP 5.2.13 on a Solaris 10 server. I need to enable some additional features so I went to run the configure script but I'm getting some errors.

I did an 'export CFLAGS="-m64"' to make sure GCC compiled in 64-bit mode, but it looks like I don't have a 64-bit version of libiconv.so. I've tried running the script with '--without-iconv' but no dice. Here's the end of my config.log:

configure:20017: checking for strftime
configure:20471: checking whether to enable LIBXML support
configure:20519: checking libxml2 install dir
configure:20548: checking for xml2-config path
configure:20706: checking whether libxml build works
configure:20733: gcc -o conftest -m64  -D_POSIX_PTHREAD_SEMANTICS  -R/usr/ucblib -L/usr/ucblib -R/usr/local/lib/../lib/gcc/sparc-sun-solaris2.10/3.4.6 -L/usr/local/lib/../lib/gcc/sparc-sun-solaris2.10/3.4.6 -R/usr/local/lib -L/usr/local/lib conftest.c 

     -lrt -lresolv -lm -lnsl -lsocket  -lgcc -lxml2 -lz -liconv -lm -lsocket -lnsl 1>&5
ld: fatal: file /usr/local/lib/libiconv.so: wrong ELF class: ELFCLASS32
ld: fatal: File processing errors. No output written to conftest
collect2: ld returned 1 exit status
configure: failed program was:
#line 20722 "configure"
#include "confdefs.h"


    char xmlInitParser();
    int main() {
      xmlInitParser();
      return 0;
    }

Is there any way around this? I've been banging my head against this since yesterday. If it helps, here's my configure line:

./configure  --prefix=/usr/local/php --with-config-file-path=/usr/local/php/lib --with-libxml-dir=/usr/local --with-zlib=/usr/local --with-xpm-dir=/usr/local --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-apxs2=/usr/local/apache2/bin/apxs --without-pgsql --with-jpeg-dir=/usr/local/lib --with-zlib-dir=/usr/local/lib --with-gd=/usr/local --enable-mbstring --enable-exif --enable-force-cgi-redirect --enable-sockets --with-png-dir=/usr/local/lib --with-curl=/usr/local --with-ldap=/usr/local --with-openssl=/usr/local/ssl --with-gettext --with-pcre-dir=/usr/local --with-freetype-dir=/usr/local --with-mssql=/usr/local/freetds --with-readline --enable-soap
share|improve this question

2 Answers 2

up vote 2 down vote accepted

This has always been my biggest hassle with Solaris. Essentially if you're going to compile something, you need to make sure ALL of the following are correct:

  • CFLAGS / CXXFLAGS (for C++)
  • LDFLAGS (for the linker)
  • Possibly LD_LIBRARY_PATH

Make sure any include dirs (specified with -I) and library dirs (-R and/or -L) match the architecture you're building for. For Solaris, gcc often looks at /usr/lib, /usr/sfw/lib etc first, but if you want 64-bit then you need to compile against /usr/lib/64, /usr/sfw/lib/64, etc - specifying gcc -m64 isn't enough for it to do this.

You can verify the ISA of the existing iconv library using ldd and file. If you compiled libiconv yourself, you'll need to recompile it, otherwise find another binary source or... recompile it :-)

share|improve this answer
    
The existing iconv library is definitely 32-bit. It was on the server already, so I don't know how to compile it for 64-bit. The crazy thing is, PHP is already installed on this server so I have no idea how they got it to work last time... –  Derek Apr 5 '12 at 13:17
    
The existing PHP must be 32-bit then. Have you checked with ldd and file? If you want your PHP to be 64-bit then you'll have to recompile everything it depends on too. I ended up writing a system based on FreeBSD ports to make compiling on Solaris less painful. netinertia.co.uk/hg/solports –  James O'Gorman Apr 5 '12 at 22:46

In my case, to compile PHP 5.4.7 I had to add the PHP_LDFLAGS env var as well: LDFLAGS="-L/opt/selfcompiled/libs/64 -L/lib/64 -L/usr/sfw/lib/64 -m64" PHP_LDFLAGS=$LDFLAGS

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.