New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #34146 (new defect)

Opened 14 months ago

Last modified 6 months ago

Cython builds using numpy fail due to incorrectly placed headers

Reported by: bgamari@… Owned by: akitada@…
Priority: Normal Milestone:
Component: ports Version: 2.0.4
Keywords: Cc:
Port: py27-cython

Description

Cython builds of code requiring numpy fail as cython invokes gcc with the command line,

/usr/bin/gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -pipe -O2 -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c photon_tools/bin_photons.c -o build/temp.macosx-10.6-x86_64-2.7/photon_tools/bin_photons.o

while the headers installed by the numpy package (e.g. arrayobject.h) are located in /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy. Creating a symlink as follows works around the issue,

$ cd /opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
$ sudo ln -s ../../lib/python2.7/site-packages/numpy/core/include/numpy numpy

Change History

comment:1 Changed 14 months ago by bgamari@…

  • Cc bgamari@… added

Cc Me!

comment:2 Changed 14 months ago by ryandesign@…

  • Owner changed from macports-tickets@… to dh@…
  • Cc ram@… added; bgamari@… removed

comment:3 Changed 14 months ago by ram@…

Isn't this a problem with the software you're trying to build? i.e. it's not using the correct location for the numpy headers...

comment:4 Changed 14 months ago by bgamari@…

No, the software being built uses distutils, the recommended way to build Cython code, which should take care of these platform specific details. This means, however, that this might be a problem not in numpy but in the Cython packaging.

comment:5 Changed 14 months ago by ram@…

The problem is not with NumPy as it correctly returns the correct path for it's headers when queried:

$ python
Python 2.7.3 (default, Apr 19 2012, 22:23:11) 
[GCC 4.2.1 Compatible Apple Clang 3.1 (tags/Apple/clang-318.0.58)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from numpy.lib.utils import get_include
>>> get_include()
'/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include'
>>>

I imagine the software you're building, or CPython, isn't correctly querying NumPy where it's headers are located.

Last edited 6 months ago by ram@… (previous) (diff)

comment:6 Changed 14 months ago by bgamari@…

As I said previously, the package uses distutils to build the Cython code. Given that numpy correctly reports its header locations, it seems that the problem in this case is in the cython port. The "port" field of this ticket should be updated accordingly.

comment:7 Changed 14 months ago by ram@…

  • Port changed from py27-numpy to py27-cython, py27-numpy

comment:8 Changed 10 months ago by jmr@…

  • Cc akitada@… added

comment:9 Changed 6 months ago by ram@…

  • Cc akitada@…, ram@… removed
  • Owner changed from dh@… to akitada@…
  • Port changed from py27-cython, py27-numpy to py27-cython
Note: See TracTickets for help on using tickets.