nick-zh/php-rdkafka-docker

How to build for php 7.2

arnoldasbet opened this issue · 6 comments

Hi,
maybe you could give an example how to build php for 7.2 with kafka support ? I'm currently getting errors

docker build -f Dockerfile-nick-zh-php72 . --build-arg LIBRDKAFKA_VERSION=0.11.6 --build-arg EXT_RDKAFKA_VERSION=3.0.5 -t kafka-tests2

Sending build context to Docker daemon  397.3kB
Step 1/6 : FROM php:7.2-fpm-alpine3.8
 ---> dc32dfc97e33
Step 2/6 : ARG LIBRDKAFKA_VERSION
 ---> Using cache
 ---> d8231936a9dc
Step 3/6 : ARG EXT_RDKAFKA_VERSION
 ---> Using cache
 ---> 00e16f1828ae
Step 4/6 : RUN apk add autoconf gcc g++ openssl librdkafka=$LIBRDKAFKA_VERSION librdkafka-dev=$LIBRDKAFKA_VERSION make     --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/community
 ---> Running in d00b38e10eae
fetch http://dl-3.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
  librdkafka-1.2.1-r0:
    breaks: world[librdkafka=0.11.6]
    satisfies:
               librdkafka-dev-1.2.1-r0[librdkafka=1.2.1-r0]
  so:libcrypto.so.1.1 (missing):
    required by:
                 librdkafka-1.2.1-r0[so:libcrypto.so.1.1]
                 librdkafka-1.2.1-r0[so:libcrypto.so.1.1]
                 librdkafka-1.2.1-r0[so:libcrypto.so.1.1]
  so:libssl.so.1.1 (missing):
    required by:
                 librdkafka-1.2.1-r0[so:libssl.so.1.1]
                 librdkafka-1.2.1-r0[so:libssl.so.1.1]
                 librdkafka-1.2.1-r0[so:libssl.so.1.1]
  librdkafka-dev-1.2.1-r0:
    breaks: world[librdkafka-dev=0.11.6]
The command '/bin/sh -c apk add autoconf gcc g++ openssl librdkafka=$LIBRDKAFKA_VERSION librdkafka-dev=$LIBRDKAFKA_VERSION make     --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/community' returned a non-zero code: 4

@arnoldasbet i will investigate asap

Maybe versions in pecl or repos shifted and that's why it gives errors.

Here's my currently working Dockerfile

FROM php:7.2-alpine
ENV LIBRDKAFKA_VERSION v1.2.0
ENV BUILD_DEPS \
  autoconf \
        bash \
        build-base \
        git \
        pcre-dev \
        python
RUN apk --no-cache --virtual .build-deps add bash ${BUILD_DEPS} \
    && cd /tmp \
    && git clone \
        --branch ${LIBRDKAFKA_VERSION} \
        --depth 1 \
        https://github.com/edenhill/librdkafka.git \
    && cd librdkafka \
    && ./configure \
    && make \
    && make install \
    && pecl install rdkafka \
    && docker-php-ext-enable rdkafka \
    && rm -rf /tmp/librdkafka \
    && apk del .build-deps

@arnoldasbet it seems the problem is, alpine has no archive of old packages, so it can't find librdkafka:0.11.6 anymore. I will adapt the images accordingly and git clone them and build from source. Testing this right now, will shortly push the fix to all the branches.
Thx for a great report 👍

@arnoldasbet i updated all the branches (also added some new ones), i hope this is resolved now, it will take a few hours though until all images are built again on docker hub.
Let me know if it works now for you to build

👍 cheers

Builds should be done, feel free to reopen if there is still something going wrong