nrk/phpiredis

Error building against PHP 5.6.8

Closed this issue · 11 comments

PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226

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-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /opt/local
checking for PHP includes... -I/opt/local/include/php -I/opt/local/include/php/main -I/opt/local/include/php/TSRM -I/opt/local/include/php/Zend -I/opt/local/include/php/ext -I/opt/local/include/php/ext/date/lib
checking for PHP extension directory... /opt/local/lib/php/extensions/no-debug-non-zts-20131226
checking for PHP installed headers prefix... /opt/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking whether to enable phpiredis support... yes, shared
checking for hiredis library... yes, shared
checking for hiredis installation... found in /opt/local
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
/bin/bash /tmp/phpiredis/libtool --mode=compile cc -I. -I/tmp/phpiredis -DPHP_ATOM_INC -I/tmp/phpiredis/include -I/tmp/phpiredis/main -I/tmp/phpiredis -I/opt/local/include/php -I/opt/local/include/php/main -I/opt/local/include/php/TSRM -I/opt/local/include/php/Zend -I/opt/local/include/php/ext -I/opt/local/include/php/ext/date/lib -I/opt/local/include -DHAVE_CONFIG_H -g -O2 -c /tmp/phpiredis/phpiredis.c -o phpiredis.lo
mkdir .libs
cc -I. -I/tmp/phpiredis -DPHP_ATOM_INC -I/tmp/phpiredis/include -I/tmp/phpiredis/main -I/tmp/phpiredis -I/opt/local/include/php -I/opt/local/include/php/main -I/opt/local/include/php/TSRM -I/opt/local/include/php/Zend -I/opt/local/include/php/ext -I/opt/local/include/php/ext/date/lib -I/opt/local/include -DHAVE_CONFIG_H -g -O2 -c /tmp/phpiredis/phpiredis.c -fPIC -DPIC -o .libs/phpiredis.o
/opt/local/include/hiredis/hiredis.h:158:7: error: expected identifier or '(' before numeric constant
} unix;
^
In file included from /tmp/phpiredis/phpiredis.c:1:0:
/opt/local/include/hiredis/hiredis.h:160:1: warning: no semicolon at end of struct or union [enabled by default]
} redisContext;
^
/tmp/phpiredis/phpiredis.c: In function 'zif_phpiredis_multi_command':
/tmp/phpiredis/phpiredis.c:224:9: warning: passing argument 2 of 'redisGetReply' from incompatible pointer type [enabled by default]
if (redisGetReply(connection->c, &reply) != REDIS_OK) {
^
In file included from /tmp/phpiredis/phpiredis.c:1:0:
/opt/local/include/hiredis/hiredis.h:196:5: note: expected 'void *' but argument is of type 'struct redisReply *'
int redisGetReply(redisContext c, void *reply);
^
/tmp/phpiredis/phpiredis.c: In function 'zif_phpiredis_multi_command_bs':
/tmp/phpiredis/phpiredis.c:294:9: warning: passing argument 3 of 'redisAppendCommandArgv' from incompatible pointer type [enabled by default]
redisAppendCommandArgv(connection->c, cmdSize, cmdElements, cmdElementslen);
^
In file included from /tmp/phpiredis/phpiredis.c:1:0:
/opt/local/include/hiredis/hiredis.h:207:5: note: expected 'const char *
' but argument is of type 'char *
'
int redisAppendCommandArgv(redisContext c, int argc, const char *argv, const size_t argvlen);
^
/tmp/phpiredis/phpiredis.c:313:9: warning: passing argument 2 of 'redisGetReply' from incompatible pointer type [enabled by default]
if (redisGetReply(connection->c, &reply) != REDIS_OK) {
^
In file included from /tmp/phpiredis/phpiredis.c:1:0:
/opt/local/include/hiredis/hiredis.h:196:5: note: expected 'void *
' but argument is of type 'struct redisReply *
'
int redisGetReply(redisContext *c, void *reply);
^
/tmp/phpiredis/phpiredis.c: In function 'zif_phpiredis_command':
/tmp/phpiredis/phpiredis.c:352:9: warning: format not a string literal and no format arguments [-Wformat-security]
php_error_docref(NULL TSRMLS_CC, E_WARNING, reply->str);
^
/tmp/phpiredis/phpiredis.c: In function 'zif_phpiredis_command_bs':
/tmp/phpiredis/phpiredis.c:420:5: warning: passing argument 3 of 'redisAppendCommandArgv' from incompatible pointer type [enabled by default]
redisAppendCommandArgv(connection->c, argc, argv, (const size_t ) argvlen);
^
In file included from /tmp/phpiredis/phpiredis.c:1:0:
/opt/local/include/hiredis/hiredis.h:207:5: note: expected 'const char *
' but argument is of type 'char *
'
int redisAppendCommandArgv(redisContext *c, int argc, const char *argv, const size_t argvlen);
^
/tmp/phpiredis/phpiredis.c:428:5: warning: passing argument 2 of 'redisGetReply' from incompatible pointer type [enabled by default]
if (redisGetReply(connection->c, &reply) != REDIS_OK) {
^
In file included from /tmp/phpiredis/phpiredis.c:1:0:
/opt/local/include/hiredis/hiredis.h:196:5: note: expected 'void *
' but argument is of type 'struct redisReply *
'
int redisGetReply(redisContext *c, void *reply);
^
/tmp/phpiredis/phpiredis.c: In function 'zif_phpiredis_format_command':
/tmp/phpiredis/phpiredis.c:487:5: warning: passing argument 3 of 'redisFormatCommandArgv' from incompatible pointer type [enabled by default]
cmdlen = redisFormatCommandArgv(&cmd, size, elements, elementslen);
^
In file included from /tmp/phpiredis/phpiredis.c:1:0:
/opt/local/include/hiredis/hiredis.h:128:5: note: expected 'const char *
' but argument is of type 'char *
'
int redisFormatCommandArgv(char *_target, int argc, const char *_argv, const size_t argvlen);
^
make: *
* [phpiredis.lo] Error 1

Facing the same issue on Centos 6.5

Same issue here..

Hiredis: 0.13
Os: Ubuntu 14.04 LTS
Php: PHP 5.5.9-1ubuntu4.9

I notice that this issue was first filed 12 days ago. 13 days go, hiredis released a new version.

I suspect whats happened is that the new version of hiredis is not compatible with phpiredis. I am going to try installing an older version of hiredis and compiling against that.

My hypothesis seems to be holding up. I tried to build phpiredis on hiredis 0.12.1 and now I am able to build the module, however there are a number of warnings.

Most of them seem like they are probably benign, but I am not a C expert. I may try going back another version or two of hiredis and see if I can get a clean compile.

/bin/bash /usr/local/share/phpiredis/libtool --mode=compile cc  -I. -I/usr/local/share/phpiredis -DPHP_ATOM_INC -I/usr/local/share/phpiredis/include -I/usr/local/share/phpiredis/main -I/usr/local/share/phpiredis -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2   -c /usr/local/share/phpiredis/phpiredis.c -o phpiredis.lo
libtool: compile:  cc -I. -I/usr/local/share/phpiredis -DPHP_ATOM_INC -I/usr/local/share/phpiredis/include -I/usr/local/share/phpiredis/main -I/usr/local/share/phpiredis -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /usr/local/share/phpiredis/phpiredis.c  -fPIC -DPIC -o .libs/phpiredis.o
/usr/local/share/phpiredis/phpiredis.c: In function 'zif_phpiredis_multi_command':
/usr/local/share/phpiredis/phpiredis.c:224:9: warning: passing argument 2 of 'redisGetReply' from incompatible pointer type [enabled by default]
         if (redisGetReply(connection->c, &reply) != REDIS_OK) {
         ^
In file included from /usr/local/share/phpiredis/phpiredis.c:1:0:
/usr/local/include/hiredis/hiredis.h:163:5: note: expected 'void **' but argument is of type 'struct redisReply **'
 int redisGetReply(redisContext *c, void **reply);
     ^
/usr/local/share/phpiredis/phpiredis.c: In function 'zif_phpiredis_multi_command_bs':
/usr/local/share/phpiredis/phpiredis.c:294:9: warning: passing argument 3 of 'redisAppendCommandArgv' from incompatible pointer type [enabled by default]
         redisAppendCommandArgv(connection->c, cmdSize, cmdElements, cmdElementslen);
         ^
In file included from /usr/local/share/phpiredis/phpiredis.c:1:0:
/usr/local/include/hiredis/hiredis.h:174:5: note: expected 'const char **' but argument is of type 'char **'
 int redisAppendCommandArgv(redisContext *c, int argc, const char **argv, const size_t *argvlen);
     ^
/usr/local/share/phpiredis/phpiredis.c:313:9: warning: passing argument 2 of 'redisGetReply' from incompatible pointer type [enabled by default]
         if (redisGetReply(connection->c, &reply) != REDIS_OK) {
         ^
In file included from /usr/local/share/phpiredis/phpiredis.c:1:0:
/usr/local/include/hiredis/hiredis.h:163:5: note: expected 'void **' but argument is of type 'struct redisReply **'
 int redisGetReply(redisContext *c, void **reply);
     ^
/usr/local/share/phpiredis/phpiredis.c: In function 'zif_phpiredis_command':
/usr/local/share/phpiredis/phpiredis.c:352:9: warning: format not a string literal and no format arguments [-Wformat-security]
         php_error_docref(NULL TSRMLS_CC, E_WARNING, reply->str);
         ^
/usr/local/share/phpiredis/phpiredis.c: In function 'zif_phpiredis_command_bs':
/usr/local/share/phpiredis/phpiredis.c:420:5: warning: passing argument 3 of 'redisAppendCommandArgv' from incompatible pointer type [enabled by default]
     redisAppendCommandArgv(connection->c, argc, argv, (const size_t *) argvlen);
     ^
In file included from /usr/local/share/phpiredis/phpiredis.c:1:0:
/usr/local/include/hiredis/hiredis.h:174:5: note: expected 'const char **' but argument is of type 'char **'
 int redisAppendCommandArgv(redisContext *c, int argc, const char **argv, const size_t *argvlen);
     ^
/usr/local/share/phpiredis/phpiredis.c:428:5: warning: passing argument 2 of 'redisGetReply' from incompatible pointer type [enabled by default]
     if (redisGetReply(connection->c, &reply) != REDIS_OK) {
     ^
In file included from /usr/local/share/phpiredis/phpiredis.c:1:0:
/usr/local/include/hiredis/hiredis.h:163:5: note: expected 'void **' but argument is of type 'struct redisReply **'
 int redisGetReply(redisContext *c, void **reply);
     ^
/usr/local/share/phpiredis/phpiredis.c: In function 'zif_phpiredis_format_command':
/usr/local/share/phpiredis/phpiredis.c:487:5: warning: passing argument 3 of 'redisFormatCommandArgv' from incompatible pointer type [enabled by default]
     cmdlen = redisFormatCommandArgv(&cmd, size, elements, elementslen);
     ^
In file included from /usr/local/share/phpiredis/phpiredis.c:1:0:
/usr/local/include/hiredis/hiredis.h:126:5: note: expected 'const char **' but argument is of type 'char **'
 int redisFormatCommandArgv(char **target, int argc, const char **argv, const size_t *argvlen);
     ^
/bin/bash /usr/local/share/phpiredis/libtool --mode=link cc -DPHP_ATOM_INC -I/usr/local/share/phpiredis/include -I/usr/local/share/phpiredis/main -I/usr/local/share/phpiredis -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2   -o phpiredis.la -export-dynamic -avoid-version -prefer-pic -module -rpath /usr/local/share/phpiredis/modules  phpiredis.lo -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lhiredis
libtool: link: cc -shared  -fPIC -DPIC  .libs/phpiredis.o   -L/usr/local/lib -lhiredis  -O2 -Wl,-rpath -Wl,/usr/local/lib   -Wl,-soname -Wl,phpiredis.so -o .libs/phpiredis.so
libtool: link: ( cd ".libs" && rm -f "phpiredis.la" && ln -s "../phpiredis.la" "phpiredis.la" )
/bin/bash /usr/local/share/phpiredis/libtool --mode=install cp ./phpiredis.la /usr/local/share/phpiredis/modules
libtool: install: cp ./.libs/phpiredis.so /usr/local/share/phpiredis/modules/phpiredis.so
libtool: install: cp ./.libs/phpiredis.lai /usr/local/share/phpiredis/modules/phpiredis.la
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/sbin" ldconfig -n /usr/local/share/phpiredis/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/share/phpiredis/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

Yep, its working with hiredis 0.12.1

Did you see the above compiler warnings when building?

/bin/sh /home/vagrant/phpiredis/libtool --mode=compile cc -I. -I/home/vagrant/phpiredis -DPHP_ATOM_INC -I/home/vagrant/phpiredis/include -I/home/vagrant/phpiredis/main -I/home/vagrant/phpiredis -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 -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /home/vagrant/phpiredis/phpiredis.c -o phpiredis.lo
mkdir .libs
cc -I. -I/home/vagrant/phpiredis -DPHP_ATOM_INC -I/home/vagrant/phpiredis/include -I/home/vagrant/phpiredis/main -I/home/vagrant/phpiredis -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 -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /home/vagrant/phpiredis/phpiredis.c -fPIC -DPIC -o .libs/phpiredis.o
/home/vagrant/phpiredis/phpiredis.c: In function 'zif_phpiredis_multi_command':
/home/vagrant/phpiredis/phpiredis.c:224: warning: passing argument 2 of 'redisGetReply' from incompatible pointer type
/usr/local/include/hiredis/hiredis.h:163: note: expected 'void *' but argument is of type 'struct redisReply *'
/home/vagrant/phpiredis/phpiredis.c: In function 'zif_phpiredis_multi_command_bs':
/home/vagrant/phpiredis/phpiredis.c:294: warning: passing argument 3 of 'redisAppendCommandArgv' from incompatible pointer type
/usr/local/include/hiredis/hiredis.h:174: note: expected 'const char *' but argument is of type 'char *'
/home/vagrant/phpiredis/phpiredis.c:313: warning: passing argument 2 of 'redisGetReply' from incompatible pointer type
/usr/local/include/hiredis/hiredis.h:163: note: expected 'void *' but argument is of type 'struct redisReply *'
/home/vagrant/phpiredis/phpiredis.c: In function 'zif_phpiredis_command_bs':
/home/vagrant/phpiredis/phpiredis.c:420: warning: passing argument 3 of 'redisAppendCommandArgv' from incompatible pointer type
/usr/local/include/hiredis/hiredis.h:174: note: expected 'const char *' but argument is of type 'char *'
/home/vagrant/phpiredis/phpiredis.c:428: warning: passing argument 2 of 'redisGetReply' from incompatible pointer type
/usr/local/include/hiredis/hiredis.h:163: note: expected 'void *' but argument is of type 'struct redisReply *'
/home/vagrant/phpiredis/phpiredis.c: In function 'zif_phpiredis_format_command':
/home/vagrant/phpiredis/phpiredis.c:487: warning: passing argument 3 of 'redisFormatCommandArgv' from incompatible pointer type
/usr/local/include/hiredis/hiredis.h:126: note: expected 'const char *' but argument is of type 'char *'
/bin/sh /home/vagrant/phpiredis/libtool --mode=link cc -DPHP_ATOM_INC -I/home/vagrant/phpiredis/include -I/home/vagrant/phpiredis/main -I/home/vagrant/phpiredis -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 -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -o phpiredis.la -export-dynamic -avoid-version -prefer-pic -module -rpath /home/vagrant/phpiredis/modules phpiredis.lo -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lhiredis
cc -shared .libs/phpiredis.o -L/usr/local/lib -lhiredis -Wl,-rpath -Wl,/usr/local/lib -Wl,-soname -Wl,phpiredis.so -o .libs/phpiredis.so
creating phpiredis.la
(cd .libs && rm -f phpiredis.la && ln -s ../phpiredis.la phpiredis.la)
/bin/sh /home/vagrant/phpiredis/libtool --mode=install cp ./phpiredis.la /home/vagrant/phpiredis/modules
cp ./.libs/phpiredis.so /home/vagrant/phpiredis/modules/phpiredis.so
cp ./.libs/phpiredis.lai /home/vagrant/phpiredis/modules/phpiredis.la

Ok, as I suspected. I am not comfortable with those warnings in a production system. I am going to try and work backwards from 0.12.1 and see if I find a version that compiles cleanly. I will post my results.

nrk commented

Guys I'm really sorry but I won't be able to have a look at this issue until the end of May, I'm about to put an end to a long busy period that kept me away from my open-source duties and will be leaving on a trip for about 3 weeks.

If any of you have the time and the will to open a pull request that fixes the build issues with this recent hiredis release I'll be more than happy to hit the merge button as soon as possibile (I'll be leaving in 10 days, at least I can do that much until then).

Thanks!

hmm, yea the weird thing is that regardless of which hiredis version I try, it gives those warnings with all of them ... even v0.10.1, which is from Jun 19, 2011 !

I don't recall ever seeing these warnings before, but I might have just ignored them in the past and they could have been there for ever ...

looking at the commit history it doesn't look like anything changed that could have caused this warning:

/work/phpiredis/phpiredis.c:224:9: warning: passing argument 2 of 'redisGetReply' from incompatible pointer type [enabled by default]
         if (redisGetReply(connection->c, &reply) != REDIS_OK) {

Try

EXTRA_LDFLAGS=/usr/local/lib phpize && ./configure --enable-phpiredis --prefix=/usr/local --with-php-config=/usr/local/bin/php-config
nrk commented

The php7 branch should have fixed any related problem, just tested on 5.6.8 to make sure and it builds just fine. Even all of the warnings should have gone now. Please report back if you still see any issue.