# Cannot build ext/intl on Fedora 15

- Thread: https://externals.io/message/58088
- Original archive: https://news-web.php.net/php.internals/58088
- Started by Tom Boutell on 2012-02-26T19:19:53+00:00
- Messages: 11
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #58088 — Tom Boutell — 2012-02-26T19:19:53+00:00

URL: https://externals.io/message/58088#58088

Bump - this is still a live issue on Ubuntu 11.10, for instance.

I just hacked my Ubuntu PHP-from-source installer to touch up the
Makefile by prepending -lstdc++ to EXTRA_LIBS. That does the job.

Which I knew more about autoconf, I'd like to help figure this out
properly so everyone doesn't wind up maintaining hacks to compile PHP
from source. It discourages a very large community from trying new
releases.

Is this perhaps because some of the code being included in the PHP
build happens to be C++ code? (Not readily apparent from the outside
of course.)

-- 
Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com

---

## #58089 — Rasmus Lerdorf — 2012-02-26T19:22:08+00:00

URL: https://externals.io/message/58088#58089 · In reply to: #58088

> Bump - this is still a live issue on Ubuntu 11.10, for instance.
> 
> I just hacked my Ubuntu PHP-from-source installer to touch up the
> Makefile by prepending -lstdc++ to EXTRA_LIBS. That does the job.
> 
> Which I knew more about autoconf, I'd like to help figure this out
> properly so everyone doesn't wind up maintaining hacks to compile PHP
> from source. It discourages a very large community from trying new
> releases.
> 
> Is this perhaps because some of the code being included in the PHP
> build happens to be C++ code? (Not readily apparent from the outside
> of course.)
> 

My dev box is Ubuntu 11.10 and I have no issues building ext/intl.

-Rasmus

---

## #58090 — Tom Boutell — 2012-02-26T19:34:46+00:00

URL: https://externals.io/message/58088#58090 · In reply to: #58089

Hmm.

Here is my apt-get install line, starting from a stock install of
11.10 in virtualbox:

apt-get -y install build-essential apache2 libxml2-dev libcurl4-openssl-dev \
  libcurl4-openssl-dev libjpeg-dev libpng-dev libfreetype6-dev libicu-dev \
  libmcrypt-dev mysql-server mysql-client libmysqlclient-dev libxslt-dev \
  autoconf libltdl-dev

Then I pull down 5.3.10, cd to it and run this configure line:

'./configure' '--enable-fastcgi' '--with-gd' '--with-pdo-mysql'
'--with-curl' '--with-mysql' '--with-freetype-dir=/usr'
'--with-jpeg-dir=/usr' '--with-mcrypt' '--with-zlib'
'--enable-mbstring' '--enable-ftp' '--with-xsl' '--with-openssl'
'--with-kerberos' '--enable-exif' '--enable-intl'

I then run 'make', which bombs with the error mentioned at link time
unless I add -lstdc++ manually.

Anyone see a missing package that makes build-essential a little more
essential? (:

I'll try this again in a fresh install of ubuntu 11.x (shoot, forgot
to take a virtualbox snapshot last time).


> 
> > […]
>
> My dev box is Ubuntu 11.10 and I have no issues building ext/intl.
>
> -Rasmus



-- 
Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com

---

## #58091 — Hannes Magnusson — 2012-02-26T19:39:28+00:00

URL: https://externals.io/message/58088#58091 · In reply to: #58090

> Hmm.
>
> Here is my apt-get install line, starting from a stock install of
> 11.10 in virtualbox:
>
> apt-get -y install build-essential apache2 libxml2-dev libcurl4-openssl-dev \
>  libcurl4-openssl-dev libjpeg-dev libpng-dev libfreetype6-dev libicu-dev \
>  libmcrypt-dev mysql-server mysql-client libmysqlclient-dev libxslt-dev \
>  autoconf libltdl-dev
>
> Then I pull down 5.3.10, cd to it and run this configure line:
>
> './configure' '--enable-fastcgi' '--with-gd' '--with-pdo-mysql'
> '--with-curl' '--with-mysql' '--with-freetype-dir=/usr'
> '--with-jpeg-dir=/usr' '--with-mcrypt' '--with-zlib'
> '--enable-mbstring' '--enable-ftp' '--with-xsl' '--with-openssl'
> '--with-kerberos' '--enable-exif' '--enable-intl'

The quick fix is to build it shared, not statically.
See also http://php.markmail.org/message/z2qkmbipmhhpwzx4

-Hannes

---

