openvenues / php-postal

PHP bindings to libpostal for for fast international street address parsing/normalization

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Config Error

RahulRNair opened this issue · comments

commented

While Installing php-postal getting this error

./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 for libpostal support... yes, shared
checking for pkg-config... /usr/bin/pkg-config
configure: error: php_postal support requires libpostal. Use
--with-libpostal-dir=

to specify the prefix where libpostal headers
and library are located

Server - RHEL 6

PHP - 5.5

Location: /opt/php-postal & /opt/libpostal

libpostal is already installed

commented

So by default when you make install libpostal, it should use the prefix /usr/local so try ls /usr/local/lib/libpostal*. If that returns anything, then RHEL probably just doesn't have /usr/local in its default paths, so you'll have to specify it when compiling the PHP lib with: ./configure --with-libpostal-dir=/usr/local

If you installed libpostal somewhere else, i.e. did ./configure --prefix=/opt/libpostal or something like that, then the value for --with-libpostal-dir= should be identical to what you used for --prefix= when configuring the C library.

commented

ls returns this result

ls /usr/local/lib/libpostal*
/usr/local/lib/libpostal.a /usr/local/lib/libpostal.la /usr/local/lib/libpostal.so /usr/local/lib/libpostal.so.0 /usr/local/lib/libpostal.so.0.0.0

sudo ./configure --with-libpostal-dir=/usr/local/
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 for libpostal support... yes, shared
checking for pkg-config... /usr/bin/pkg-config
configure: error: php_postal support requires libpostal. Use --with-libpostal-dir=

to specify the prefix where libpostal headers and library are located

Again getting same error

commented

Ok, looking at the generated configure script, that error happens when pkg-config cannot find libpostal.

Make sure that pkg-config is installed (yum install pkgconfig if not, and reinstall the libpostal C library). I'm not sure what the default directory is on RHEL but check the following directories and look for a file called "libpostal.pc":

/usr/local/lib/pkgconfig/
/usr/lib/pkgconfig/
/usr/local/share/pkgconfig/
/usr/share/pkgconfig/

If that file can be found, you might need to set PKG_CONFIG_PATH to that directory during configure.

When pkg-config is working properly this command should return something: pkg-config --cflags --libs libpostal. If that's all working, you should be able to build successfully.

The primary targets for libpostal and its bindings are Mac and Ubuntu, so RHEL support is experimental at best. If there's something missing from the configure script that would make it easier to build on RHEL/CentOS, I'm happy to accept patches.

commented

$ pkg-config --cflags --libs libpostal
Package libpostal was not found in the pkg-config search path.
Perhaps you should add the directory containing `libpostal.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libpostal' found

$ locate libpostal.pc
/opt/libpostal/libpostal.pc
/opt/libpostal/libpostal.pc.in
/opt/libpostal_old/libpostal.pc.in
/usr/local/lib/pkgconfig/libpostal.pc

libpostal.pc is located in opt/libpostal,

package config couldnt able to identify that

commented

From what I can tell, /opt/libpostal is where the source checkout lives. It looks like the installed version is in /usr/local/lib/pkgconfig/. Try export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig, then run pkg-config --cflags --libs libpostal again. If it returns something, you should be able to run configure.

commented

fixed , moved the libpostal.pc file to package config location

export PKG_CONFIG_PATH=/usr/lib/pkgconfig
worked to solve configure problem on Centos 7
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
if you set base to /usr/local