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

Unable to install IMAP extension (Alpine Linux) #244

Closed
mvdstam opened this issue Jun 16, 2016 · 9 comments
Closed

Unable to install IMAP extension (Alpine Linux) #244

mvdstam opened this issue Jun 16, 2016 · 9 comments

Comments

@mvdstam
Copy link

mvdstam commented Jun 16, 2016

In continuation of #120, I'm getting the same error when trying to install the imap extension on the alpine linux image:

configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

My Dockerfile:

FROM php:5-fpm-alpine

RUN apk upgrade --update && apk add \
      php5-imap autoconf file g++ gcc binutils isl libatomic libc-dev musl-dev make re2c libstdc++ libgcc binutils-libs mpc1 mpfr3 gmp libgomp \
      coreutils \
      freetype-dev \
      libjpeg-turbo-dev \
      libltdl \
      libmcrypt-dev \
      libpng-dev \
      libc-client-dev \
    && docker-php-ext-configure imap --with-imap --with-imap-ssl \
    && docker-php-ext-install imap \
    && docker-php-ext-install iconv mcrypt mysqli mysqlnd pdo pdo_mysql zip bcmath \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install gd \
    && apk del autoconf file g++ gcc binutils isl libatomic libc-dev musl-dev make re2c libstdc++ libgcc binutils-libs mpc1 mpfr3 gmp libgomp \
    && rm -rf /var/cache/apk/*

COPY ./php.ini /usr/local/etc/php/php.ini

Can anyone point me in the right direction to get this working? Maybe @tianon? 😄 Thanks!

@yverry
Copy link

yverry commented Jun 21, 2016

Hi @mvdstam ,

libc-client-dev package doesn't exist on alpine.
You need to install imap-dev

Enjoy ! 😄

@mvdstam
Copy link
Author

mvdstam commented Jun 21, 2016

Hey @Yanntech!

Thanks a lot for helping out. Still getting used to Alpine linux. For those interested, my full Dockerfile is as follows:

FROM php:5-fpm-alpine

RUN apk upgrade --update && apk add \
      autoconf file g++ gcc binutils isl libatomic libc-dev musl-dev make re2c libstdc++ libgcc binutils-libs mpc1 mpfr3 gmp libgomp \
      coreutils \
      freetype-dev \
      libjpeg-turbo-dev \
      libltdl \
      libmcrypt-dev \
      libpng-dev \
      imap-dev \
      openssl-dev \
    && docker-php-ext-install iconv mcrypt mysqli mysqlnd pdo pdo_mysql zip bcmath \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install gd \
    && docker-php-ext-configure imap --with-imap --with-imap-ssl \
    && docker-php-ext-install imap

RUN pecl install xdebug \
    && docker-php-ext-enable xdebug \
    && apk del autoconf file g++ gcc binutils isl libatomic libc-dev musl-dev make re2c libstdc++ libgcc binutils-libs mpc1 mpfr3 gmp libgomp \
    && rm -rf /var/cache/apk/*

COPY ./php.ini /usr/local/etc/php/php.ini

Thanks again!

@divyasree67
Copy link

divyasree67 commented Aug 14, 2018

my dockerfile is here

ARG PHP_VERSION=7.2
ARG NGINX_VERSION=1.15
ARG VARNISH_VERSION=6.0

FROM php:${PHP_VERSION}-fpm-alpine AS api_platform_php

# persistent / runtime deps
RUN apk add --no-cache \
		acl \
		file \
		gettext \
		git \
		mysql-client \
	;

ARG APCU_VERSION=5.1.11
RUN set -eux; \
	apk add --no-cache --virtual .build-deps \
		icu-dev \
		libzip-dev \
		mysql-dev \
		zlib-dev \
      	imap-dev \
	; \
	\
	docker-php-ext-configure zip --with-libzip; \
	docker-php-ext-configure imap --with-imap --with-imap-ssl; \
	docker-php-ext-install -j$(nproc) \
		intl \
		pdo_mysql \
		zip \
   		imap \
	; \
	pecl install \
		apcu-${APCU_VERSION} \
	; \
	pecl clear-cache; \
	docker-php-ext-enable \
		apcu \
		opcache \
		imap \
	; \
	\

any error in this i will get error while building

@DarthLegiON
Copy link

Still having a problem installing IMAP on Alpine PHP image. Here is my Dockerfile:

FROM php:7.3-fpm-alpine

RUN apk --update --virtual build-deps add \
        autoconf \
        make \
        gcc \
        g++ \
        libtool \
        icu-dev \
        curl-dev \
        freetype-dev \
        imagemagick-dev \
        libzip-dev \
        pcre-dev \
        libjpeg-turbo-dev \
        libpng-dev \
        imap-dev \
        openssl-dev \
        libxml2-dev
RUN apk add \
        git \
        curl \
        bash \
        bash-completion \
        icu \
        pcre \
        zip \
        imap \
        openssl \
        freetype \
        libintl \
        libjpeg-turbo \
        libpng \
        libltdl \
        libxml2 \
        libzip
RUN docker-php-ext-configure bcmath && \
    docker-php-ext-configure zip --with-libzip && \
    docker-php-ext-configure imap --with-imap --with-imap-ssl
RUN docker-php-ext-install \
        zip \
        imap \
        curl \
        bcmath \
        exif \
        iconv \
        intl \
        mbstring \
        opcache
RUN pecl install \
        imagick \
        redis
RUN docker-php-ext-enable \
        redis \
        imap
RUN apk del \
        build-deps

And warning:

PHP Warning:  PHP Startup: Unable to load dynamic library 'imap.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20180731/imap.so (Error loading shared library libc-client.so.1: No such file or directory (needed by /usr/local/lib/php/extensions/no-debug-non-zts-20180731/imap.so)), /usr/local/lib/php/extensions/no-debug-non-zts-20180731/imap.so.so (Error loading shared library /usr/local/lib/php/extensions/no-debug-non-zts-20180731/imap.so.so: No such file or directory)) in Unknown on line 0

Includind libc-client is impossible. What can I do to make it work?

@yosifkit
Copy link
Member

@DarthLegiON, probably need to keep imap-dev installed since it is providing /usr/lib/libc-client.so (or just c-client for /usr/lib/libc-client.so.1): https://pkgs.alpinelinux.org/contents?file=libc-client.so*&path=&name=&branch=v3.10&arch=x86_64

You may also want to combine your RUN lines into a single line, otherwise you won't see any space saving from the deletes.

@DarthLegiON
Copy link

@yosifkit thanks for advices!

@fox91
Copy link

fox91 commented Nov 1, 2021

Minimal Dockerfile for reference if someone have the same problem:

https://github.com/fox91/docker-php-extensions/blob/main/8.0/alpine3.14/imap/Dockerfile

FROM php:8.0-alpine3.14

# PHP ext-imap
RUN set -eux; \
  persistentDeps=" \
    c-client \
  "; \
  buildDeps=" \
    imap-dev \
    krb5-dev \
    openssl-dev \
  "; \
  apk add --no-cache --virtual .imap-persistent-deps ${persistentDeps}; \
  apk add --no-cache --virtual .imap-build-deps ${buildDeps}; \
  \
  docker-php-ext-configure imap \
    --with-imap-ssl \
    --with-kerberos \
  ; \
  docker-php-ext-install -j$(nproc) imap; \
  \
  apk del --no-cache --no-network .imap-build-deps

Tested with PHP 7.3, 7.4 and 8.0 on alpine3.14.

@joseluisq
Copy link

c-client as a persistent dep fixed the issue.

@marxangels
Copy link

Search package by filename https://pkgs.alpinelinux.org/contents?file=*libc-client*

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

8 participants