zeromq/php-zmq

Installation does not work. I need help. ( ubuntu20.04 - php8.0.3 )

fwang-laralabs opened this issue · 10 comments

environment

  • ubuntu20.04 in docker
  • php8.0.3
  • libsodium-1.0.18
  • zeromq 4.1.4
# pecl install zmq-beta
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading zmq-1.1.3.tgz ...
Starting to download zmq-1.1.3.tgz (82,397 bytes)
............done: 82,397 bytes
24 source files, building
running: phpize
Configuring for:
PHP Api Version:         20200930
Zend Module Api No:      20200930
Zend Extension Api No:   420200930
Please provide the prefix of libzmq installation [autodetect] :
building in /tmp/pear/temp/pear-build-defaultuserCOcgnt/zmq-1.1.3
running: /tmp/pear/temp/zmq/configure --with-php-config=/usr/bin/php-config --with-zmq
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
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 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
checking for PHP includes... -I/usr/include/php/20200930 -I/usr/include/php/20200930/main -I/usr/include/php/20200930/TSRM -I/usr/include/php/20200930/Zend -I/usr/include/php/20200930/ext -I/usr/include/php/20200930/ext/date/lib
checking for PHP extension directory... /usr/lib/php/20200930
checking for PHP installed headers prefix... /usr/include/php/20200930
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking whether to enable 0MQ support... yes, shared
checking whether to enable CZMQ support... no
checking for pkg-config... /usr/bin/pkg-config
checking libzmq installation... found version 4.1.4, under /usr/local
checking for zmq_socket_monitor in -lzmq... yes
checking for zmq_proxy_steerable in -lzmq... yes
checking for zmq_z85_decode in -lzmq... yes
checking for zmq_curve_keypair in -lzmq... yes
checking for zmq_ctx_get in -lzmq... yes
checking for zmq_unbind in -lzmq... yes
checking for zmq_disconnect in -lzmq... yes
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 for stdint.h... (cached) yes
checking time.h usability... yes
checking time.h presence... yes
checking for time.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking mach/mach_time.h usability... no
checking mach/mach_time.h presence... no
checking for mach/mach_time.h... no
checking for library containing clock_gettime... none required
checking for clock_gettime... yes
checking for gettimeofday... yes
checking for mach_absolute_time... no
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) nawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) 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
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
running: make
/bin/bash /tmp/pear/temp/pear-build-defaultuserCOcgnt/zmq-1.1.3/libtool --mode=compile cc -I. -I/tmp/pear/temp/zmq -I/tmp/pear/temp/pear-build-defaultuserCOcgnt/zmq-1.1.3/include -I/tmp/pear/temp/pear-build-defaultuserCOcgnt/zmq-1.1.3/main -I/tmp/pear/temp/zmq -I/usr/include/php/20200930 -I/usr/include/php/20200930/main -I/usr/include/php/20200930/TSRM -I/usr/include/php/20200930/Zend -I/usr/include/php/20200930/ext -I/usr/include/php/20200930/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2    -c /tmp/pear/temp/zmq/zmq.c -o zmq.lo
libtool: compile:  cc -I. -I/tmp/pear/temp/zmq -I/tmp/pear/temp/pear-build-defaultuserCOcgnt/zmq-1.1.3/include -I/tmp/pear/temp/pear-build-defaultuserCOcgnt/zmq-1.1.3/main -I/tmp/pear/temp/zmq -I/usr/include/php/20200930 -I/usr/include/php/20200930/main -I/usr/include/php/20200930/TSRM -I/usr/include/php/20200930/Zend -I/usr/include/php/20200930/ext -I/usr/include/php/20200930/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/zmq/zmq.c  -fPIC -DPIC -o .libs/zmq.o
/tmp/pear/temp/zmq/zmq.c: In function 'php_zmq_context_get':
/tmp/pear/temp/zmq/zmq.c:238:20: error: lvalue required as left operand of assignment
  238 |   GC_REFCOUNT(&le) = 1;
      |                    ^
/tmp/pear/temp/zmq/zmq.c: In function 'php_zmq_socket_store':
/tmp/pear/temp/zmq/zmq.c:538:19: error: lvalue required as left operand of assignment
  538 |  GC_REFCOUNT(&le) = 1;
      |                   ^
/tmp/pear/temp/zmq/zmq.c: In function 'php_zmq_connect_callback':
/tmp/pear/temp/zmq/zmq.c:616:5: error: 'zend_fcall_info' {aka 'struct _zend_fcall_info'} has no member named 'no_separation'
  616 |  fci->no_separation  = 1;
      |     ^~
