Wednesday, August 01, 2018

Re: py-numpy broken on macppc ?

On Wed, Jul 25, 2018 at 7:26 AM, Daniel Dickman <didickman@gmail.com> wrote:
>
>
>> On Jul 21, 2018, at 5:35 AM, Landry Breuil <landry@openbsd.org> wrote:
>>
>> Hi,
>>
>> building any port that depends at runtime on py-numpy on macppc fails
>> now with undef symbols, here example with py3-laspy:
>>
>> ===> py3-laspy-1.5.1 depends on: py3-numpy-* -> py3-numpy-1.14.5
>> ....
>> Traceback (most recent call last):
>> File "./setup.py", line 4, in <module>
>> import laspy
>> File "/usr/obj/ports/py-laspy-1.5.1-python3/laspy-1.5.1/laspy/__init__.py", line 5, in <module>
>> from laspy import base
>> File "/usr/obj/ports/py-laspy-1.5.1-python3/laspy-1.5.1/laspy/base.py", line 7, in <module>
>> import numpy as np
>> File "/usr/local/lib/python3.6/site-packages/numpy/__init__.py", line 166, in <module>
>> from . import random
>> File "/usr/local/lib/python3.6/site-packages/numpy/random/__init__.py", line 99, in <module>
>> from .mtrand import *
>> ImportError: Cannot load specified object
>> python3.6:/usr/local/lib/python3.6/site-packages/numpy/random/mtrand.so: undefined symbol '_savegpr_24'
>> python3.6:/usr/local/lib/python3.6/site-packages/numpy/random/mtrand.so: undefined symbol '_restgpr_24_x'
>
> It seems to be due to mtrand.c in numpy 1.14.3. If I roll back to the version of that file used in numpy 1.14.2 then things seem to be fixed on macppc.
>
> Not sure if the problem is due to the upgrade of Cython or some other problem (they used Cython 0.28.2 instead of 0.26.1).
>
> I should be able to commit a fix shortly but want to see if I can dig a bit more into the issue and will try to report this upstream as well to see if there are any thoughts there.
>
> Thanks for reporting.

I *think* I've tracked down the breakage to Cython's recent use of
__attribute__((optimize("Os"))) in the generated code. I have to
double check this but it looks like removing this attribute from
mtrand.c might fix things.

The Cython commit that introduced that change is this one:
https://github.com/cython/cython/commit/969765b6b9f22d5bae6206ff1ce0055f116bce94

So if my assumptions are correct, then I'm not sure if:
1) other things using Cython on OpenBSD/macppc could be broken too
(therefore cc'ing Cython MAINTAINER as fyi)
2) gcc on macppc could benefit from any changes or not.

No comments:

Post a Comment