On fpm-alpine docker-php-ext-install fails to install intl and gettext
I'm not sure what has to be done for to properly install the deeded build dependencies.
Here's what I get when I try installing intl in php:fpm-alpine:
$ docker pull php:fpm-alpine
fpm-alpine: Pulling from library/php
3690ec4760f9: Already exists
67654b7bd8a6: Pull complete
b6c453327105: Pull complete
481e68959c15: Pull complete
035eaff92c9d: Pull complete
e31ba3af9a09: Pull complete
20c983a4877e: Pull complete
54aa13200c67: Pull complete
ae40ff0b16e0: Pull complete
7257c6a21d07: Pull complete
Digest: sha256:9dd1c03cf1bcee5e08fe86d94f592831dae3c85884c9d5debfa4e70fb725b6cf
Status: Downloaded newer image for php:fpm-alpine
$ docker run -it --rm php:fpm-alpine sh
/var/www/html # docker-php-ext-install intl > /dev/null
+ cd /usr/src/php/ext/intl
+ phpize
+ ./configure
expr: syntax error
sh: 0: unknown operand
configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
Hitting https://pkgs.alpinelinux.org/contents?file=icu-config&branch=v3.4&arch=x86_64 tells me which package I need to install to get icu-config (in this case, icu-dev):
/var/www/html # apk add --no-cache icu-dev
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
(1/6) Installing libgcc (5.3.0-r0)
(2/6) Installing libstdc++ (5.3.0-r0)
(3/6) Installing icu-libs (57.1-r1)
(4/6) Installing pkgconf (0.9.12-r0)
(5/6) Installing pkgconfig (0.25-r1)
(6/6) Installing icu-dev (57.1-r1)
Executing busybox-1.24.2-r11.trigger
OK: 50 MiB in 31 packages
After doing so, intl should install successfully:
/var/www/html # docker-php-ext-install intl > /dev/null
+ cd /usr/src/php/ext/intl
+ phpize
+ ./configure
expr: syntax error
sh: 0: unknown operand
In file included from /usr/src/php/ext/intl/grapheme/grapheme_string.c:24:0:
/usr/src/php/ext/intl/grapheme/grapheme_util.h:37:14: warning: inline function 'grapheme_memrchr_grapheme' declared but never defined
inline void *grapheme_memrchr_grapheme(const void *s, int c, int32_t n);
^
In file included from /usr/src/php/ext/intl/grapheme/grapheme_util.c:24:0:
/usr/src/php/ext/intl/grapheme/grapheme_util.h:37:14: warning: inline function 'grapheme_memrchr_grapheme' declared but never defined
inline void *grapheme_memrchr_grapheme(const void *s, int c, int32_t n);
^
/usr/src/php/ext/intl/idn/idn.c: In function 'php_intl_idn_to':
/usr/src/php/ext/intl/idn/idn.c:229:4: warning: 'uidna_IDNToASCII_57' is deprecated [-Wdeprecated-declarations]
converted_ret_len = uidna_IDNToASCII(ustring, ustring_len, converted, MAXPAT
^
In file included from /usr/include/unicode/platform.h:23:0,
from /usr/include/unicode/ptypes.h:50,
from /usr/include/unicode/umachine.h:44,
from /usr/include/unicode/utypes.h:36,
from /usr/include/unicode/uidna.h:20,
from /usr/src/php/ext/intl/idn/idn.c:28:
/usr/include/unicode/uidna.h:673:1: note: declared here
uidna_IDNToASCII( const UChar* src, int32_t srcLength,
^
/usr/src/php/ext/intl/idn/idn.c:231:4: warning: 'uidna_IDNToUnicode_57' is deprecated [-Wdeprecated-declarations]
converted_ret_len = uidna_IDNToUnicode(ustring, ustring_len, converted, MAXP
^
In file included from /usr/include/unicode/platform.h:23:0,
from /usr/include/unicode/ptypes.h:50,
from /usr/include/unicode/umachine.h:44,
from /usr/include/unicode/utypes.h:36,
from /usr/include/unicode/uidna.h:20,
from /usr/src/php/ext/intl/idn/idn.c:28:
/usr/include/unicode/uidna.h:720:1: note: declared here
uidna_IDNToUnicode( const UChar* src, int32_t srcLength,
^
/var/www/html # php -i | grep intl
Additional .ini files parsed => /usr/local/etc/php/conf.d/docker-php-ext-intl.ini
intl
intl.default_locale => no value => no value
intl.error_level => 0 => 0
intl.use_exceptions => 0 => 0
The process for figuring out what gettext needs should be reasonably similar:
/var/www/html # docker-php-ext-install gettext > /dev/null
+ cd /usr/src/php/ext/gettext
+ phpize
+ ./configure
expr: syntax error
sh: 0: unknown operand
configure: error: Cannot locate header file libintl.h
(https://pkgs.alpinelinux.org/contents?file=libintl.h&branch=v3.4&arch=x86_64 tells us we need gettext-dev)
/var/www/html # apk add --no-cache gettext-dev
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
(1/7) Installing gettext-asprintf (0.19.7-r3)
(2/7) Installing libintl (0.19.7-r3)
(3/7) Installing libunistring (0.9.6-r0)
(4/7) Installing gettext-libs (0.19.7-r3)
(5/7) Installing libgomp (5.3.0-r0)
(6/7) Installing gettext (0.19.7-r3)
(7/7) Installing gettext-dev (0.19.7-r3)
Executing busybox-1.24.2-r11.trigger
OK: 56 MiB in 38 packages
/var/www/html # docker-php-ext-install gettext > /dev/null
+ cd /usr/src/php/ext/gettext
+ phpize
+ ./configure
expr: syntax error
sh: 0: unknown operand
/var/www/html # php -i | grep gettext
Additional .ini files parsed => /usr/local/etc/php/conf.d/docker-php-ext-gettext.ini,
gettext
Thanks @tianon for making my Linux-apprentice life _that_ much easier. Now I can sort of understand how to find needed packages by myself, instead of resorting to Google for that :)
@AJenbo Take a look at this Dockerfile. You need dependencies to install intl/gettext.
@igorsantos07 glad it was helpful for you :smile: :+1:
(This is the general pattern for how I find the dependencies of _any_ build process while creating Docker images. :sweat_smile:)
This specific issue appears to be pretty well solved though, so I'm going to close it now. :+1:
@tianon thanks for detailed answer, it helped me too!
apk add --update --no-cache icu-dev
Most helpful comment
Here's what I get when I try installing
intlinphp:fpm-alpine:Hitting https://pkgs.alpinelinux.org/contents?file=icu-config&branch=v3.4&arch=x86_64 tells me which package I need to install to get
icu-config(in this case,icu-dev):After doing so,
intlshould install successfully:The process for figuring out what
gettextneeds should be reasonably similar:(https://pkgs.alpinelinux.org/contents?file=libintl.h&branch=v3.4&arch=x86_64 tells us we need
gettext-dev)