I'm trying to compile pHash 0.9.5 on Centos 6.3 x86_64 Here is the detail of the steps I've followed:
$ yum install unzip
$ wget https://downloads.sourceforge.net/project/cimg/CImg-1.5.4.zip
$ unzip CImg-1.5.4.zip
$
$ wget http://phash.org/releases/pHash-0.9.5.tar.gz
$ tar xvf pHash-0.9.5.tar.gz
$
$ cp CImg-1.5.4/CImg.h pHash-0.9.5/src/
$
$ cd pHash-0.9.5
$ ./configure --enable-video-hash=no --enable-audio-hash=no
$ make
$ make install
Then once pHash is installed I've tried to install the php extension like this:
$ cd bindings/php
$ phpize
$ ./configure
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 for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
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... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib64/php/modules
checking for PHP installed headers prefix... /usr/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... gawk
checking whether pHash is available... yes, shared
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking for pHash in default path... found in /usr/local
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 pHash.h usability... no
checking pHash.h presence... no
checking for pHash.h... no
configure: error: 'pHash.h' header not found
$
So apparently pHash has been installed correctly checking for pHash in default path... found in /usr/local
but pHash.h
is not found.
pHash.h
is located in /usr/local/include
. I'm trying to debug the configure script to see how come this file is not located but for now I'm not really successful.
If anyone have an idea I would much appreciate. Thanks.
Maxime
UPDATE:
Apparently according the config.log
: it's caused by CImg.h library so I'm wondering if I have to register somewhere this header file...
configure:5136: checking pHash.h usability
configure:5153: g++ -c -g -O2 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_PHASH conftest.cpp >&5
In file included from conftest.cpp:51:
/usr/local/include/pHash.h:50:18: error: CImg.h: No such file or directory
In file included from conftest.cpp:51:
/usr/local/include/pHash.h:51: error: 'cimg_library' is not a namespace-name
/usr/local/include/pHash.h:51: error: expected namespace-name before ';' token
In file included from conftest.cpp:51:
/usr/local/include/pHash.h:144: error: expected ';' before '<' token
/usr/local/include/pHash.h:211: error: expected ',' or '...' before '<' token
/usr/local/include/pHash.h:250: error: expected ',' or '...' before '<' token
/usr/local/include/pHash.h:273: error: expected ',' or '...' before '<' token
In file included from conftest.cpp:51:
/usr/local/include/pHash.h:292: error: expected initializer before '<' token
UPDATE2:
ok, so I've run cpp -Wp,-v
to see which default paths was loaded by the pre-compiler:
$ cpp -Wp,-v
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.4.7/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/include
/usr/include
End of search list.
So /usr/local/include
is part of the default path so I've copied CImg.h
in this folder and try to run the ./configure
again. Now I have an issue with audiophash.h
which apparently is a known issue.
I'll try to fix it and come back here to hopefully answer my question.