Today seems to be the perfect day to solve PHP compiling issues... (see previous articles, also from today).
So I tried to compile PHP 5.4.14 from source. configure ran through without error (after having solved some issues before, see articles "PHP 5.4 compilation error: build with IMAP works... no" and "Another confusing PHP 5.4 compilation error: This time mcrypt_module_open"). But then make always stopped at the same step with an error:
/bin/sh /root/downloads/php-5.4.14/libtool --silent --preserve-dup-deps --mode=compile g++ -I/usr/include -Iext/intl/ -I/root/downloads/php-5.4.14/ext/intl/ -DPHP_ATOM_INC -I/root/downloads/php-5.4.14/include -I/root/downloads/php-5.4.14/main -I/root/downloads/php-5.4.14 -I/root/downloads/php-5.4.14/ext/date/lib -I/root/downloads/php-5.4.14/ext/ereg/regex -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/include/imap -I/root/downloads/php-5.4.14/ext/mbstring/oniguruma -I/root/downloads/php-5.4.14/ext/mbstring/libmbfl -I/root/downloads/php-5.4.14/ext/mbstring/libmbfl/mbfl -I/root/downloads/php-5.4.14/ext/sqlite3/libsqlite -I/root/downloads/php-5.4.14/TSRM -I/root/downloads/php-5.4.14/Zend -c /root/downloads/php-5.4.14/ext/intl/msgformat/msgformat_helpers.cpp -o ext/intl/msgformat/msgformat_helpers.lo
env: g++: No such file or directory
make: *** [ext/intl/msgformat/msgformat_helpers.lo] Error 1
Of course I was googling for a solution, but nothing came up. When I almost gave up, I thought maybe the problem is the g++ compiler and installed the gcc c++ compiler, which would be installed normally on my machines, but this was a new setup test machine:
zypper in gcc-c++
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following NEW packages are going to be installed:
gcc-c++ gcc47-c++
Ran again configure and make, and this time it worked:
/bin/sh /root/downloads/php-5.4.14/libtool --silent --preserve-dup-deps --mode=compile cc -I/usr/include -Iext/intl/ -I/root/downloads/php-5.4.14/ext/intl/ -DPHP_ATOM_INC -I/root/downloads/php-5.4.14/include -I/root/downloads/php-5.4.14/main -I/root/downloads/php-5.4.14 -I/root/downloads/php-5.4.14/ext/date/lib -I/root/downloads/php-5.4.14/ext/ereg/regex -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/include/imap -I/root/downloads/php-5.4.14/ext/mbstring/oniguruma -I/root/downloads/php-5.4.14/ext/mbstring/libmbfl -I/root/downloads/php-5.4.14/ext/mbstring/libmbfl/mbfl -I/root/downloads/php-5.4.14/ext/sqlite3/libsqlite -I/root/downloads/php-5.4.14/TSRM -I/root/downloads/php-5.4.14/Zend -I/usr/include -g -O2 -fvisibility=hidden -c /root/downloads/php-5.4.14/ext/intl/msgformat/msgformat_format.c -o ext/intl/msgformat/msgformat_format.lo
/bin/sh /root/downloads/php-5.4.14/libtool --silent --preserve-dup-deps --mode=compile g++ -I/usr/include -Iext/intl/ -I/root/downloads/php-5.4.14/ext/intl/ -DPHP_ATOM_INC -I/root/downloads/php-5.4.14/include -I/root/downloads/php-5.4.14/main -I/root/downloads/php-5.4.14 -I/root/downloads/php-5.4.14/ext/date/lib -I/root/downloads/php-5.4.14/ext/ereg/regex -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/include/imap -I/root/downloads/php-5.4.14/ext/mbstring/oniguruma -I/root/downloads/php-5.4.14/ext/mbstring/libmbfl -I/root/downloads/php-5.4.14/ext/mbstring/libmbfl/mbfl -I/root/downloads/php-5.4.14/ext/sqlite3/libsqlite -I/root/downloads/php-5.4.14/TSRM -I/root/downloads/php-5.4.14/Zend -g -O2 -c /root/downloads/php-5.4.14/ext/intl/msgformat/msgformat_helpers.cpp -o ext/intl/msgformat/msgformat_helpers.lo
/bin/sh /root/downloads/php-5.4.14/libtool --silent --preserve-dup-deps --mode=compile cc -I/usr/include -Iext/intl/ -I/root/downloads/php-5.4.14/ext/intl/ -DPHP_ATOM_INC -I/root/downloads/php-5.4.14/include -I/root/downloads/php-5.4.14/main -I/root/downloads/php-5.4.14 -I/root/downloads/php-5.4.14/ext/date/lib -I/root/downloads/php-5.4.14/ext/ereg/regex -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/include/imap -I/root/downloads/php-5.4.14/ext/mbstring/oniguruma -I/root/downloads/php-5.4.14/ext/mbstring/libmbfl -I/root/downloads/php-5.4.14/ext/mbstring/libmbfl/mbfl -I/root/downloads/php-5.4.14/ext/sqlite3/libsqlite -I/root/downloads/php-5.4.14/TSRM -I/root/downloads/php-5.4.14/Zend -I/usr/include -g -O2 -fvisibility=hidden -c /root/downloads/php-5.4.14/ext/intl/msgformat/msgformat_parse.c -o ext/intl/msgformat/msgformat_parse.lo
Note that this time the cc compiler is used (--mode=compile cc). And this time PHP compiled without a problem.
Summary: DO NOT use g++ as a compiler.
Update May 5th 2013: This problem seems to be related to bug #63104 (php fail to build with --enable-intl) which mentions, that the wrong C libraries are linked.
ck from Wil, Switzerland wrote on Aug 3rd, 2014:
I just installed gcc and the compile process automatically used gcc as compiler.
Alex from Root wrote on Aug 1st, 2014:
Hello!
When I'm configuring PHP (before make or make install) I'm doing this:
=======================================================
./configure '--with-libdir=lib64' '--cache-file=../config.cache' '--prefix=/usr/local/php5431-cgi' '--with-config-file-path=/usr/local/php5431-cgi/etc' '--disable-debug' '--with-pic' '--disable-rpath' '--enable-fastcgi' '--with-bz2' '--with-curl' '--with-freetype-dir=/usr/local/php5431-cgi' '--with-png-dir=/usr/local/php5431-cgi' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr/local/php5431-cgi' '--with-openssl' '--with-pspell' '--with-pcre-regex' '--with-zlib' '--enable-exif' '--enable-ftp' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-wddx' '--with-kerberos' '--with-unixODBC=/usr' '--enable-shmop' '--enable-calendar' '--without-sqlite3' '--with-libxml-dir=/usr/local/php5431-cgi' '--enable-pcntl' '--with-imap' '--with-imap-ssl' '--enable-mbstring' '--enable-mbregex' '--with-gd' '--enable-bcmath' '--with-xmlrpc' '--with-ldap' '--with-ldap-sasl' '--with-mysql=/usr' '--with-mysqli' '--with-snmp' '--enable-soap' '--with-xsl' '--enable-xmlreader' '--enable-xmlwriter' '--enable-pdo' '--with-pdo-mysql' '--with-pdo-pgsql' '--with-pear=/usr/local/php5431-cgi/pear' '--with-mcrypt' '--enable-intl' '--without-pdo-sqlite' '--with-config-file-scan-dir=/usr/local/php5431-cgi/php.d'
============================================================
How to specify in this case to use GCC instead of G++ ?
Waiting for your respod,
Thank you.
AWS Android Ansible Apache Apple Atlassian BSD Backup Bash Bluecoat CMS Chef Cloud Coding Consul Containers CouchDB DB DNS Database Databases Docker ELK Elasticsearch Filebeat FreeBSD Galera Git GlusterFS Grafana Graphics HAProxy HTML Hacks Hardware Icinga Influx Internet Java KVM Kibana Kodi Kubernetes LVM LXC Linux Logstash Mac Macintosh Mail MariaDB Minio MongoDB Monitoring Multimedia MySQL NFS Nagios Network Nginx OSSEC OTRS Office OpenSearch PGSQL PHP Perl Personal PostgreSQL Postgres PowerDNS Proxmox Proxy Python Rancher Rant Redis Roundcube SSL Samba Seafile Security Shell SmartOS Solaris Surveillance Systemd TLS Tomcat Ubuntu Unix VMWare VMware Varnish Virtualization Windows Wireless Wordpress Wyse ZFS Zoneminder