Skip to content

Instantly share code, notes, and snippets.

@emarref
Created October 3, 2018 21:28
Show Gist options
  • Save emarref/b117f45fd5434a00318326ea6e779a90 to your computer and use it in GitHub Desktop.
Save emarref/b117f45fd5434a00318326ea6e779a90 to your computer and use it in GitHub Desktop.
AMQP compile failure on PHP7.3
FROM php:rc-fpm
RUN apt-get update && apt-get install -y librabbitmq-dev
RUN pecl channel-update pecl.php.net
RUN pecl install amqp
RUN docker-php-ext-enable amqp
Sending build context to Docker daemon 89.13MB
Step 1/5 : FROM php:rc-fpm
---> fea43ed52b45
Step 2/5 : RUN apt-get update && apt-get install -y librabbitmq-dev
---> Using cache
---> 131b7c7318fa
Step 3/5 : RUN pecl channel-update pecl.php.net
---> Using cache
---> 736861908241
Step 4/5 : RUN pecl install amqp
---> Running in a33aba2b104d
downloading amqp-1.9.3.tgz ...
Starting to download amqp-1.9.3.tgz (101,342 bytes)
....................done: 101,342 bytes
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in PEAR/PackageFile/v2/Validator.php on line 1933
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /usr/local/lib/php/PEAR/PackageFile/v2/Validator.php on line 1933
28 source files, building
running: phpize
Configuring for:
PHP Api Version: 20180731
Zend Module Api No: 20180731
Zend Extension Api No: 320180731
Set the path to librabbitmq install prefix [autodetect] : building in /tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3
running: /tmp/pear/temp/amqp/configure --with-php-config=/usr/local/bin/php-config --with-librabbitmq-dir
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20180731
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.16 (ok)
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking for amqp support... yes, shared
checking for amqp... yes, shared
yes
checking for pkg-config... /usr/bin/pkg-config
checking for amqp using pkg-config... found version 0.8.0
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/bash /tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/libtool --mode=compile cc -I. -I/tmp/pear/temp/amqp -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/include -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/main -I/tmp/pear/temp/amqp -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/amqp/amqp.c -o amqp.lo
mkdir .libs
cc -I. -I/tmp/pear/temp/amqp -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/include -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/main -I/tmp/pear/temp/amqp -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/amqp/amqp.c -fPIC -DPIC -o .libs/amqp.o
/bin/bash /tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/libtool --mode=compile cc -I. -I/tmp/pear/temp/amqp -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/include -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/main -I/tmp/pear/temp/amqp -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/amqp/amqp_type.c -o amqp_type.lo
cc -I. -I/tmp/pear/temp/amqp -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/include -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/main -I/tmp/pear/temp/amqp -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/amqp/amqp_type.c -fPIC -DPIC -o .libs/amqp_type.o
/bin/bash /tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/libtool --mode=compile cc -I. -I/tmp/pear/temp/amqp -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/include -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/main -I/tmp/pear/temp/amqp -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/amqp/amqp_exchange.c -o amqp_exchange.lo
cc -I. -I/tmp/pear/temp/amqp -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/include -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/main -I/tmp/pear/temp/amqp -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/amqp/amqp_exchange.c -fPIC -DPIC -o .libs/amqp_exchange.o
/bin/bash /tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/libtool --mode=compile cc -I. -I/tmp/pear/temp/amqp -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/include -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/main -I/tmp/pear/temp/amqp -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/amqp/amqp_queue.c -o amqp_queue.lo
cc -I. -I/tmp/pear/temp/amqp -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/include -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/main -I/tmp/pear/temp/amqp -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/amqp/amqp_queue.c -fPIC -DPIC -o .libs/amqp_queue.o
/bin/bash /tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/libtool --mode=compile cc -I. -I/tmp/pear/temp/amqp -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/include -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/main -I/tmp/pear/temp/amqp -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/amqp/amqp_connection.c -o amqp_connection.lo
cc -I. -I/tmp/pear/temp/amqp -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/include -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/main -I/tmp/pear/temp/amqp -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/amqp/amqp_connection.c -fPIC -DPIC -o .libs/amqp_connection.o
/bin/bash /tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/libtool --mode=compile cc -I. -I/tmp/pear/temp/amqp -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/include -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/main -I/tmp/pear/temp/amqp -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/amqp/amqp_connection_resource.c -o amqp_connection_resource.lo
cc -I. -I/tmp/pear/temp/amqp -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/include -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/main -I/tmp/pear/temp/amqp -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/amqp/amqp_connection_resource.c -fPIC -DPIC -o .libs/amqp_connection_resource.o
/bin/bash /tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/libtool --mode=compile cc -I. -I/tmp/pear/temp/amqp -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/include -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/main -I/tmp/pear/temp/amqp -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/amqp/amqp_channel.c -o amqp_channel.lo
cc -I. -I/tmp/pear/temp/amqp -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/include -I/tmp/pear/temp/pear-build-defaultuserRpJuPh/amqp-1.9.3/main -I/tmp/pear/temp/amqp -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/amqp/amqp_channel.c -fPIC -DPIC -o .libs/amqp_channel.o
/tmp/pear/temp/amqp/amqp_channel.c: In function 'php_amqp_destroy_fci':
/tmp/pear/temp/amqp/amqp_channel.c:104:37: error: lvalue required as decrement operand
GC_REFCOUNT(fci->object)--;
^~
/tmp/pear/temp/amqp/amqp_channel.c: In function 'php_amqp_duplicate_fci':
/tmp/pear/temp/amqp/amqp_channel.c:115:40: error: lvalue required as increment operand
GC_REFCOUNT(source->object)++;
^~
Makefile:206: recipe for target 'amqp_channel.lo' failed
make: *** [amqp_channel.lo] Error 1
ERROR: `make' failed
The command '/bin/sh -c pecl install amqp' returned a non-zero code: 1
@topikito
Copy link

topikito commented Dec 9, 2018

Hey! 👋

I ran into the same issue today - Did you fix it?

@alvery
Copy link

alvery commented Dec 12, 2018

@lposukonko
Copy link

lposukonko commented Feb 21, 2020

RUN apt-get install -y \
        librabbitmq-dev \
        libssh-dev \
    && docker-php-ext-install \
        bcmath \
        sockets \
    && pecl install amqp \
    && rm -rf /tmp/pear \
    && docker-php-ext-enable amqp

@Blueblazer172
Copy link

If anybody has a legacy app which needs php7.3. use these steps in your dockerfile:

FROM php:7.3.20-fpm

RUN DEBIAN_FRONTEND=noninteractive apt-get update \
   && apt-get install -y \
       librabbitmq-dev \
       curl \
   && rm -rf /var/lib/apt/lists/*

RUN docker-php-ext-install bcmath

after that build the legacy php-amqp version v1.9.4, which has support for php-7.3 from source and enable the php extension:

RUN curl https://github.com/php-amqp/php-amqp/archive/refs/tags/v1.9.4.tar.gz --location -o /tmp/php-amqp-v1.9.4.tar.gz \
    && mkdir /tmp/php-amqp-v1.9.4 \
    && tar -C /tmp/php-amqp-v1.9.4 -xf /tmp/php-amqp-v1.9.4.tar.gz --strip-components=1 \
    && (cd /tmp/php-amqp-v1.9.4 && phpize && ./configure && make && make install) \
    && rm -rfv /tmp/php-amqp-v1.9.4 \
    && docker-php-ext-enable amqp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment