Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iconv Error with new php fpm-alpine docker image #1266

Closed
DerGary opened this issue Mar 11, 2022 · 8 comments
Closed

Iconv Error with new php fpm-alpine docker image #1266

DerGary opened this issue Mar 11, 2022 · 8 comments

Comments

@DerGary
Copy link

DerGary commented Mar 11, 2022

Last Known Good Version: 0baa20a9e0e6026e25fef9bfa316cd0bf260593b29889f76b1cba5fb51ce69c3
Error happens with Version: 8bb4d9a13c023ad3ac7edb7eb37d09e2c17c3d49f7b2905ed6b3bed6f29305e1

Error Message:

In file included from /usr/local/include/php/Zend/zend_config.h:1,
#6 9.951                  from /usr/local/include/php/Zend/zend_portability.h:43,
#6 9.951                  from /usr/local/include/php/Zend/zend_types.h:25,
#6 9.951                  from /usr/local/include/php/Zend/zend.h:27,
#6 9.951                  from /usr/local/include/php/main/php.h:33,
#6 9.951                  from /usr/src/php/ext/iconv/iconv.c:25:
#6 9.951 /usr/local/include/php/main/../main/php_config.h:1976: warning: "ICONV_BROKEN_IGNORE" redefined
#6 9.951  1976 | #define ICONV_BROKEN_IGNORE 0
#6 9.951       | 
#6 9.951 In file included from /usr/src/php/ext/iconv/iconv.c:22:
#6 9.951 /usr/src/php/ext/iconv/config.h:59: note: this is the location of the previous definition
#6 9.951    59 | #define ICONV_BROKEN_IGNORE 1
#6 9.951       | 
#6 10.11 /usr/src/php/ext/iconv/iconv.c: In function 'zm_startup_miconv':
#6 10.11 /usr/src/php/ext/iconv/iconv.c:284:4: error: '_libiconv_version' undeclared (first use in this function)
#6 10.11   284 |    _libiconv_version >> 8, _libiconv_version & 0xff);
#6 10.11       |    ^~~~~~~~~~~~~~~~~
#6 10.11 /usr/src/php/ext/iconv/iconv.c:284:4: note: each undeclared identifier is reported only once for each function it appears in
#6 10.11 /usr/src/php/ext/iconv/iconv.c: In function '_php_iconv_appendl':
#6 10.11 /usr/src/php/ext/iconv/iconv.c:181:15: warning: implicit declaration of function 'libiconv'; did you mean 'iconv'? [-Wimplicit-function-declaration]
#6 10.11   181 | #define iconv libiconv
#6 10.11       |               ^~~~~~~~
#6 10.11 /usr/src/php/ext/iconv/iconv.c:453:8: note: in expansion of macro 'iconv'
#6 10.11   453 |    if (iconv(cd, (char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
#6 10.11       |        ^~~~~
#6 10.16 make: *** [Makefile:192: iconv.lo] Error 1

Repro Steps, build this docker file:

ARG PHP_VERSION=7.4-fpm-alpine

######################################################################
# PHP-FPM Container
######################################################################

FROM php:${PHP_VERSION} as php

WORKDIR /srv/www

# install php extensions
# running these commands together results in a way smaller image size, see: https://github.com/docker-library/php/issues/855
RUN apk update && \
    apk add --no-cache --virtual wget zip unzip libzip-dev freetype-dev libjpeg-turbo-dev libpng-dev sqlite sqlite-dev openssl-dev && \
    docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ && \
    docker-php-ext-install -j$(nproc) iconv gd pdo zip opcache pdo_sqlite
@ishioni
Copy link

ishioni commented Mar 11, 2022

Same here, but on php:8.1-fpm-alpine3.15, looks like #1264 is the culprit, but I haven't found a workaround for now

@DerGary
Copy link
Author

DerGary commented Mar 11, 2022

@ishioni my workaround is using 7.4-fpm-alpine3.13 ;)

@DerGary DerGary changed the title Error with new php docker image Iconv Error with new php fpm-alpine docker image Mar 11, 2022
@msierks-pcln
Copy link
Contributor

The iconv extension is already included and enabled in the alpine images. Actually that's true of all the php images.

@ishioni
Copy link

ishioni commented Mar 11, 2022

The iconv extension is already included and enabled in the alpine images. Actually that's true of all the php images.

I kindof was thinking that was the case, but wasn't sure. Is loading fpm with like so still needed then?

ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php

@msierks-pcln
Copy link
Contributor

@ishioni No, that should no longer be necessary as gnu-libiconv is the new default.

@DerGary I noticed you're building opcache. This is also another extension built by default as a shared object. Should only need to enable it.

@DerGary
Copy link
Author

DerGary commented Mar 11, 2022

@msierks-pcln interessting, so should it be like this then:

RUN apk update && \
    apk add --no-cache --virtual wget zip unzip libzip-dev freetype-dev libjpeg-turbo-dev libpng-dev sqlite sqlite-dev openssl-dev && \
    docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ && \
    docker-php-ext-install -j$(nproc) gd pdo zip pdo_sqlite && \
    docker-php-ext-enable opcache

@msierks-pcln
Copy link
Contributor

@DerGary Yes, that looks correct to me.

@tianon
Copy link
Member

tianon commented Mar 11, 2022

For future reference (and as noted in https://github.com/docker-library/docs/tree/master/php#how-to-install-more-php-extensions), you can use php -m to determine which extensions are already installed/enabled/available in the image. 👍

@tianon tianon closed this as completed Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants