Bug 213173 - graphics/geos: Fix geos::geom::CoordinateArraySequenceFactory assertion
Summary: graphics/geos: Fix geos::geom::CoordinateArraySequenceFactory assertion
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Sunpoet Po-Chuan Hsieh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-03 14:47 UTC by Rainer Hurling
Modified: 2017-05-12 09:40 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (sunpoet)


Attachments
patch to add test env and circumvent dynamic-cast problems (938 bytes, patch)
2016-10-03 14:47 UTC, Rainer Hurling
no flags Details | Diff
corrected patch for optimization problem (986 bytes, patch)
2016-10-04 15:28 UTC, Rainer Hurling
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Hurling 2016-10-03 14:47:42 UTC
Created attachment 175389 [details]
patch to add test env and circumvent dynamic-cast problems

Ports like databases/postgisXX, graphics/qgis and others depend on graphics/geos. At least with QGIS and PostGIS there are problems in some functionality, based on graphics/geos. Especially PostGIS 2.1 and 2.2 show crashes with small datasets on FreeBSD 10.x, 11.x and HEAD [1]. The problem is also observed on OSX>=10.6 [2].

After adding some lines to the ports Makefile to get 'make check' functional[3], and running the tests for graphics/geos, an assertion can be observed, as described in tests/unit/test-suite.log:


---> group: geos::geom::CoordinateArraySequenceFactory, test: test<1>
     problem: assertion failed
tests summary: failures:1 ok:1037
FAIL geos_unit (exit status: 1)


It turns out, that there is a dynamic-cast problem with newer base compiler suites, which can be circumvented[2]. The solution for FreeBSD is exactly the same as described for Mac OSX. After a rebuild of graphics/geos with 'CXXFLAGS=-Wnon-virtual-dtor -Woverloaded-virtual' all tests of GEOS are fine and also PostGIS does not crash on analyzing small datasets [1] anymore.

The appended patch should
- enable testing environment and add target 'check'
- add CXXFLAGS=-Wnon-virtual-dtor -Woverloaded-virtual
- bump PORTREVISION


portlint -AC is happy. Tested with Poudriere for HEADa/i, 10.3a/i and 9.3a/i with no problems.


[1] https://trac.osgeo.org/postgis/ticket/2985
[2] https://trac.osgeo.org/geos/wiki/BuildingOnUnixWithCMake
[3] https://trac.osgeo.org/geos/ticket/299
Comment 1 Rainer Hurling 2016-10-04 15:28:21 UTC
Created attachment 175416 [details]
corrected patch for optimization problem

After looking into the testing problems with GEOS again, it seems to me, that my previous analysis founds not the real problem. Instead of changing 

  CXXFLAGS=-Wnon-virtual-dtor -Woverloaded-virtual

it should be sufficient to remove the optimization -O2 from CXXFLAGS in all Makefiles of the sources. I had success with

  post-configure:
  	@${FIND} ${WRKSRC} -name Makefile -exec \
  		${REINPLACE_CMD} -e \
  			's|CXXFLAGS = \-O2|CXXFLAGS =|' \{\} \;

With this change 'make check' produces no errors any more.


-------
The conclusion, that a corrected graphics/geos port also avoid the crashes of PostGIS, described in comment #1, was also wrong. It turns out, the I erroneously built PostgreSQL ports with DEBUG option enabled. With disabled DEBUG option, the crashes can be observed again. So I am afraid, the problem is on the PostgreSQL side and not with GEOS.
Comment 2 Sunpoet Po-Chuan Hsieh freebsd_committer 2016-11-05 09:47:04 UTC
I'm testing this patch and I'll commit it ASAP.
Comment 3 commit-hook freebsd_committer 2016-11-19 08:03:27 UTC
A commit references this bug:

Author: sunpoet
Date: Sat Nov 19 08:02:56 UTC 2016
New revision: 426351
URL: https://svnweb.freebsd.org/changeset/ports/426351

Log:
  - Fix geos::geom::CoordinateArraySequenceFactory assertion
  - Convert to new test framework
  - Bump PORTREVISION for package change

  PR:		213173
  Submitted by:	Rainer Hurling <rhurlin@gwdg.de>

Changes:
  head/graphics/geos/Makefile
Comment 4 Merlene Brown 2017-05-12 09:40:59 UTC
Thanks for really good suggestions you shared here. Hope you will share these kinds of things with us also in future. http://www.domyhomework4me.net/