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

Compiling on php 8.4 #575

Closed
bobspct opened this issue Feb 11, 2025 · 4 comments · May be fixed by #576
Closed

Compiling on php 8.4 #575

bobspct opened this issue Feb 11, 2025 · 4 comments · May be fixed by #576
Labels

Comments

@bobspct
Copy link

bobspct commented Feb 11, 2025

Description

We tried to install rdkafka 6.0.5 from pecl and got:

Resulted in this output:

pecl install rdkafka
downloading rdkafka-6.0.5.tgz ...
Starting to download rdkafka-6.0.5.tgz (61,938 bytes)
................done: 61,938 bytes
72 source files, building
running: phpize
Configuring for:
PHP Version:             8.4
PHP Api Version:         20240924
Zend Module Api No:      20240924
Zend Extension Api No:   420240924
configure.ac:154: warning: The macro `AC_PROG_LIBTOOL' is obsolete.
configure.ac:154: You should run autoupdate.
build/libtool.m4:99: AC_PROG_LIBTOOL is expanded from...
configure.ac:154: the top level
librdkafka installation path? [autodetect] :
building in /tmp/pear/temp/pear-build-rootaavg9coieu54aHNFTAm/rdkafka-6.0.5
running: /tmp/pear/temp/rdkafka/configure --with-php-config=/usr/bin/php-config --with-rdkafka
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 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 gawk... gawk
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 the compiler supports GNU C... yes
checking whether cc accepts -g... yes
checking for cc option to enable C11 features... 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 -Wl,-rpath,... yes
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php/20240924 -I/usr/include/php/20240924/main -I/usr/include/php/20240924/TSRM -I/usr/include/php/20240924/Zend -I/usr/include/php/20240924/ext -I/usr/include/php/20240924/ext/date/lib
checking for PHP extension directory... /usr/lib/php/20240924
checking for PHP installed headers prefix... /usr/include/php/20240924
checking if debugging is enabled... no
checking if PHP is built with thread safety (ZTS)... no

Configuring extension
checking for rdkafka support... yes, shared
checking for librdkafka/rdkafka.h" in default path... found in /usr/local
found in /usr
checking for rd_kafka_new in -lrdkafka... yes
checking for librdkafka version... >= 0.11.0
checking for rd_kafka_message_headers in -lrdkafka... yes
checking for rd_kafka_purge in -lrdkafka... yes
checking for rd_kafka_controllerid in -lrdkafka... yes
configure: WARNING: controllerid is broken on 0.11.x
checking for rd_kafka_init_transactions in -lrdkafka... yes
checking for rd_kafka_msg_partitioner_murmur2 in -lrdkafka... yes
checking for rd_kafka_oauthbearer_set_token in -lrdkafka... yes
checking for rd_kafka_incremental_assign, rd_kafka_incremental_unassign in -lrdkafka... yes

Configuring libtool
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) gawk
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... mt
checking if mt is a manifest tool... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
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

Generating files
configure: creating build directories
configure: creating Makefile
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
running: make
/bin/sh /tmp/pear/temp/pear-build-rootaavg9coieu54aHNFTAm/rdkafka-6.0.5/libtool --tag=CC --mode=compile cc -I. -I/tmp/pear/temp/rdkafka -I/usr/include/php/20240924 -I/usr/include/php/20240924/main -I/usr/include/php/20240924/TSRM -I/usr/include/php/20240924/Zend -I/usr/include/php/20240924/ext -I/usr/include/php/20240924/ext/date/lib  -DHAVE_CONFIG_H  -g -O2 -D_GNU_SOURCE    -DZEND_COMPILE_DL_EXT=1 -c /tmp/pear/temp/rdkafka/rdkafka.c -o rdkafka.lo  -MMD -MF rdkafka.dep -MT rdkafka.lo
libtool: compile:  cc -I. -I/tmp/pear/temp/rdkafka -I/usr/include/php/20240924 -I/usr/include/php/20240924/main -I/usr/include/php/20240924/TSRM -I/usr/include/php/20240924/Zend -I/usr/include/php/20240924/ext -I/usr/include/php/20240924/ext/date/lib -DHAVE_CONFIG_H -g -O2 -D_GNU_SOURCE -DZEND_COMPILE_DL_EXT=1 -c /tmp/pear/temp/rdkafka/rdkafka.c -MMD -MF rdkafka.dep -MT rdkafka.lo  -fPIC -DPIC -o .libs/rdkafka.o
In file included from /tmp/pear/temp/rdkafka/rdkafka.c:26:
/tmp/pear/temp/rdkafka/kafka_error_exception.h:26:51: error: unknown type name ‘rd_kafka_error_t’
   26 | void create_kafka_error(zval *return_value, const rd_kafka_error_t *error);
      |                                                   ^~~~~~~~~~~~~~~~
/tmp/pear/temp/rdkafka/rdkafka.c: In function ‘zim_RdKafka_setLogger’:
/tmp/pear/temp/rdkafka/rdkafka.c:845:5: warning: ‘rd_kafka_set_logger’ is deprecated [-Wdeprecated-declarations]
  845 |     rd_kafka_set_logger(intern->rk, logger);
      |     ^~~~~~~~~~~~~~~~~~~
In file included from /tmp/pear/temp/rdkafka/kafka_error_exception.h:21,
                 from /tmp/pear/temp/rdkafka/rdkafka.c:26:
/usr/local/include/librdkafka/rdkafka.h:4067:6: note: declared here
 4067 | void rd_kafka_set_logger(rd_kafka_t *rk,
      |      ^~~~~~~~~~~~~~~~~~~
/tmp/pear/temp/rdkafka/rdkafka.c: In function ‘zim_RdKafka_Producer_initTransactions’:
/tmp/pear/temp/rdkafka/rdkafka.c:947:11: error: unknown type name ‘rd_kafka_error_t’
  947 |     const rd_kafka_error_t *error;
      |           ^~~~~~~~~~~~~~~~
/tmp/pear/temp/rdkafka/rdkafka.c:958:13: warning: implicit declaration of function ‘rd_kafka_init_transactions’ [-Wimplicit-function-declaration]
  958 |     error = rd_kafka_init_transactions(intern->rk, timeout_ms);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/pear/temp/rdkafka/rdkafka.c:958:11: warning: assignment to ‘const int *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  958 |     error = rd_kafka_init_transactions(intern->rk, timeout_ms);
      |           ^
/tmp/pear/temp/rdkafka/rdkafka.c: In function ‘zim_RdKafka_Producer_beginTransaction’:
/tmp/pear/temp/rdkafka/rdkafka.c:974:11: error: unknown type name ‘rd_kafka_error_t’
  974 |     const rd_kafka_error_t *error;
      |           ^~~~~~~~~~~~~~~~
/tmp/pear/temp/rdkafka/rdkafka.c:981:13: warning: implicit declaration of function ‘rd_kafka_begin_transaction’ [-Wimplicit-function-declaration]
  981 |     error = rd_kafka_begin_transaction(intern->rk);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/pear/temp/rdkafka/rdkafka.c:981:11: warning: assignment to ‘const int *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  981 |     error = rd_kafka_begin_transaction(intern->rk);
      |           ^
/tmp/pear/temp/rdkafka/rdkafka.c: In function ‘zim_RdKafka_Producer_commitTransaction’:
/tmp/pear/temp/rdkafka/rdkafka.c:998:11: error: unknown type name ‘rd_kafka_error_t’
  998 |     const rd_kafka_error_t *error;
      |           ^~~~~~~~~~~~~~~~
/tmp/pear/temp/rdkafka/rdkafka.c:1009:13: warning: implicit declaration of function ‘rd_kafka_commit_transaction’; did you mean ‘rd_kafka_commit_message’? [-Wimplicit-function-declaration]
 1009 |     error = rd_kafka_commit_transaction(intern->rk, timeout_ms);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |             rd_kafka_commit_message
/tmp/pear/temp/rdkafka/rdkafka.c:1009:11: warning: assignment to ‘const int *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
 1009 |     error = rd_kafka_commit_transaction(intern->rk, timeout_ms);
      |           ^
/tmp/pear/temp/rdkafka/rdkafka.c: In function ‘zim_RdKafka_Producer_abortTransaction’:
/tmp/pear/temp/rdkafka/rdkafka.c:1026:11: error: unknown type name ‘rd_kafka_error_t’
 1026 |     const rd_kafka_error_t *error;
      |           ^~~~~~~~~~~~~~~~
/tmp/pear/temp/rdkafka/rdkafka.c:1037:13: warning: implicit declaration of function ‘rd_kafka_abort_transaction’ [-Wimplicit-function-declaration]
 1037 |     error = rd_kafka_abort_transaction(intern->rk, timeout_ms);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/pear/temp/rdkafka/rdkafka.c:1037:11: warning: assignment to ‘const int *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
 1037 |     error = rd_kafka_abort_transaction(intern->rk, timeout_ms);
      |           ^
make: *** [Makefile:204: rdkafka.lo] Error 1
ERROR: `make' failed