## #58092 — Tom Boutell — 2012-02-26T19:43:21+00:00

URL: https://externals.io/message/58088#58092 · In reply to: #58091

If what I did is basically already in 5.4 and won't be finding its way
back to 5.3, I guess I'm good with my hack for now.

What component are you suggesting I build shared?

On Sun, Feb 26, 2012 at 2:39 PM, Hannes Magnusson
<hannes.magnusson@gmail.com> wrote:
> 
> > […]
>
> The quick fix is to build it shared, not statically.
> See also http://php.markmail.org/message/z2qkmbipmhhpwzx4
>
> -Hannes



-- 
Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com

---

## #58098 — Rasmus Lerdorf — 2012-02-26T22:34:03+00:00

URL: https://externals.io/message/58088#58098 · In reply to: #58092

> If what I did is basically already in 5.4 and won't be finding its
> way back to 5.3, I guess I'm good with my hack for now.

Interesting, I never noticed it, but I tried your exact configure
switches and I was able to reproduce it. Here is what I use on Ubuntu
11.10 and it works fine:

'./configure' \
'--with-curlwrappers' \
'--enable-zend-multibyte' \
'--enable-mbstring' \
'--with-gd' \
'--with-jpeg-dir=/usr' \
'--with-png-dir=/usr' \
'--with-freetype-dir=/usr' \
'--with-t1lib=/usr' \
'--enable-gd-native-ttf' \
'--enable-exif' \
'--with-config-file-path=/etc/php53/apache2' \
'--with-config-file-scan-dir=/etc/php53/apache2/conf.d' \
'--with-mysql=/usr' \
'--with-zlib' \
'--with-zlib-dir=/usr' \
'--with-gettext' \
'--with-kerberos' \
'--with-imap-ssl' \
'--with-mcrypt=/usr/local' \
'--with-iconv' \
'--with-ldap=/usr' \
'--enable-sockets' \
'--with-openssl' \
'--with-pspell' \
'--with-pdo-mysql=/usr' \
'--with-pdo-sqlite' \
'--enable-soap' \
'--enable-xmlreader' \
'--with-xsl' \
'--enable-ftp' \
'--enable-cgi' \
'--enable-pcntl' \
'--with-curl=/usr' \
'--with-tidy' \
'--with-xmlrpc' \
'--enable-mbstring' \
'--enable-sysvsem' \
'--enable-sysvshm' \
'--enable-shmop' \
'--with-readline' \
'--with-mysqli=/usr/bin/mysql_config' \
'--prefix=/usr/local' \
"$@"

So one of these magically fixes the problem by forcing the lib to be
pulled in.

-Rasmus

---

## #58124 — Hannes Magnusson — 2012-02-27T10:32:53+00:00

URL: https://externals.io/message/58088#58124 · In reply to: #58098

> 
> > […]
>
> Interesting, I never noticed it, but I tried your exact configure
> switches and I was able to reproduce it. Here is what I use on Ubuntu
> 11.10 and it works fine:
>
> './configure' \
> '--with-curlwrappers' \
> '--enable-zend-multibyte' \
> '--enable-mbstring' \
> '--with-gd' \
> '--with-jpeg-dir=/usr' \
> '--with-png-dir=/usr' \
> '--with-freetype-dir=/usr' \
> '--with-t1lib=/usr' \
> '--enable-gd-native-ttf' \
> '--enable-exif' \
> '--with-config-file-path=/etc/php53/apache2' \
> '--with-config-file-scan-dir=/etc/php53/apache2/conf.d' \
> '--with-mysql=/usr' \
> '--with-zlib' \
> '--with-zlib-dir=/usr' \
> '--with-gettext' \
> '--with-kerberos' \
> '--with-imap-ssl' \
> '--with-mcrypt=/usr/local' \
> '--with-iconv' \
> '--with-ldap=/usr' \
> '--enable-sockets' \
> '--with-openssl' \
> '--with-pspell' \
> '--with-pdo-mysql=/usr' \
> '--with-pdo-sqlite' \
> '--enable-soap' \
> '--enable-xmlreader' \
> '--with-xsl' \
> '--enable-ftp' \
> '--enable-cgi' \
> '--enable-pcntl' \
> '--with-curl=/usr' \
> '--with-tidy' \
> '--with-xmlrpc' \
> '--enable-mbstring' \
> '--enable-sysvsem' \
> '--enable-sysvshm' \
> '--enable-shmop' \
> '--with-readline' \
> '--with-mysqli=/usr/bin/mysql_config' \
> '--prefix=/usr/local' \
> "$@"
>
> So one of these magically fixes the problem by forcing the lib to be
> pulled in.

