Date: Tue, 6 Sep 2011 11:57:37 GMT From: Bartosz Fabianowski <freebsd@chillt.de> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/160511: [PATCH] make math/py-graphtool actually work Message-ID: <201109061157.p86BvbKQ097667@red.freebsd.org> Resent-Message-ID: <201109061200.p86C03FC082189@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 160511 >Category: ports >Synopsis: [PATCH] make math/py-graphtool actually work >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Sep 06 12:00:02 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Bartosz Fabianowski >Release: 8.2-STABLE >Organization: Dobini >Environment: FreeBSD taiko.lan 8.2-STABLE FreeBSD 8.2-STABLE #0: Fri Jul 29 23:43:59 CEST 2011 root@taiko.lan:/usr/obj/usr/src/sys/TAIKO amd6 >Description: The math/py-graphtool port uses gcc 4.5+ to build. The port builds successfully but the resulting Python modules do not work. Any attempt to import the graph_tools module ends up crashing Python. I have spent many hours investigating the issue. I am still not sure what exactly causes it but it is a boost::any_cast<> that crashes Python. The following testcase shows that, at least on my AMD64 8.2-STABLE machines, g++4.5 miscompiles boost::any_cast<>: #include <boost/any.hpp> #include <iostream> int main() { try { double d; int i = boost::any_cast<int>(d); } catch(...) { std::cout << "OK" << std::endl; } } When compiled with system g++, the program's output is "OK". When compiled with g++4.5, the output is "Abort". >How-To-Repeat: >Fix: The attached patch makes math/py-graphtool build with system g++. There a lot of warnings but the resulting Python modules actually do work. The change to src/graph/graph_bind.cc is a workaround for http://bugs.python.org/issue10910. Patch attached with submission follows: diff -ruN math/py-graphtool.orig/Makefile math/py-graphtool/Makefile --- math/py-graphtool.orig/Makefile 2011-06-07 14:12:24.000000000 +0300 +++ math/py-graphtool/Makefile 2011-09-06 13:22:19.000000000 +0300 @@ -7,6 +7,7 @@ PORTNAME= graphtool PORTVERSION= 2.2.12 +PORTREVISION= 1 CATEGORIES= math python MASTER_SITES= http://downloads.skewed.de/graph-tool/ DISTNAME= graph-tool-${PORTVERSION} @@ -22,11 +23,12 @@ CGAL.5:${PORTSDIR}/math/cgal USE_BZIP2= yes -USE_GCC= 4.5+ USE_GMAKE= yes USE_PYTHON= yes GNU_CONFIGURE= yes +MAKE_JOBS_SAFE= yes -CONFIGURE_ENV= PYTHON_VERSION=${PYTHON_VER} +CXXFLAGS+= -I${PYTHONBASE}/include +CONFIGURE_ENV= PYTHON_VERSION=${PYTHON_VER} LDFLAGS=-L${PYTHONBASE}/lib .include <bsd.port.mk> diff -ruN math/py-graphtool.orig/files/patch-graph_bind.cc math/py-graphtool/files/patch-graph_bind.cc --- math/py-graphtool.orig/files/patch-graph_bind.cc 1970-01-01 03:00:00.000000000 +0300 +++ math/py-graphtool/files/patch-graph_bind.cc 2011-09-06 13:04:28.000000000 +0300 @@ -0,0 +1,11 @@ +--- src/graph/graph_bind.cc.orig 2011-09-06 13:03:52.000000000 +0300 ++++ src/graph/graph_bind.cc 2011-09-06 10:24:24.000000000 +0300 +@@ -15,6 +15,8 @@ + // You should have received a copy of the GNU General Public License + // along with this program. If not, see <http://www.gnu.org/licenses/>. + ++#include "Python.h" ++ + #define NUMPY_EXPORT + #include "numpy_bind.hh" + >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201109061157.p86BvbKQ097667>