php-rdkafka Version

php-rdkafka 6.0.5

librdkafka Version

librdkafka 1.8.0

PHP Version

PHP 8.4.3

Operating System

Ubuntu 22.04

Kafka Version

No response

@bobspct bobspct added the bug label Feb 11, 2025
@arnaud-lb
Copy link
Owner

Hi @bobspct

Apparently the configure script is detecting support for transactions in rdkafka.so, but the related declarations (like rd_kafka_init_transactions) are missing from rdkafka.h. According to the log, we are using rdkafka.h from /usr/local.

What is the output of grep RD_KAFKA_VERSION /usr/include/librdkafka/rdkafka.h on your system?

@bobspct
Copy link
Author

bobspct commented Feb 24, 2025

What is the output of grep RD_KAFKA_VERSION /usr/include/librdkafka/rdkafka.h on your system?

#define RD_KAFKA_VERSION 0x010800ff

@arnaud-lb
Copy link
Owner

Could you confirm that this fixes the issue for you?

@bobspct
Copy link
Author

bobspct commented Feb 25, 2025

Hi, @arnaud-lb

Sorry, looks like my mistake.
Fix is ​​most likely not needed.
I found an old installation from the sources of librdkafka version 1.2.0 in the directory /usr/local/include/librdkafka, which was pulled in during ./configure (checking for librdkafka/rdkafka.h" in default path... found in /usr/local) and the build, accordingly, crashed.
Librdkafka version 1.8.0 was also installed from the default Ubuntu APT repository.
After deleting the old version, the build was successful (and line in configure is "checking for librdkafka/rdkafka.h" in default path... found in /usr"). It was successfully built on the add-include-path branch and the 6.0.4 tag

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

Successfully merging a pull request may close this issue.

2 participants