In file included from /tmp/pear/temp/zmq/zmq.c:32:
/tmp/pear/temp/zmq/zmq.c: In function 'zim_zmqcontext_getsocket':
/tmp/pear/temp/zmq/php_zmq_private.h:159:129: error: expected ')' before 'TSRMLS_CC'
  159 | #define PHP_ZMQ_ERROR_HANDLING_THROW() zend_replace_error_handling(EH_THROW, php_zmq_socket_exception_sc_entry, &error_handling TSRMLS_CC);
      |                                                                                                                                 ^~~~~~~~~
/tmp/pear/temp/zmq/zmq.c:656:2: note: in expansion of macro 'PHP_ZMQ_ERROR_HANDLING_THROW'
  656 |  PHP_ZMQ_ERROR_HANDLING_THROW()
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/pear/temp/zmq/php_zmq_private.h:161:86: error: expected ')' before 'TSRMLS_CC'
  161 | #define PHP_ZMQ_ERROR_HANDLING_RESTORE() zend_restore_error_handling(&error_handling TSRMLS_CC);
      |                                                                                      ^~~~~~~~~
/tmp/pear/temp/zmq/zmq.c:661:2: note: in expansion of macro 'PHP_ZMQ_ERROR_HANDLING_RESTORE'
  661 |  PHP_ZMQ_ERROR_HANDLING_RESTORE()
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/pear/temp/zmq/zmq.c: In function 'zim_zmqsocket___construct':
/tmp/pear/temp/zmq/php_zmq_private.h:159:129: error: expected ')' before 'TSRMLS_CC'
  159 | #define PHP_ZMQ_ERROR_HANDLING_THROW() zend_replace_error_handling(EH_THROW, php_zmq_socket_exception_sc_entry, &error_handling TSRMLS_CC);
      |                                                                                                                                 ^~~~~~~~~
/tmp/pear/temp/zmq/zmq.c:749:2: note: in expansion of macro 'PHP_ZMQ_ERROR_HANDLING_THROW'
  749 |  PHP_ZMQ_ERROR_HANDLING_THROW()
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/pear/temp/zmq/php_zmq_private.h:161:86: error: expected ')' before 'TSRMLS_CC'
  161 | #define PHP_ZMQ_ERROR_HANDLING_RESTORE() zend_restore_error_handling(&error_handling TSRMLS_CC);
      |                                                                                      ^~~~~~~~~
/tmp/pear/temp/zmq/zmq.c:754:2: note: in expansion of macro 'PHP_ZMQ_ERROR_HANDLING_RESTORE'
  754 |  PHP_ZMQ_ERROR_HANDLING_RESTORE()
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:209: zmq.lo] Error 1
ERROR: `make' failed
# php -v
PHP 8.0.3 (cli) (built: Mar  5 2021 07:54:13) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.3, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.3, Copyright (c), by Zend Technologies

same problem, tried this
#200 (comment)
still no help

I had essentially the same problem with php 8.0.3 on manjaro.

I was able to complete an installation with the following:

git clone git://github.com/mkoppanen/php-zmq.git && cd php-zmq
sudo phpize
sudo ./configure
sudo make
sudo make install
sudo make test

The above worked, although installing from pacman, pamac, or pecl all failed with the same error you had.

This worked for me too on PHP 8.0.12, although mkoppanen/php-zmq seems to redirect back to zeromq/php-zmq now.

Presumably this is something fixed on the master branch since v1.1.2 but the last update was over a year ago. Wondering whether a stable release will be tagged?

I was able to install php-zmq on Ubuntu 20.04 with PHP8.1 by simply run:

sudo apt install php-zmq

This was done in WSL2 and also in a VPS.

thanks @zhiyong-ft this worked for me

Note that as to @mopsyd instructions sudo should only be needed you run sudo make install because you only need elevated privileges to write into the /usr directory to copy over the compiled extension library.

And if you feel the need to run tests via make test this is general done before before finalizing installation with sudo make install to prevent installing a potentially broken library.

Also note that you will also need sudo apt install libzmq3-dev, at least on Ubuntu 20.04. But regardless of distro you will need a newer flavor of libzmq (the shared library for zmq) as well as a newer flavor of libzmq-dev for libzmq headers.

I was able to install php-zmq on Ubuntu 20.04 with PHP8.1 by simply run:

sudo apt install php-zmq

This was done in WSL2 and also in a VPS.

This seems to work in Fedora as well

sudo apt install php-zmq

This updated my PHP version to 8.2 from 8.1.