Header RSS Feed
 
If you only want to see the articles of a certain category, please click on the desired category below:
ALL Android Backup BSD Database Hacks Hardware Internet Linux Mail MySQL Monitoring Network Personal PHP Proxy Shell Solaris Unix Virtualization VMware Windows Wyse

PHP 5.4 fails to compile with g++ (use gcc instead)
Saturday - May 4th 2013 - by - (2 comments)

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.


 

Add a comment

Show form to leave a comment

Comments (newest first):

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.


Go to Homepage home
Linux Howtos how to's
Monitoring Plugins monitoring plugins
Links links

Valid HTML 4.01 Transitional
Valid CSS!
[Valid RSS]

7542 Days
until Death of Computers
Why?