Uhm? You are not enabling intl?

-Hannes

---

## #58125 — Hannes Magnusson — 2012-02-27T10:36:22+00:00

URL: https://externals.io/message/58088#58125 · In reply to: #58092

> If what I did is basically already in 5.4 and won't be finding its way
> back to 5.3, I guess I'm good with my hack for now.
>
> What component are you suggesting I build shared?

c++ extensions in 5.3, it should work fine in 5.4 with the exception
of Nunos worries.. fixing that requires slightly more mucking around,
but noone has complained about that yet though.

-Hannes

---

## #58152 — Richard Lynch — 2012-02-27T16:43:08+00:00

URL: https://externals.io/message/58088#58152 · In reply to: #58088

> Bump - this is still a live issue on Ubuntu 11.10, for instance.
>
> I just hacked my Ubuntu PHP-from-source installer to touch up the
> Makefile by prepending -lstdc++ to EXTRA_LIBS. That does the job.
>
> Which I knew more about autoconf, I'd like to help figure this out
> properly so everyone doesn't wind up maintaining hacks to compile PHP
> from source. It discourages a very large community from trying new
> releases.
>
> Is this perhaps because some of the code being included in the PHP
> build happens to be C++ code? (Not readily apparent from the outside
> of course.)

I believe core PHP is all in C.

Extensions, however, could be in C++

And if one extension has forgotten to edit the Makefiles to do
-lstdc++ I presume that it could be the cause.

I'd even hazard a guess that it would only surface if one disabled
other extensions that generally PRECEDE it in the configure / make
process, as once the -lstdc++ is in there, it remains for the rest of
the build process.  This is just a guess, however...

At any rate, if you could eliminate each extension, one by one, you
might find the culprit, assuming my guesses are valid.

No promises anything I have said is even "correct" in any way.

-- 
brain cancer update:
http://richardlynch.blogspot.com/search/label/brain%20tumor
Donate:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FS9NLTNEEKWBE

---

## #58154 — Hannes Magnusson — 2012-02-27T16:45:39+00:00

URL: https://externals.io/message/58088#58154 · In reply to: #58152

> 
> > […]
>
> I believe core PHP is all in C.
>
> Extensions, however, could be in C++
>

ext/intl contains one or two c++ files.

-Hannes

---

## #58166 — johannes@schlueters.de — 2012-02-27T18:19:16+00:00

URL: https://externals.io/message/58088#58166 · In reply to: #58152

> I believe core PHP is all in C.

Correct.

> Extensions, however, could be in C++

Correct.

> And if one extension has forgotten to edit the Makefiles to do
> -lstdc++ I presume that it could be the cause.

Nobody should directly link -lstdc++, that name is compiler-specific.
Instead a C++ compiler has to be used in this case for the final
linkage, so instead of linking using gcc one has to use g++ when using a
gcc chain.

For shared builds the build system has a flag to switch this. When
building PHP itself the build system ignores that flag. (that's where
the tip to build it shared came from)

> I'd even hazard a guess that it would only surface if one disabled
> other extensions that generally PRECEDE it in the configure / make
> process, as once the -lstdc++ is in there, it remains for the rest of
> the build process.  This is just a guess, however...

No, as no extension should refer to libstdc++ (see above) this is not
the case. 
A reason one one might not see it is that PHP is linked against a
library which was linked using libstdc++ and therefore pulls it in.
(So if ext/foo was a wrapper around libfoo.so and libfoo.so would be
linked using a C++ compiler this would work)

> At any rate, if you could eliminate each extension, one by one, you
> might find the culprit, assuming my guesses are valid.

There are two possible solutions:

      * change the build system to link php using the C++ compiler to
        pull in the C++ standard lib. This might have some issues on
        portability of the binary, make the process larger, etc.
      * figure out which C++ things are being used that require the C++
        standard library and get rid of them. I didn't look into this
        but it seems libintl doesn't need the C++ standard lib (else it
        should pull it in) and the error message refering to
        __gxx_personality_v0 sounds like a compiler feature which might
        be controlled by using some compiler flags. My guess is that
        this is part of gcc's exception or RTTI implementation which can
        be disabled (try -fno-rtti or -fno-exception in CXXFLAGS) ... if
        this is the case disabling these features for these files would
        be the fest thing to do. (while it causes trouble if it is done
        for other [future or pecl?]) files which might need these
        features

johannes
