krakjoe/apcu

compliation error on RedHat 8.2: zend_signal.h:46:2: error: unknown type name ‘siginfo_t’

Heiko-Zelt opened this issue · 4 comments

I tried to compile apcu-5.1.22 with PHP 7.3.25 and PHP 8.1.22. I've got the following compilation error:

[apcu-5.1.22]$ /opt/Anwendungen/php/8.1.22/bin/phpize
Configuring for:
PHP Api Version:         20210902
Zend Module Api No:      20210902
Zend Extension Api No:   420210902

[apcu-5.1.22]$ ./configure --enable-apcu
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 -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... /opt/Anwendungen/php/7.3.25
checking for PHP includes... -I/opt/Anwendungen/php/7.3.25/include/php -I/opt/Anwendungen/php/7.3.25/include/php/main -I/opt/Anwendungen/php/7.3.25/include/php/TSRM -I/opt/Anwendungen/php/7.3.25/include/php/Zend -I/opt/Anwendungen/php/7.3.25/include/php/ext -I/opt/Anwendungen/php/7.3.25/include/php/ext/date/lib
checking for PHP extension directory... /opt/Anwendungen/php/7.3.25/lib/php/extensions/no-debug-non-zts-20180731
checking for PHP installed headers prefix... /opt/Anwendungen/php/7.3.25/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... gawk
checking whether to enable APCu support... yes, shared
checking if APCu should be allowed to use rwlocks... yes
checking if APCu should be built in debug mode... no
checking if APCu should clear on SIGUSR1... no
checking if APCu will use mmap (or shm)... yes
checking if APCu should utilize spinlocks before flocks... no
checking whether the target compiler supports builtin atomics... yes
checking for pthread rwlocks... yes
checking for pthread mutexes... yes
checking for clock_gettime... yes
checking for sigaction... yes
checking for union semun... no
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 valgrind/memcheck.h usability... yes
checking valgrind/memcheck.h presence... yes
checking for valgrind/memcheck.h... yes
checking whether C compiler accepts -Wall... yes
checking whether C compiler accepts -Wextra... yes
checking whether C compiler accepts -Wno-unused-parameter... yes
checking for shm_open in -lrt... yes
checking whether to include code coverage symbols... no
checking for a sed that does not truncate output... /usr/bin/sed
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 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... no
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: patching config.h.in
configure: creating ./config.status
config.status: creating config.h

[apcu-5.1.22]$ make
/bin/sh /tmp/apcu-5.1.22/libtool --mode=compile cc -I. -I/tmp/apcu-5.1.22 -I/tmp/apcu-5.1.22/include -I/tmp/apcu-5.1.22/main -I/tmp/apcu-5.1.22 -I/opt/Anwendungen/php/7.3.25/include/php -I/opt/Anwendungen/php/7.3.25/include/php/main -I/opt/Anwendungen/php/7.3.25/include/php/TSRM -I/opt/Anwendungen/php/7.3.25/include/php/Zend -I/opt/Anwendungen/php/7.3.25/include/php/ext -I/opt/Anwendungen/php/7.3.25/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -D_GNU_SOURCE -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -Wall -Wextra -Wno-unused-parameter -DZEND_COMPILE_DL_EXT=1 -c /tmp/apcu-5.1.22/apc.c -o apc.lo  -MMD -MF apc.dep -MT apc.lo
mkdir .libs
 cc -I. -I/tmp/apcu-5.1.22 -I/tmp/apcu-5.1.22/include -I/tmp/apcu-5.1.22/main -I/tmp/apcu-5.1.22 -I/opt/Anwendungen/php/7.3.25/include/php -I/opt/Anwendungen/php/7.3.25/include/php/main -I/opt/Anwendungen/php/7.3.25/include/php/TSRM -I/opt/Anwendungen/php/7.3.25/include/php/Zend -I/opt/Anwendungen/php/7.3.25/include/php/ext -I/opt/Anwendungen/php/7.3.25/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -D_GNU_SOURCE -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -Wall -Wextra -Wno-unused-parameter -DZEND_COMPILE_DL_EXT=1 -c /tmp/apcu-5.1.22/apc.c -MMD -MF apc.dep -MT apc.lo  -fPIC -DPIC -o .libs/apc.o
