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 :)
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???
Related
I'm currently installing PHP with GD library from sources on a RedHat7 server and I'm facing some issues.
I configure PHP with this command:
./configure --with-apxs2=/server/lib/httpd/bin/apxs --with-pdo-mysql --with-config-file-path=/server/php-7.3.9/conf --with-libxml-dir=/server/lib/libxml2 --with-curl=/server/lib/curl --with-gd --enable-mbstring --with-jpeg-dir=/server/lib/libjpeg --with-png-dir=/server/lib/libpng –with-webp-dir=/server/lib/webp
It works but when I'm doing the make command I have this error:
/bin/ld: /server/lib/webp/lib/libwebp.a(picture_enc.o): relocation R_X86_64_PC32 against symbol `WebPMemoryWrite' can not be used when making a shared object; recompile with -fPIC
/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make: *** [libphp7.la] Error 1
I also tried to compile and install it without webp (It's not required in the PHP documentation: php doc) but I have this error :
ext/gd/libgd/.libs/gd_webp.o: In function `gdImageCreateFromWebpCtx':
/server/php-7.3.9/ext/gd/libgd/gd_webp.c:68: undefined reference to `WebPGetInfo'
/sever/php-7.3.9/ext/gd/libgd/gd_webp.c:79: undefined reference to `WebPDecodeARGB'
ext/gd/libgd/.libs/gd_webp.o: In function `gdImageWebpCtx':
/server/php-7.3.9/ext/gd/libgd/gd_webp.c:153: undefined reference to `WebPEncodeRGBA'
collect2: error: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
So it seems to be required.
Can you please help me to solve this
Thanks
I resolved my issue by replacing my installation of webp package.
At first I used the pre-compiled linux package and replacing it by native sources and a compiling, make & make install solve the problem.
Thanks all
I am trying to compile the swig interface of crfsuite as a PHP module. So far I've managed to actually compile a crfsuite.so file, load it as an extension in PHP and call methods on it. As far as I can see any method call that was wrapped by SWIG works fine out of the box. Unfortunately I seem to be missing some symbols:
❯ nm crfsuite.so | grep crfsuite
U crfsuite_attribute_set
U crfsuite_create_instance
U crfsuite_create_instance_from_file
U crfsuite_create_instance_from_memory
U crfsuite_data_append
U crfsuite_data_finish
U crfsuite_data_init
00000000000281b3 T crfsuite_dictionary_create_instance
U crfsuite_evaluation_accmulate
U crfsuite_evaluation_finalize
U crfsuite_evaluation_init
U crfsuite_evaluation_output
0000000000256460 B crfsuite_globals
U crfsuite_instance_finish
U crfsuite_instance_init_n
U crfsuite_interlocked_decrement
U crfsuite_interlocked_increment
U crfsuite_item_append_attribute
U crfsuite_item_init
U crfsuite_item_init_n
I have generated the swig wrapper like so, using the default export.i:
swig -c++ -php7 -Icrfsuite/include -o export_wrap.cpp export.i
After that I've compiled the code with the following commands:
gcc -fpic -Icrfsuite/include -Icrfsuite/lib/cqdb/include -Iliblbfgs/include \
`php-config --includes` -c crfsuite.cpp export_wrap.cpp crfsuite/lib/crf/src/*.c \
crfsuite/swig/*.cpp crfsuite/lib/cqdb/src/cqdb.c crfsuite/lib/cqdb/src/lookup3.c \
liblbfgs/lib/*.c
gcc -shared *.o -o crfsuite.so
I've played with many gcc flags such as -L/usr/local/lib, -lcrfsuite, -Wl,-undefined,dynamic_lookup but stopped as they didn't seem to affect the result.
Running a basic example errors with the following message:
/usr/bin/php: symbol lookup error: /usr/lib/php/20170718/crfsuite.so: undefined symbol: crfsuite_data_init
The example correctly calls the Trainer constructor.
This all is quite new so I am lost between the many steps. Am I missing something obvious? Why are the symbols not linked correctly? And how can it be fixed?
Update:
I've set the $LD_LIBRARY_PATH and $LD_RUN_PATH to /usr/local/lib. That is also where the compiled and installed version of the crfsuite lies as a shared object:
ll $LD_LIBRARY_PATH/libcrfsuite.so
/usr/local/lib/libcrfsuite.so -> libcrfsuite-0.12.so
I have also changed the order of .o files. Didn't change anything.
CentOS release 6.7 (centos-release-6-7.el6.centos.12.3.x86_64)
kernel 2.6.32-573.22.1.el6.x86_64
We had successfully built the mongo-php-driver with the instructions found here
Last week I spun up a new instance, patched it via yum update, and tried to build - and I'm consistently getting this error now:
>> make install
Installing shared extensions: /usr/lib64/php/modules/
>> service php-fpm restart
Stopping php-fpm: [ OK ]
Starting php-fpm: [12-Apr-2016 14:38:39] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mongodb.so' - /usr/lib64/php/modules/mongodb.so: undefined symbol: bson_decimal128_from_string in Unknown on line 0
The build returns no errors, and seems to build the bson libraries as it goes:
checking for uint64_t... yes
... seen our uintptr_t in stdint.h (uint64_t too)
creating ./src/libbson/src/bson/bson-stdint.h : ___SRC_LIBBSON_SRC_BSON_BSON_STDINT_H
checking for int_least32_t... yes
checking for int_fast32_t... yes
..adding include stdint.h
... seen good stdint.h inttypes
... seen good uint64_t
... DONE ./src/libbson/src/bson/bson-stdint.h
* snip *
Build configuration:
CFLAGS : -g -O2
Extra CFLAGS : -pthread
Developers flags (slow) :
Code Coverage flags (extra slow) :
System mongoc : no
System libbson : no
LDFLAGS :
EXTRA_LDFLAGS :
MONGODB_SHARED_LIBADD : -lsasl2 -lssl -lcrypto -lrt
So far I have tried (and failed):
Deleting the mongodb.so file, repulling from github, and rebuilding
Descending into the src/libbson directory, building there, then
ascending and building again
Removing any packages containing bson (which include libbson and libbson-devel) using yum, in case it was building agains the wrong lib
My google-fu has failed me, and I can't find anything on SO about it. Anyone hit this kind of issue, or know a fix?
I try to cross compile PHP 5.3.25 for arm-merlin on x86_64 linux.
My configure command looks like the following:
export CC=/opt/mobilygen/tools/arm-merlin-linux-uclibc/i686-linux/bin/arm-merlin-linux-uclibc-gcc
./configure --prefix=/opt/php --host=arm-merlin-linux-uclibc --target=arm-merlin-linux-uclibc --build=x86_64-linux --without-iconv --without-pear --disable-ipv6 --without-openssl --without-sqlite --without-sqlite3 --disable-pdo --without-pdo-sqlite --with-libxml-dir=/opt/libxml2/ --includedir=/opt/mobilygen/tools/arm-merlin-linux-uclibc-SDK7r4552/i686-linux/arm-merlin-linux-uclibc/usr/include
The linker fails with:
ext/standard/php_crypt_r.o: In function `_crypt_extended_init_r':
/projects/php/php-5.3.25/ext/standard/php_crypt_r.c:101: undefined reference to `membar_producer'
/projects/php/php-5.3.25/ext/standard/php_crypt_r.c:102: undefined reference to `atomic_add_int'
collect2: ld returned 1 exit status
make: *** [sapi/cgi/php-cgi] Error 1
It seems that the SDK doesn't provide the correct sys/atomic.h library.
Is there a workaround for this? It would be also ok if the MD5 functionality is stripped.
Am using Tomcat 6. I have installed PHP and try to get PHP running inside Tomcat with PHP/JavaBridge. I have deployed JavaBridge.war inside Tomcat's webapps directory. When running any PHP script, I will get this error below. Please help and I thank you for your assistance.
This was how I configure PHP:
./configure --with-mime-magic
--with-config-file-path=/usr/local/Zend/etc
--with-apxs2=/usr/local/apache2/bin/apxs
--with-libxml-dir=/usr
--with-mhash=/usr/local
--with-bz2=/usr
--with-curl=/usr
--with-gettext=/usr
--with-mysql=/usr/local/mysql
--with-mcrypt=/usr/local
--enable-magic-quotes
--enable-bcmath
--enable-calendar
--enable-ftp
--enable-sockets
--enable-wddx
--enable-mbstring
--enable-zip
--enable-exif
--with-gd=/usr
--with-freetype-dir=/usr
--with-jpeg-dir=/usr
--with-png-dir=/usr
--enable-gd-native-ttf
--enable-fastcgi
--enable-force-cgi-redirect
The error msgs from Tomcat as follows:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented
it from fulfilling this request.
exception
javax.servlet.ServletException:
php.java.bridge.http.FCGIConnectException: Could not connect to server
php.java.servlet.fastcgi.FastCGIServlet.init(FastCGIServlet.java:133)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
java.lang.Thread.run(Thread.java:662) root cause
php.java.bridge.http.FCGIConnectException: Could not connect to server
php.java.bridge.http.SocketChannelFactory.test(SocketChannelFactory.java:58)
php.java.servlet.fastcgi.FastCGIServlet.init(FastCGIServlet.java:131)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
java.lang.Thread.run(Thread.java:662) root cause
java.io.IOException: java.net.ConnectException: Connection refused
php.java.bridge.http.FCGIConnectException.(FCGIConnectException.java:37)
php.java.bridge.http.SocketChannelFactory.test(SocketChannelFactory.java:58)
php.java.servlet.fastcgi.FastCGIServlet.init(FastCGIServlet.java:131)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
java.lang.Thread.run(Thread.java:662) root cause
java.io.IOException: PHP not found. Please install php-cgi. PHP test
command was: [php-cgi, -v]
php.java.bridge.Util$Process.start(Util.java:1145)
php.java.servlet.fastcgi.FCGIProcess.start(FCGIProcess.java:68)
php.java.bridge.http.SocketChannelFactory.doBind(SocketChannelFactory.java:125)
php.java.bridge.http.FCGIConnectionFactory.runFcgi(FCGIConnectionFactory.java:88)
php.java.bridge.http.FCGIConnectionFactory$1.run(FCGIConnectionFactory.java:109)
note The full stack trace of the root cause is available in the Apache
Tomcat/6.0.29 logs.
Apache Tomcat/6.0.29
I had the same error as yours,
the key point you are missing here is :
PHP CLI(Command Line Interface) needs to be setup to work with java-php
bridge
as you claim to have installed PHP(any means XAMPP/WAMP)
Go through the following steps :
Add PHP to PATH environment variable - Help
Confirm the configuration by Run CMD>
php-cgi -v
By the above command you will see PHP version info
Restart Tomcat
PHP/JavaBridge should start working after this.
I had the same problem. Another suggestion had been to add
-Dphp.java.bridge.php_exec=/usr/bin/php
to the command line. Instead, I modified the JAVA_OPTS export in my catalina.sh file to add it. That didn't work, but I combined it with the suggestion above and added
-Dphp.java.bridge.php_exec=/usr/bin/php-cgi
to catalina.sh. I bounced the server and connected to server/JavaBridgeTemplate621/ and got the PHP/Java Bridge settings page.
Reinstall and enable fastcgi it worked for me!