[Scipy-tickets] [SciPy] #1810: QHull module crashes on debian if QHull is already installed

SciPy Trac scipy-tickets@scipy....
Fri Jan 11 08:12:15 CST 2013

#1810: QHull module crashes on debian if QHull is already installed
 Reporter:  PierreBdR       |       Owner:  warren.weckesser
     Type:  defect          |      Status:  new             
 Priority:  high            |   Milestone:  Unscheduled     
Component:  scipy.spatial   |     Version:  0.11.0          
 Keywords:  qhull segfault  |  
 To reproduce:
  1 - install libqhull-dev on debian (or any other distribution with the
 option qh_QHpointer set to 1)

  2 - compile scipy on the machine, possibly with "pip install scipy" but
 compiling by hand works too

  3 - run the following script:

     >>> import scipy.spatial

     >>> import numpy

     >>> pts = numpy.random.rand(10,2)

     >>> d = scipy.spatial.Delaunay(pts)

 The error received is then:

     Program received signal SIGSEGV, Segmentation fault.

 The reason is that scipy compiles against its own version of qhull, in
 which qh_QHpointer is set to 0, and then link against the system version
 of QHull in which qh_QHpointer is set to 1. The two versions of the
 libraries are incompatible and the first access to the qh_qh data
 structure will crash (this happens on line 170 of qhull.cyx which is the
 line 1791 of qhull.c).

 This can be corrected in two ways:
  1 - correct the build script to link (statically) with the qhull library
 generated by scipy, whether or not the system has qhull install

  2 - use the `qh` macro instead of accessing directly the `qh_qh` data
 structure, and remove line 170 of qhull.pyx. The line read:

     qh_qh.NOerrexit = 1

  The qh_qh structure should not be accessed before being allocated, and
 qh_new_qhull is in charged for the initialization of qh_qh anyway.

Ticket URL: <http://projects.scipy.org/scipy/ticket/1810>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.

More information about the Scipy-tickets mailing list