php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63104 php fail to build with --enable-intl
Submitted: 2012-09-17 21:19 UTC Modified: 2016-03-06 05:59 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:2 of 3 (66.7%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: maduma at pt dot lu Assigned:
Status: Open Package: Compile Failure
PHP Version: 5.4.7 OS: Solaris 11
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-09-17 21:19 UTC] maduma at pt dot lu
Description:
------------
compiler: solarisstudio 12.3
os: solaris 11
arch: sparc
icu: 4.6


./configure --prefix=/usr/php/5.4 --sysconfdir=/etc/php/5.4 \
        --mandir=/usr/php/5.4/man --with-config-file-path=/etc/php/5.4 \
        --enable-intl
...
/bin/sh /root/php/php-5.4.7/libtool --silent --preserve-dup-deps --mode=link cc -export-dynamic -I/usr/include -O ... -lnsl  -o sapi/cli/php
Undefined                       first referenced
 symbol                             in file
_ZN6icu_4911Formattable7setDateEd   ext/intl/msgformat/msgformat_helpers.o
_ZTVN6icu_4913FieldPositionE        ext/intl/msgformat/msgformat_helpers.o
_ZN6icu_4911Formattable7setLongEi   ext/intl/msgformat/msgformat_helpers.o
_ZN6icu_4913UnicodeStringD1Ev       ext/intl/msgformat/msgformat_helpers.o
_ZN6icu_4913UnicodeStringC1Ev       ext/intl/msgformat/msgformat_helpers.o
_ZNK6icu_4911Formattable7getTypeEv  ext/intl/msgformat/msgformat_helpers.o
_ZNK6icu_4913MessageFormat6formatEPKNS_11FormattableEiRNS_13UnicodeStringERNS_13FieldPositionER10UErrorCode ext/intl/msgformat/msgformat_helpers.o
_ZN6icu_4913UnicodeStringC1EPKt     ext/intl/msgformat/msgformat_helpers.o
_ZN6icu_4911Formattable9setStringERKNS_13UnicodeStringE ext/intl/msgformat/msgformat_helpers.o
_ZN6icu_4913UnicodeStringC1EPKti    ext/intl/msgformat/msgformat_helpers.o
_ZN6icu_4913UnicodeStringaSERKS0_   ext/intl/msgformat/msgformat_helpers.o
_ZNK6icu_4913UnicodeString7extractEPtiR10UErrorCode ext/intl/msgformat/msgformat_helpers.o
_ZN6icu_497UMemorynaEj              ext/intl/msgformat/msgformat_helpers.o
_ZN6icu_4911FormattableC1Ev         ext/intl/msgformat/msgformat_helpers.o
_Unwind_Resume                      ext/intl/msgformat/msgformat_helpers.o  (symbol belongs to implicit dependency /usr/lib/libgcc_s.so.1)
_ZN6icu_497UMemorydaEPv             ext/intl/msgformat/msgformat_helpers.o
_ZN6icu_4911Formattable9setDoubleEd ext/intl/msgformat/msgformat_helpers.o
_ZN6icu_4913FieldPositionD1Ev       ext/intl/msgformat/msgformat_helpers.o
_ZN6icu_4911Formattable8setInt64Ex  ext/intl/msgformat/msgformat_helpers.o
ld: fatal: symbol referencing errors. No output written to sapi/cli/php
make[1]: *** [sapi/cli/php] Error 2
make[1]: Leaving directory `/root/php/php-5.4.7'
make: *** [compile] Error 2



Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-09-18 03:26 UTC] laruence@php.net
what's your icu version?

$icu-config --version
 [2012-09-18 03:26 UTC] laruence@php.net
-Status: Open +Status: Feedback
 [2012-09-18 07:14 UTC] maduma at pt dot lu
root@build-sparc:~# icu-config --version
4.6
 [2012-09-18 07:14 UTC] maduma at pt dot lu
-Status: Feedback +Status: Open
 [2012-09-18 07:52 UTC] maduma at pt dot lu
It seems that the build use g++ compiler for c++ and cc for c compiler
I've now defined cc and CC env variable

cc=/opt/solarisstudio12.3/bin/cc CXX=/opt/solarisstudio12.3/bin/CC \
./configure --prefix=/usr/php/5.4 --sysconfdir=/etc/php/5.4 \
--mandir=/usr/php/5.4/man --with-config-file-path=/etc/php/5.4 \
--enable-intl

The build failed also in the linker

/bin/sh /root/php/php-5.4.7/libtool --silent --preserve-dup-deps --mode=link cc -export-dynamic -I/usr/include -O -xs -xstrconst -zlazyload -xmemalign=8s     ext/date/php_date.lo ...  -lstdc++ -lrt -lm -lnsl -lsocket -lxml2 -lz -lm -lsocket -lnsl -lxml2 -lz -lm -lsocket -lnsl -lCrun -lCstd -lm -licui18n -licuuc -licudata -lm -licuio -lxml2 -lz -lm -lsocket -lnsl -lxml2 -lz -lm -lsocket -lnsl -lxml2 -lz -lm -lsocket -lnsl -lxml2 -lz -lm -lsocket -lnsl  -o sapi/cli/php
ld: fatal: library -lstdc++: not found
ld: fatal: file processing errors. No output written to sapi/cli/php

Why do the we need stdc++ (g++ related) !
I just removed -lstdc++ and it working now.

Need to test it now
 [2012-09-18 11:09 UTC] maduma at pt dot lu
Need also to create libCstd.so and libCrun.so link

ln -s /usr/lib/libCstd.so.1 /usr/lib/libCstd.so
ln -s /usr/lib/libCrun.so.1 /usr/lib/libCrun.so
 [2012-09-19 07:46 UTC] maduma at pt dot lu
Still have problems with intl extention. When i compile 5.4 with intl the proc_open() function is not defined anymore

# --with-intl
/usr/php/5.4/bin/php -r 'proc_open();'
PHP Fatal error:  Call to undefined function proc_open() in Command line code on line 1

# without intl
/usr/php/5.4/bin/php -r 'proc_open();'
PHP Warning:  proc_open() expects at least 3 parameters, 0 given in Command line code on line 1
 [2012-09-19 08:03 UTC] laruence@php.net
I can not reproduce it:
$php -m | grep intl
intl

$php -r 'proc_open("ls");'
PHP Warning:  proc_open() expects at least 3 parameters, 1 given in Command line 
code on line 1
 [2012-09-19 16:26 UTC] reeze@php.net
similar to https://bugs.php.net/bug.php?id=48795 but different platform.
 [2012-09-20 12:21 UTC] johannes@php.net
-Status: Open +Status: Analyzed -Assigned To: +Assigned To: bjori
 [2012-09-20 12:21 UTC] johannes@php.net
The actual issue is that we're linking using the C compiler, not the C++ compiler. The later would pull the correct C++ libs in.

What we have to do is

1) go through all SAPI config.m4's and modify their linker calls to either use CC or CXX depending on i.e. $php_cxx_done
2) remove PHP_ADD_LIBRARY(stdc++) from AC_DEFUN([PHP_REQUIRE_CXX]
3) make sure none of our bundled libs has issues when linked with C++ standard libs (especially as they might depend on a lib pulling a different C++ runtime in ...)

Then we're done. But step 3 is rather complicated. Better would be if libintl itself would pull in the proper C++ runtime but we don't have control over that.

A work-around is to only do step 2 from that list and have the user build the intl extension shared. In that case we already use the C++ compiler for linking the .so/.dynlib/...

Assigning to Hannes, who added the explicit linkage to libstdc++. Maye he has some thoughts or feels brave enough to us C++ for linkage ;-)
 [2016-03-06 05:59 UTC] bjori@php.net
-Status: Analyzed +Status: Open -Assigned To: bjori +Assigned To:
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Aug 29 15:01:52 2017 UTC