That is my Dockerfile
FROM php:5.6-fpm
MAINTAINER Pierre-Louis Launay <[email protected]>
RUN apt-get update
RUN apt-get install -y libicu-dev
RUN curl -sS -o /tmp/icu.tgz -L http://download.icu-project.org/files/icu4c/59.1/icu4c-59_1-src.tgz \
&& tar -zxf /tmp/icu.tgz -C /tmp \
&& cd /tmp/icu/source \
&& ./configure --prefix=/usr/local \
&& make \
&& make install
RUN docker-php-ext-configure intl --with-icu-dir=/usr/local
RUN docker-php-ext-install intl
When it runs docker-php-ext-install intl we have the following error
...
/usr/src/php/ext/intl/intl_convertcpp.cpp:40:9: error: 'u_strFromUTF8WithSub_59' was not declared in this scope
status);
^
/usr/src/php/ext/intl/intl_convertcpp.cpp: In function 'int intl_charFromString(const icu_59::UnicodeString&, char**, int*, UErrorCode*)':
/usr/src/php/ext/intl/intl_convertcpp.cpp:74:8: error: 'UChar' does not name a type
const UChar *utf16buf = from.getBuffer();
^
/usr/src/php/ext/intl/intl_convertcpp.cpp:76:54: error: 'utf16buf' was not declared in this scope
u_strToUTF8WithSub(*res, capacity - 1, &actual_len, utf16buf, from.length(),
^
Makefile:187: recipe for target 'intl_convertcpp.lo' failed
make: *** [intl_convertcpp.lo] Error 1
ERROR: Service 'engine' failed to build: The command '/bin/sh -c docker-php-ext-install intl' returned a non-zero code: 2
I try several solutions but I have always the same error. I think I miss something but I do not know what ...
From this stack overflow, it looks like you need -std=c++11. This should work:
```dockerfile
FROM php:5.6-fpm
RUN curl -fsS -o /tmp/icu.tgz -L http://download.icu-project.org/files/icu4c/59.1/icu4c-59_1-src.tgz \
&& tar -zxf /tmp/icu.tgz -C /tmp \
&& cd /tmp/icu/source \
&& ./configure --prefix=/usr/local \
&& make \
&& make install \
&& rm -rf /tmp/icu*
ENV PHP_CPPFLAGS="$PHP_CPPFLAGS -std=c++11"
RUN docker-php-ext-configure intl --with-icu-dir=/usr/local \
&& docker-php-ext-install intl
Thanks for your advices
Most helpful comment
From this stack overflow, it looks like you need -std=c++11. This should work:
```dockerfile
FROM php:5.6-fpm
Why install icu, when you are installing it from source?
don't apt-get update on its own RUN line
and clean up apt lists once things are installed
RUN apt-get update && apt-get install -y libicu-dev && rm -rf /var/lib/apt/lists/*
RUN curl -fsS -o /tmp/icu.tgz -L http://download.icu-project.org/files/icu4c/59.1/icu4c-59_1-src.tgz \
&& tar -zxf /tmp/icu.tgz -C /tmp \
&& cd /tmp/icu/source \
&& ./configure --prefix=/usr/local \
&& make \
&& make install \
just to be certain things are cleaned up
&& rm -rf /tmp/icu*
PHP_CPPFLAGS are used by the docker-php-ext-* scripts
ENV PHP_CPPFLAGS="$PHP_CPPFLAGS -std=c++11"
RUN docker-php-ext-configure intl --with-icu-dir=/usr/local \
run configure and install in the same RUN line, they extract and clean up the php source to save space
&& docker-php-ext-install intl