In file included from /opt/Anwendungen/php/7.3.25/include/php/Zend/zend.h:40,
                 from /opt/Anwendungen/php/7.3.25/include/php/main/php.h:33,
                 from /tmp/apcu-5.1.22/apc.h:67,
                 from /tmp/apcu-5.1.22/apc.c:32:
/opt/Anwendungen/php/7.3.25/include/php/Zend/zend_signal.h:46:2: error: unknown type name ‘siginfo_t’
  siginfo_t *siginfo;
  ^~~~~~~~~
In file included from /opt/Anwendungen/php/7.3.25/include/php/Zend/zend.h:40,
                 from /opt/Anwendungen/php/7.3.25/include/php/main/php.h:33,
                 from /tmp/apcu-5.1.22/apc.h:67,
                 from /tmp/apcu-5.1.22/apc.c:32:
/opt/Anwendungen/php/7.3.25/include/php/Zend/zend_signal.h:95:53: warning: ‘struct sigaction’ declared inside parameter list will not be visible outside of this definition or declaration
 ZEND_API int zend_sigaction(int signo, const struct sigaction *act, struct sigaction *oldact);
                                                     ^~~~~~~~~
In file included from /opt/Anwendungen/php/7.3.25/include/php/Zend/zend_types.h:25,
                 from /opt/Anwendungen/php/7.3.25/include/php/Zend/zend.h:27,
                 from /opt/Anwendungen/php/7.3.25/include/php/main/php.h:33,
                 from /tmp/apcu-5.1.22/apc.h:67,
                 from /tmp/apcu-5.1.22/apc.c:32:
/opt/Anwendungen/php/7.3.25/include/php/Zend/zend_operators.h: In function ‘zend_dval_to_lval’:
/opt/Anwendungen/php/7.3.25/include/php/Zend/zend_operators.h:113:18: warning: implicit declaration of function ‘zend_finite’; did you mean ‘zend_write’? [-Wimplicit-function-declaratio ]
  if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) {
                  ^~~~~~~~~~~
/opt/Anwendungen/php/7.3.25/include/php/Zend/zend_portability.h:323:52: note: in definition of macro ‘UNEXPECTED’
 # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                    ^~~~~~~~~
/opt/Anwendungen/php/7.3.25/include/php/Zend/zend_operators.h:113:48: warning: implicit declaration of function ‘zend_isnan’; did you mean ‘zend_signal’? [-Wimplicit-function-declaratio ]
  if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) {
                                                ^~~~~~~~~~
/opt/Anwendungen/php/7.3.25/include/php/Zend/zend_portability.h:323:52: note: in definition of macro ‘UNEXPECTED’
 # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                    ^~~~~~~~~
In file included from /tmp/apcu-5.1.22/apc.h:67,
                 from /tmp/apcu-5.1.22/apc.c:32:
/opt/Anwendungen/php/7.3.25/include/php/main/php.h: At top level:
/opt/Anwendungen/php/7.3.25/include/php/main/php.h:136: warning: "assert" redefined
 #define assert(expr) ((void) (0))

In file included from /opt/Anwendungen/php/7.3.25/include/php/Zend/zend_operators.h:26,
                 from /opt/Anwendungen/php/7.3.25/include/php/Zend/zend.h:335,
                 from /opt/Anwendungen/php/7.3.25/include/php/main/php.h:33,
                 from /tmp/apcu-5.1.22/apc.h:67,
                 from /tmp/apcu-5.1.22/apc.c:32:
/usr/include/assert.h:104: note: this is the location of the previous definition
 #  define assert(expr)       \

make: *** [Makefile:211: apc.lo] Error 1

Sorry, cannot reproduce

Notices:

  • 8.2 is EOL current version is 8.9
  • apcu is part of the distribution supported packages
  • I'm able to build it for PHP 5.6 to 8.3 without any issue

Thank you for pointing out, that my RedHat was outdated. I upgraded to RedHat Enterprise Linux 8.8 and started from the top, deleted PHP and apcu, compiled PHP, tried to compile apcu. But unfortunately I have got the same compiler error.

I tried on another, fresh machine. Now it works. :-)

Closing this per the last comment. The issue manifest inside a PHP header (rather than an apcu header), so I suspect the original cause here were was some kind of incorrect value in some config.h header. This doesn't look directly related to apcu.