Opened 12 years ago

Closed 10 years ago

Last modified 6 years ago

#541 closed defect (fixed)

geos SVN fails to build php interface when php is compiled with threads

Reported by: temptorsent Owned by: benmorel
Priority: major Milestone: GEOS Fund Me
Component: PHP Version: main
Severity: Significant Keywords: TSRMLS_CC, PHP, threads, compile failure
Cc: benmorel

Description

Building geos from SVN under funtoo (with applied patch from ticket #513 to support php5.4) against PHP 5.4.2 and apache 2.2.22 compiled with threads enabled results in:

Making all in php
make[1]: Entering directory `/var/tmp/portage/sci-libs/geos-9999/work/geos-9999/php'
Making all in .
make[2]: Entering directory `/var/tmp/portage/sci-libs/geos-9999/work/geos-9999/php'
/bin/sh ../libtool  --tag=CC   --mode=compile x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../include -I../include/geos   `/usr/bin/php-config --includes` -DCOMPILE_DL_GEOS -I../capi -I../include  -pedantic -Wall -ansi -Wno-long-long  -ffloat-store -std=gnu99 -march=corei7 -O2 -pipe -c -o geos_la-geos.lo `test -f 'geos.c' || echo './'`geos.c
libtool: compile:  x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../include -I../include/geos -I/usr/lib64/php5.4/include/php -I/usr/lib64/php5.4/include/php/main -I/usr/lib64/php5.4/include/php/TSRM -I/usr/lib64/php5.4/include/php/Zend -I/usr/lib64/php5.4/include/php/ext -I/usr/lib64/php5.4/include/php/ext/date/lib -DCOMPILE_DL_GEOS -I../capi -I../include -pedantic -Wall -ansi -Wno-long-long -ffloat-store -std=gnu99 -march=corei7 -O2 -pipe -c geos.c  -fPIC -DPIC -o .libs/geos_la-geos.o
geos.c: In function 'noticeHandler':
geos.c:87:27: error: 'tsrm_ls' undeclared (first use in this function)
geos.c:87:27: note: each undeclared identifier is reported only once for each function it appears in
geos.c: In function 'errorHandler':
geos.c:99:56: error: expected expression before ',' token
geos.c:99:56: error: 'tsrm_ls' undeclared (first use in this function)
geos.c:99:56: error: too many arguments to function 'zend_exception_get_default'
/usr/lib64/php5.4/include/php/Zend/zend_exceptions.h:37:28: note: declared here
geos.c: In function 'setRelay':
geos.c:111:61: error: 'tsrm_ls' undeclared (first use in this function)
geos.c: In function 'getRelay':
geos.c:117:62: error: 'tsrm_ls' undeclared (first use in this function)
geos.c: In function 'Gen_create_obj':
geos.c:159:11: warning: unused variable 'tmp' [-Wunused-variable]
geos.c: In function 'dumpGeometry':
geos.c:435:9: error: 'tsrm_ls' undeclared (first use in this function)
geos.c: In function 'Geometry_create_obj':
geos.c:457:5: warning: passing argument 2 of 'Gen_create_obj' from incompatible pointer type [enabled by default]
geos.c:156:1: note: expected 'void ***' but argument is of type 'void (*)(void *, void ***)'
geos.c:457:5: warning: passing argument 3 of 'Gen_create_obj' from incompatible pointer type [enabled by default]
geos.c:156:1: note: expected 'zend_objects_free_object_storage_t' but argument is of type 'struct zend_object_handlers *'
geos.c:457:5: error: too few arguments to function 'Gen_create_obj'
geos.c:156:1: note: declared here
geos.c: In function 'WKTReader_create_obj':
geos.c:1967:5: warning: passing argument 2 of 'Gen_create_obj' from incompatible pointer type [enabled by default]
geos.c:156:1: note: expected 'void ***' but argument is of type 'void (*)(void *, void ***)'
geos.c:1967:5: warning: passing argument 3 of 'Gen_create_obj' from incompatible pointer type [enabled by default]
geos.c:156:1: note: expected 'zend_objects_free_object_storage_t' but argument is of type 'struct zend_object_handlers *'
geos.c:1967:5: error: too few arguments to function 'Gen_create_obj'
geos.c:156:1: note: declared here
geos.c: In function 'WKTWriter_create_obj':
geos.c:2054:5: warning: passing argument 2 of 'Gen_create_obj' from incompatible pointer type [enabled by default]
geos.c:156:1: note: expected 'void ***' but argument is of type 'void (*)(void *, void ***)'
geos.c:2054:5: warning: passing argument 3 of 'Gen_create_obj' from incompatible pointer type [enabled by default]
geos.c:156:1: note: expected 'zend_objects_free_object_storage_t' but argument is of type 'struct zend_object_handlers *'
geos.c:2054:5: error: too few arguments to function 'Gen_create_obj'
geos.c:156:1: note: declared here
geos.c: In function 'WKBWriter_create_obj':
geos.c:2231:5: warning: passing argument 2 of 'Gen_create_obj' from incompatible pointer type [enabled by default]
geos.c:156:1: note: expected 'void ***' but argument is of type 'void (*)(void *, void ***)'
geos.c:2231:5: warning: passing argument 3 of 'Gen_create_obj' from incompatible pointer type [enabled by default]
geos.c:156:1: note: expected 'zend_objects_free_object_storage_t' but argument is of type 'struct zend_object_handlers *'
geos.c:2231:5: error: too few arguments to function 'Gen_create_obj'
geos.c:156:1: note: declared here
geos.c: In function 'WKBReader_create_obj':
geos.c:2425:5: warning: passing argument 2 of 'Gen_create_obj' from incompatible pointer type [enabled by default]
geos.c:156:1: note: expected 'void ***' but argument is of type 'void (*)(void *, void ***)'
geos.c:2425:5: warning: passing argument 3 of 'Gen_create_obj' from incompatible pointer type [enabled by default]
geos.c:156:1: note: expected 'zend_objects_free_object_storage_t' but argument is of type 'struct zend_object_handlers *'
geos.c:2425:5: error: too few arguments to function 'Gen_create_obj'
geos.c:156:1: note: declared here
geos.c:2426:1: warning: control reaches end of non-void function [-Wreturn-type]
geos.c: In function 'WKBWriter_create_obj':
geos.c:2232:1: warning: control reaches end of non-void function [-Wreturn-type]
geos.c: In function 'Geometry_create_obj':
geos.c:458:1: warning: control reaches end of non-void function [-Wreturn-type]
geos.c: In function 'WKTWriter_create_obj':
geos.c:2055:1: warning: control reaches end of non-void function [-Wreturn-type]
geos.c: In function 'WKTReader_create_obj':
geos.c:1968:1: warning: control reaches end of non-void function [-Wreturn-type]
make[2]: *** [geos_la-geos.lo] Error 1
make[2]: Leaving directory `/var/tmp/portage/sci-libs/geos-9999/work/geos-9999/php'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/sci-libs/geos-9999/work/geos-9999/php'
make: *** [all-recursive] Error 1

Disabling threading results in a successful compilation. The problem children appear to be the TSRMLS_CC macros scattered throughout. The variable tsrm_ls not defined anywhere in the scope, and I suspect that the macro may be misused in some places.

Change History (12)

comment:1 by strk, 12 years ago

Patches welcome. Note that GEOS isn't thread safe in itself.

comment:2 by strk, 12 years ago

Milestone: 3.3.4GEOS Future

comment:3 by benmorel, 10 years ago

Cc: benmorel added

Any update on this issue? Two years later, compilation is still failing on PHP 5.4, 5.5 and 5.6 threaded versions.

comment:4 by strk, 10 years ago

Nobody found the time to produce a patch, evidently. I haven't had this problem, personally. If you attach a patch I'm happy to apply it.

comment:5 by benmorel, 10 years ago

Thanks for the update! I don't have the knowledge to produce such a patch, unfortunately. Hopefully someone who does will come across this!

comment:6 by benmorel, 10 years ago

Owner: changed from strk to benmorel

I think nailed that one after all. Please see this pull request:

https://github.com/libgeos/libgeos/pull/38

comment:7 by strk, 10 years ago

Resolution: fixed
Status: newclosed

Thanks, committed as r4019 in trunk (3.5.0) and r4020 in 3.4 branch (3.4.3)

comment:8 by Sandro Santilli <strk@…>, 7 years ago

In fed1a3a/git:

Fixed compilation against thread-safe PHP (ZTS)

Closes #541
Patch-by: Benjamin Morel <benjamin.morel@…>
Signed-off-by: Sandro Santilli <strk@…>

git-svn-id: http://svn.osgeo.org/geos/trunk@4019 5242fede-7e19-0410-aef8-94bd7d2200fb

comment:9 by Sandro Santilli <strk@…>, 7 years ago

In fed1a3a/git:

Fixed compilation against thread-safe PHP (ZTS)

Closes #541
Patch-by: Benjamin Morel <benjamin.morel@…>
Signed-off-by: Sandro Santilli <strk@…>

git-svn-id: http://svn.osgeo.org/geos/trunk@4019 5242fede-7e19-0410-aef8-94bd7d2200fb

comment:10 by Sandro Santilli <strk@…>, 7 years ago

In fed1a3a/git:

Fixed compilation against thread-safe PHP (ZTS)

Closes #541
Patch-by: Benjamin Morel <benjamin.morel@…>
Signed-off-by: Sandro Santilli <strk@…>

git-svn-id: http://svn.osgeo.org/geos/trunk@4019 5242fede-7e19-0410-aef8-94bd7d2200fb

comment:11 by robe, 6 years ago

Milestone: GEOS FutureGEOS Fund Me

Milestone renamed

comment:12 by Sandro Santilli <strk@…>, 6 years ago

In fed1a3a/git:

Fixed compilation against thread-safe PHP (ZTS)

Closes #541
Patch-by: Benjamin Morel <benjamin.morel@…>
Signed-off-by: Sandro Santilli <strk@…>

git-svn-id: http://svn.osgeo.org/geos/trunk@4019 5242fede-7e19-0410-aef8-94bd7d2200fb

Note: See TracTickets for help on using tickets.