geoPHP icon indicating copy to clipboard operation
geoPHP copied to clipboard

Error when compiled with PHP 7

Open TouriSpo opened this issue 9 years ago • 14 comments

Just tried to compile geoPHP with new PHP 7.0.1 version. Compiling fails with the following errors:

geos.c:159:8: error: unknown type name 'zend_object_value'
static zend_object_value
       ^
geos.c:161:5: error: unknown type name 'zend_objects_free_object_storage_t'
    zend_objects_free_object_storage_t st, zend_object_handlers* handlers)
    ^
geos.c:164:22: error: expected ';' after expression
    zend_object_value retval;
                     ^
                     ;
geos.c:164:5: error: use of undeclared identifier 'zend_object_value'
    zend_object_value retval;
    ^
geos.c:164:23: error: use of undeclared identifier 'retval'
    zend_object_value retval;

Is supporting PHP7 on your roadmap? Would be great to be able to update PHP and still use all the cool features of geoPHP.

Thanks for a short heads up Martin

TouriSpo avatar Dec 18 '15 10:12 TouriSpo

+1

collmomo avatar Feb 17 '16 08:02 collmomo

was your geos library compiled with php7 bindings?

mprins avatar Feb 17 '16 17:02 mprins

yes, https://trac.osgeo.org/geos/ticket/761

collmomo avatar Feb 17 '16 19:02 collmomo

The api changed. People says it takes at max 2 hour to change it to the new zend API. Unfortunately, I don't know C.

collmomo avatar Feb 17 '16 19:02 collmomo

But it's not a GeoPhp bug, GEOS is an external library.

BathoryPeter avatar Feb 24 '16 12:02 BathoryPeter

Sorry to hijack this but has anyone managed to compile geos with bindings for php7? Huge blocking issue for the team I'm working with at the moment as we really need to move to php7 but this is a crucial lib for us. Any info would be really appreciated.

rohan-deshpande avatar Jun 20 '16 06:06 rohan-deshpande

Any news on that issue?

sascha-hendel avatar Aug 24 '16 07:08 sascha-hendel

Found a solution: 1st: Compile and install GEOS package without PHP bindings 2nd: Compile and install newest PHP bindings seperately ( https://git.osgeo.org/gogs/geos/php-geos )

sascha-hendel avatar Aug 24 '16 08:08 sascha-hendel

Yes we actually hired Sandro to do this work and it's working nicely

rohan-deshpande avatar Aug 24 '16 08:08 rohan-deshpande

Is this library no longer maintained? This is an issue for me as well.

matthewmummert5 avatar May 25 '17 21:05 matthewmummert5

Just use up to date geos bindings @matthewmummert5. I hit this issue with 3.4.2, but it works well with 3.6.1 and PHP bindings from https://git.osgeo.org/gogs/geos/php-geos.

curl -s -O http://download.osgeo.org/geos/geos-3.6.1.tar.bz2 &&\
  tar -xjvf geos-3.6.1.tar.bz2 &&\
  cd geos-3.6.1/ &&\
  ./configure --enable-php &&\
  make &&\
  make install &&\
  cd ..

ldconfig

curl -s -O https://git.osgeo.org/gogs/geos/php-geos/archive/master.tar.gz &&\
    tar -zxvf master.tar.gz &&\
    cd php-geos &&\
    ./autogen.sh &&\
    ./configure &&\
    make &&\
    make install &&\
    cd .. &&

Toilal avatar Jun 16 '17 12:06 Toilal

The master.tar.gz has moved here:

https://git.osgeo.org/gitea/geos/php-geos/archive/master.tar.gz

Updates procedure here:

curl -s -O http://download.osgeo.org/geos/geos-3.6.1.tar.bz2 &&\
  tar -xjvf geos-3.6.1.tar.bz2 &&\
  cd geos-3.6.1/ &&\
  ./configure --enable-php &&\
  make &&\
  make install &&\
  cd ..

ldconfig

curl -s -O https://git.osgeo.org/gitea/geos/php-geos/archive/master.tar.gz &&\
    tar -zxvf master.tar.gz &&\
    cd php-geos &&\
    ./autogen.sh &&\
    ./configure &&\
    make &&\
    make install &&\
    cd .. &&

virgolamobile avatar Sep 15 '18 09:09 virgolamobile

Note: ./autogen.sh refers to phpize. You have to install php7.x-dev

Example for php 7.1:

sudo apt-get install php7.1-dev

virgolamobile avatar Sep 15 '18 09:09 virgolamobile

Just tried to install geos on Centos 7.6, PHP 7.3.15

# yum install bzip2
# yum install gcc
# yum install php-devel
# wget http://download.osgeo.org/geos/geos-3.8.0.tar.bz2
# tar -xjvf geos-3.8.0.tar.bz2
# cd geos-3.8.0
# ./configure

on last command ( ./configure ) I'm stuck with the following errors:

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 GEOS version... "3.8.0"
checking for GEOS CAPI version... "1.13.1"
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether make supports nested variables... (cached) yes
checking for gcc... gcc
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... configure: error: in `/root/geos-3.8.0':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

Any help greatly appreciated. Thx

danangponorogo avatar Feb 28 '20 13:02 danangponorogo