cschwan / sage-on-gentoo

(Unofficial) Gentoo Overlay for Sage- and Sage-related ebuilds
79 stars 26 forks source link

Changes to distutils-r1 are breaking sage build #693

Closed kiwifb closed 2 years ago

kiwifb commented 2 years ago

Specifically https://github.com/gentoo/gentoo/commit/ac1735e34dad0a1f96543daa3d7ceb303b78d842 breaks the sage building. That commit replace the call to setup.py build by setup.py build_ext to gain a few cycle. Unfortunately the sage build system relies on the call to the build target to autogenerate code under ext/interpreters. By passing directly build_ext that code doesn't get generated.

It may be possible to fix the issue by patching setup.py with some old code explicitly calling the autogeneration.

Other packages including cypari2 and fpylll should be checked over for this new behavior.

kiwifb commented 2 years ago

This issue affect both sage-9.5 and sage-9999 ebuilds.

kiwifb commented 2 years ago

In a normal sage build autogeneration occurs during build

Discovering Python/Cython source code....
distributions = ['']
Discovered Python/Cython sources, time: 3.15 seconds.
running build
Generating auto-generated sources
Building interpreters for fast_callable
-> First build of interpreters
running build_cython

But Gentoo currently skips it

Discovering Python/Cython source code....
Discovered Python/Cython sources, time: 0.15 seconds.
running build_ext
running build_cython
Enabling Cython debugging support
warning: sage/data_structures/blas_dict.pxd:10:29: Declarations should not be declared inline.

Error compiling Cython file:
------------------------------------------------------------
...
from memory_allocator cimport MemoryAllocator

from sage.rings.real_double import RDF
from sage.libs.gsl.all cimport *
from sage.misc.sageinspect import sage_getargspec
from sage.ext.interpreters.wrapper_rdf cimport Wrapper_rdf
^
------------------------------------------------------------

sage/calculus/integration.pyx:35:0: 'sage/ext/interpreters/wrapper_rdf.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
from memory_allocator cimport MemoryAllocator

from sage.rings.real_double import RDF
from sage.libs.gsl.all cimport *
from sage.misc.sageinspect import sage_getargspec
from sage.ext.interpreters.wrapper_rdf cimport Wrapper_rdf
^
------------------------------------------------------------

sage/calculus/integration.pyx:35:0: 'sage/ext/interpreters/wrapper_rdf/Wrapper_rdf.pxd' not found
kiwifb commented 2 years ago

Still testing. It may not be the definitive solution. Lessons from cypari2 say that it may have to be moved to the main setup.py if we want the missing wrapper to be installed. It would be nice to figure out if it was the case before the distutils-r1.eclass change.

strogdon commented 2 years ago

What's being used if DISTUTILS_USE_PEP517 is not set? Sage will build in this case.

kiwifb commented 2 years ago

I know. That would be legacy setuptools (or distutils, that's funny, may be the eclass should be renamed considering the incoming disappearance of distutils). I'd rather move forwards. I plan to try upstream a more comprehensive variant of the patch - there are many areas that need touching or cleaning upstream with that change.

kiwifb commented 2 years ago

I have a fix upstream for sage 9.7. Backported for 9.6 in the tree. https://trac.sagemath.org/ticket/33838

One of the reason I don't want to go back to legacy, is that upstream has moved hard to PEP517 and going to PEP517 will ultimately give us some advantages with regards to testing. There are issues to sort but on 9999 ebuild we can technically test sage from the ebuild. It unfortunately won't work out of the box for stable but I have ideas that I will put to Matthias in time.

kiwifb commented 2 years ago

Notes: https://bugs.gentoo.org/842534 was opened for this and I closed it invalid now.