Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate Sage-specific Cython pragmas like #clib #24105

Closed
jdemeyer opened this issue Oct 25, 2017 · 11 comments
Closed

Deprecate Sage-specific Cython pragmas like #clib #24105

jdemeyer opened this issue Oct 25, 2017 · 11 comments

Comments

@jdemeyer
Copy link

Deprecate

  1. Cython preprocessor pragmas like #clib flint. Instead, you can use the Cython declarations like # distutils: libraries = flint.

  2. Various functions in sage.misc.cython to implement this. Keep them as private underscored functions.

  3. The module sage.misc.cython_c which currently only contains a wrapper around cython_import_all().

Component: misc

Author: Jeroen Demeyer

Branch/Commit: de24e8b

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/24105

@jdemeyer jdemeyer added this to the sage-8.1 milestone Oct 25, 2017
@jdemeyer

This comment has been minimized.

@jdemeyer
Copy link
Author

@jdemeyer
Copy link
Author

New commits:

de24e8bDeprecate Sage-specific Cython pragmas like #clib

@jdemeyer
Copy link
Author

Commit: de24e8b

@jdemeyer

This comment has been minimized.

@tscrim
Copy link
Collaborator

tscrim commented Oct 25, 2017

comment:5

Makes sense and LGTM.

@tscrim
Copy link
Collaborator

tscrim commented Oct 25, 2017

Reviewer: Travis Scrimshaw

@kiwifb
Copy link
Member

kiwifb commented Oct 31, 2017

comment:6

Well my compiler doesn't like it in sage-on-gentoo

sage -t --long --warn-long 73.3 /usr/lib64/python2.7/site-packages/sage/libs/pynac/pynac.pxd
**********************************************************************
File "/usr/lib64/python2.7/site-packages/sage/libs/pynac/pynac.pxd", line 10, in sage.libs.pynac.pynac
Failed example:
    cython(  # long time; random compiler warnings
    '''
    # distutils: language = c++
    # distutils: libraries = pynac
    # distutils: extra_compile_args = --std=c++11
    cimport sage.libs.pynac.pynac
    ''')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python2.7/site-packages/sage/doctest/forker.py", line 518, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/lib64/python2.7/site-packages/sage/doctest/forker.py", line 888, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.libs.pynac.pynac[0]>", line 7, in <module>
        ''')
      File "sage/misc/lazy_import.pyx", line 354, in sage.misc.lazy_import.LazyImport.__call__ (/dev/shm/portage/sci-mathematics/sage-9999/work/sage-9999/src-python2_7/build/cythonized/sage/misc/lazy_import.c:3638)
        return self.get_object()(*args, **kwds)
      File "/usr/lib64/python2.7/site-packages/sage/misc/cython.py", line 906, in cython_compile
        create_local_c_file=False)
      File "/usr/lib64/python2.7/site-packages/sage/misc/cython.py", line 816, in cython_import_all
        create_local_c_file=create_local_c_file)
      File "/usr/lib64/python2.7/site-packages/sage/misc/cython.py", line 793, in cython_import
        **kwds)
      File "/usr/lib64/python2.7/site-packages/sage/misc/cython.py", line 590, in cython
        dist.run_command("build")
      File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/lib64/python2.7/distutils/command/build.py", line 127, in run
        self.run_command(cmd_name)
      File "/usr/lib64/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/lib64/python2.7/distutils/command/build_ext.py", line 340, in run
        self.build_extensions()
      File "/usr/lib64/python2.7/distutils/command/build_ext.py", line 449, in build_extensions
        self.build_extension(ext)
      File "/usr/lib64/python2.7/distutils/command/build_ext.py", line 531, in build_extension
        target_lang=language)
      File "/usr/lib64/python2.7/distutils/ccompiler.py", line 691, in link_shared_object
        extra_preargs, extra_postargs, build_temp, target_lang)
      File "/usr/lib64/python2.7/distutils/unixccompiler.py", line 205, in link
        raise LinkError, msg
    LinkError: command 'x86_64-pc-linux-gnu-g++' failed with exit status 1
**********************************************************************

I am on gcc-6.4.0.

@jdemeyer
Copy link
Author

comment:7

Can you run the test manually outside of the doctester? You should see a better error message, which is not shown here because the doctester omits normal output if an exception was raised.

@kiwifb
Copy link
Member

kiwifb commented Oct 31, 2017

comment:8

Replying to @jdemeyer:

Can you run the test manually outside of the doctester? You should see a better error message, which is not shown here because the doctester omits normal output if an exception was raised.

Thanks for that clue! That's caused by my multi-python pynac hack in sage-on-gentoo. The previous doctest was adjusted with a sed command and needs adjusting.

Glad I didn't put this back to "need_work".

@vbraun
Copy link
Member

vbraun commented Nov 1, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants