1
votes

I'm trying to build PHP 7.4 on Solaris sparc 10, but I'm getting this error:

d_objects.lo Zend/zend_object_handlers.lo Zend/zend_objects_API.lo Zend/zend_default_classes.lo Zend/zend_inheritance.lo Zend/zend_smart_str.lo Zend/zend_cpuinfo.lo Zend/zend_execute.lo sapi/apache2handler/mod_php7.lo sapi/apache2handler/sapi_apache2.lo sapi/apache2handler/apache_config.lo sapi/apache2handler/php_functions.lo main/internal_functions.lo -lresolv -lrt -liconv -lintl -lrt -lm -lnsl -lsocket -lgcc -o libphp7.la ld: fatal: file /usr/local/lib/libiconv.so: wrong ELF class: ELFCLASS32 ld: fatal: file processing errors. No output written to .libs/libphp7.so *** Error code 1 make: Fatal error: Command failed for target `libphp7.la'

My configure is as follows:

./configure --disable-xmlwriter --disable-xmlreader --disable-simplexml --disable-xml --disable-dom --with-apxs2=/usr/apache2/bin/apxs --with-gd --with-zlib --disable-ipv6 --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --without-pear --with-openssl --with-mysqli --enable-bcmath --enable-ctype --enable-mbstring --with-gettext --prefix=/usr/php --without-libxml OPENSSL_CFLAGS=-I/usr/include/openssl OPENSSL_LIBS=-L/usr/local/ssl/include SQLITE_CFLAGS=-I/usr/php/include/php/ext SQLITE_LIBS=-L/usr/php/include/php/ext ZLIB_CFLAGS=-I/usr/include ZLIB_LIBS=-L/usr/include ONIG_CFLAGS=-I/usr/local/include/php/ext/mbstring ONIG_LIBS=-L/local/include/php/ext/mbstring
--with-external-pcre
--with-pcre-jit
PCRE2_LIBS=-L/app/INSTALL_FILES/php-7.4.13/ext/pcre/pcre2lib
PCRE2_CFLAGS=-I/app/INSTALL_FILES/php-7.4.13/ext/pcre/pcre2lib
SQLITE_LIBS=-L/app/INSTALL_FILES/php-7.2.5/ext/sqlite3/libsqlite
SQLITE_CFLAGS=-I/app/INSTALL_FILES/php-7.2.5/ext/sqlite3/libsqlite

Environment is set as follows:

$ env|grep LD

LDFLAGS=-L/opt/csw/lib/gcc -L/usr/local/lib -R/opt/csw/lib/gcc

LD_LIBRARY_PATH_64=/opt/csw/lib/sparcv9:/usr/local/64/lib:/usr/sfw/lib/sparcv9

LD_LIBRARY_PATH=/opt/csw/bin/sparcv9:/opt/csw/lib/sparcv9:/usr/local/include/php/ext/sqlite3/libsqlite:/opt/csw/lib:/usr/local/64/lib:/usr/sfw/lib/sparcv9:/usr/apache2.2/pcre/lib:/usr/apache2.2/apr_util/lib:/usr/apache2.2/apr/lib

LD_LIBRARY_PATH_32=/usr/local/include/php/ext/sqlite3/libsqlite:/opt/csw/lib:/usr/apache2.2/pcre/lib:/usr/apache2.2/apr_util/lib:/usr/apache2.2/apr/lib

Any help would be much appreciated, thanks in advance :)

1
Are you building a 32 or 64 bit version? - Nigel Ren
Take a moment to read through the editing help in the help center. Formatting on Stack Overflow is different than on other sites. The better your post looks, the easier it is for others to read and understand it. - Dharman

1 Answers

1
votes

You are building a 64-bit executable with the following environment variable set:

LD LDFLAGS=-L/opt/csw/lib/gcc -L/usr/local/lib -R/opt/csw/lib/gcc

Given this error:

ld: fatal: file /usr/local/lib/libiconv.so: wrong ELF class: ELFCLASS32

The shared object /usr/local/lib/libiconv.so is a 32-bit shared object.

You can either remove directories that have 32-bit binaries in them from your LD_* environment variables when building or running 64-bit binaries, or make sure the contents of any of those directories are all 32- or 64-bit if there's a 64-bit library in /usr/local/lib that you need.

You need to read the ENVIRONMENT VARIABLES section of the Solaris 10 ld.so.1 man page:

Environment Variables

Each environment variable can be specified with a _32 or _64 suffix. This makes the environment variable specific, respectively, to 32–bit or 64–bit processes. This environment variable overrides any non-suffixed version of the environment variable that might be in effect. Environment variables specified without a value, that have a _32 or _64 suffix, effectively cancel any associated generic environment variable setting.

You're mixing a lot of LD_* environment variables with and without the _32 and _64 suffixes, and you need to clean that up and be consistent so you don't wind up mixing 32- and 64-bit executable files.

And this looks downright wrong:

ZLIB_LIBS=-L/usr/include

Libraries in /usr/include???