# Custom PHP static build issue with intl



## CyberCr33p (Sep 5, 2019)

I try to create a static PHP 7.1 binary with intl support:

`./configure --prefix=/home/www/cretaftp/php --enable-static --enable-cli --disable-cgi --enable-mysqlnd --with-mysqli --with-curl --with-zlib --enable-mbstring --enable-calendar --with-gd --with-bz2 --enable-sockets --enable-ftp --with-gettext --with-xmlrpc --with-xsl --with-pdo-mysql --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-mcrypt --enable-soap --with-openssl --enable-intl --with-layout=GNU`

But when I run:

`make`

I get this:


```
ld: error: undefined symbol: std::__throw_length_error(char const*)
>>> referenced by stl_vector.h:1756 (/usr/local/lib/gcc9/include/c++/bits/stl_vector.h:1756)
>>>               ext/intl/msgformat/.libs/msgformat_helpers.o:(std::vector<icu::Formattable, std::allocator<icu::Formattable> >::_M_default_append(unsigned long))

ld: error: undefined symbol: std::__throw_length_error(char const*)
>>> referenced by stl_vector.h:1756 (/usr/local/lib/gcc9/include/c++/bits/stl_vector.h:1756)
>>>               ext/intl/msgformat/.libs/msgformat_helpers.o:(std::vector<icu::UnicodeString, std::allocator<icu::UnicodeString> >::_M_default_append(unsigned long))
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.
```

If I remove `--enable-intl` from the ./configure command the issue doesn't exist.


----------



## SirDice (Sep 5, 2019)

Why don't you use the port?


----------



## CyberCr33p (Sep 5, 2019)

I finally found a workaround using the ports tree:


```
cd /usr/ports/lang/php71

make extract

cd /usr/ports/lang/php71/work

./configure --prefix=/home/www/cretaftp/php --enable-static --enable-cli --disable-cgi --enable-mysqlnd --with-mysqli --with-curl --with-zlib --enable-mbstring --enable-calendar --with-gd --with-bz2 --enable-sockets --enable-ftp --with-gettext --with-xmlrpc --with-xsl --with-pdo-mysql --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-mcrypt --enable-soap --with-openssl --enable-intl --with-layout=GNU

make
```

and then I got the php binary from:


```
/usr/ports/lang/php71/work/php-7.1.32/sapi/cli
```


----------



## SirDice (Sep 5, 2019)

Why are you building a statically linked version in the first place? What problem are you trying to solve?


----------



## CyberCr33p (Sep 5, 2019)

SirDice said:


> Why don't you use the port?



I need to run PHP 7.1 from console in a system that already has PHP 7.2 installed. That's why I this this static build.


----------



## CyberCr33p (Sep 5, 2019)

Τhe main OS uses PHP 7.2, and I have 2 jails with PHP 7.1 and 5.6. And I want to run a magento php script from console using PHP 7.1 without jexec to the jail.


----------



## SirDice (Sep 5, 2019)

CyberCr33p said:


> And I want to run a magento php script from console using PHP 7.1 without jexec to the jail.


Have you tried just running it with PHP 7.2? There aren't that many incompatibilities between 7.1 and 7.2: https://www.php.net/manual/en/migration72.incompatible.php


----------



## CyberCr33p (Sep 5, 2019)

Yes this Magento version is not compatible with 7.2, only with 7.1.


----------

