phayes / geoPHP

Advanced geometry operations in PHP
https://geophp.net
Other
867 stars 265 forks source link

Error when compiled with PHP 7 #116

Open TouriSpo opened 8 years ago

TouriSpo commented 8 years ago

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

collmomo commented 8 years ago

+1

mprins commented 8 years ago

was your geos library compiled with php7 bindings?

collmomo commented 8 years ago

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

collmomo commented 8 years ago

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.

BathoryPeter commented 8 years ago

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

rohan-deshpande commented 8 years ago

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.

sascha-hendel commented 8 years ago

Any news on that issue?

sascha-hendel commented 8 years ago

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 )

rohan-deshpande commented 8 years ago

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

matthewmummert5 commented 7 years ago

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

Toilal commented 7 years ago

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 .. &&
virgolamobile commented 6 years ago

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 commented 6 years ago

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
danangponorogo commented 4 years ago

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