nrk/phpiredis

Compile error

Closed this issue · 2 comments

Hello.
I have PHP 5.3.19

./configure' '--enable-phpiredis' '--with-hiredis-dir=/usr/local

make
/bin/sh /usr/work/src/phpiredis-master/libtool --mode=compile cc -I. -I/usr/work/src/phpiredis-master -DPHP_ATOM_INC -I/usr/work/src/phpiredis-master/include -I/usr/work/src/phpiredis-master/main -I/usr/work/src/phpiredis-master -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 /usr/work/src/phpiredis-master/phpiredis.c -o phpiredis.lo
cc -I. -I/usr/work/src/phpiredis-master -DPHP_ATOM_INC -I/usr/work/src/phpiredis-master/include -I/usr/work/src/phpiredis-master/main -I/usr/work/src/phpiredis-master -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 /usr/work/src/phpiredis-master/phpiredis.c -fPIC -DPIC -o .libs/phpiredis.o
/usr/work/src/phpiredis-master/phpiredis.c:445: error: conflicting types for ‘convert_redis_to_php’
/usr/work/src/phpiredis-master/phpiredis.c:59: note: previous declaration of ‘convert_redis_to_php’ was here
/usr/work/src/phpiredis-master/phpiredis.c: In function ‘convert_redis_to_php’:
/usr/work/src/phpiredis-master/phpiredis.c:496: error: too few arguments to function ‘convert_redis_to_php’
/usr/work/src/phpiredis-master/phpiredis.c: In function ‘zif_phpiredis_multi_command’:
/usr/work/src/phpiredis-master/phpiredis.c:524: warning: assignment from incompatible pointer type
/usr/work/src/phpiredis-master/phpiredis.c:546: warning: passing argument 2 of ‘redisGetReply’ from incompatible pointer type
/usr/local/include/hiredis/hiredis.h:188: note: expected ‘void *’ but argument is of type ‘struct redisReply *
/usr/work/src/phpiredis-master/phpiredis.c:553: error: too few arguments to function ‘convert_redis_to_php’
/usr/work/src/phpiredis-master/phpiredis.c: In function ‘zif_phpiredis_multi_command_bs’:
/usr/work/src/phpiredis-master/phpiredis.c:584: warning: assignment from incompatible pointer type
/usr/work/src/phpiredis-master/phpiredis.c:612: warning: passing argument 3 of ‘redisAppendCommandArgv’ from incompatible pointer type
/usr/local/include/hiredis/hiredis.h:195: note: expected ‘const char *’ but argument is of type ‘char *
/usr/work/src/phpiredis-master/phpiredis.c:629: warning: passing argument 2 of ‘redisGetReply’ from incompatible pointer type
/usr/local/include/hiredis/hiredis.h:188: note: expected ‘void *’ but argument is of type ‘struct redisReply *
/usr/work/src/phpiredis-master/phpiredis.c:636: error: too few arguments to function ‘convert_redis_to_php’
/usr/work/src/phpiredis-master/phpiredis.c: In function ‘zif_phpiredis_format_command’:
/usr/work/src/phpiredis-master/phpiredis.c:680: warning: passing argument 3 of ‘redisFormatCommandArgv’ from incompatible pointer type
/usr/local/include/hiredis/hiredis.h:161: note: expected ‘const char *’ but argument is of type ‘char *
/usr/work/src/phpiredis-master/phpiredis.c: In function ‘zif_phpiredis_command’:
/usr/work/src/phpiredis-master/phpiredis.c:702: warning: assignment from incompatible pointer type
/usr/work/src/phpiredis-master/phpiredis.c:728: error: too few arguments to function ‘convert_redis_to_php’
/usr/work/src/phpiredis-master/phpiredis.c: In function ‘zif_phpiredis_command_bs’:
/usr/work/src/phpiredis-master/phpiredis.c:749: warning: assignment from incompatible pointer type
/usr/work/src/phpiredis-master/phpiredis.c:787: warning: passing argument 3 of ‘redisAppendCommandArgv’ from incompatible pointer type
/usr/local/include/hiredis/hiredis.h:195: note: expected ‘const char *’ but argument is of type ‘char *
/usr/work/src/phpiredis-master/phpiredis.c:794: warning: passing argument 2 of ‘redisGetReply’ from incompatible pointer type
/usr/local/include/hiredis/hiredis.h:188: note: expected ‘void *’ but argument is of type ‘struct redisReply *
/usr/work/src/phpiredis-master/phpiredis.c:806: error: too few arguments to function ‘convert_redis_to_php’
make: *** [phpiredis.lo] Error 1

Can you help me to compile?

Hello.
I am also experiencing this error.

This is with the newest commit: 1b3195f

This will not compile with PHP build from source on redhat 6.
It will however compile with PHP packages from this third-party repository: http://blog.famillecollet.com/pages/Config-en

But i cannot use those packages due to company policy.

I can supply more information and try steps to fix this issue but i have come to the end of my skills in fixing this problem on my own.

More info:
Compiled PHP version: 5.4.12
Configure command: ./configure --enable-phpiredis --with-hiredis-dir=/usr/local/hiredis --with-php-config=/usr/local/php-5.4.12/bin/php-config


I found a fix.
I had to recompile apache with prefork module active (--with-MPM=prefork).
Then i recompiled php against that apache build.
Then i configured phpiredis with:
./configure --enable-phpiredis --with-hiredis-dir=/usr/local/hiredis --with-php-config=/usr/local/php-5.4.11/bin/php-config

At this point it gave linking errors when i tried a "make", saying it couldnt find -lhiredis
So i edited the Makefile and changed this line:
EXTRA_LDFLAGS = -L/usr/local/hiredis/lib

Then i could run make and it will compile a working phpiredis.so file.

(I know there is an option to set LDFLAGS as an environment option, but that failed for me)

nrk commented

Thanks @dkijo, I noticed that it can be hard on some environments to get the extension to compile successfully due to sporadic issues with the system finding the needed hiredis files. I'll investigate your EXTRA_LDFLAGS tip when I'm back from a trip!