Hi,
Can anyone explain why the following works:
----- 8< ----- 8< ----- 8< ----- 8< ----- 8< ----- 8< ----- 8< ----- 8< -----
$ ~/co/sage/sage --version
SageMath version 8.2.beta8, Release Date: 2018-03-10
$ head foo.pyx setup.py
==> foo.pyx <==
from sage.libs.gmp.types cimport mpz_t
==> setup.py <==
import setuptools, sage.env
from Cython.Build import cythonize
from distutils.core import Extension
ext = Extension("foo", ["foo.pyx"],
include_dirs=sage.env.sage_include_directories())
setuptools.setup(ext_modules=cythonize(ext))
$ ~/co/sage/sage -python setup.py build
Compiling foo.pyx because it changed.
[1/1] Cythonizing foo.pyx
running build
running build_ext
building 'foo' extension
gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wno-unused -fPIC
-I/home/marc/co/sage/local/include -
I/home/marc/co/sage/local/include/python2.7
-I/home/marc/co/sage/local/lib/python2.7/site-packages/numpy/core/include -
I/home/marc/co/sage/local/lib/python2.7/site-packages
-I/home/marc/co/sage/local/lib/python2.7/site-packages/sage/ext -
I/home/marc/co/sage/local/include/python2.7 -c foo.c -o
build/temp.linux-x86_64-2.7/foo.o
gcc -pthread -shared -L/home/marc/co/sage/local/lib
-Wl,-rpath,/home/marc/co/sage/local/lib -L/home/marc/co/sage/local/lib -Wl,-
rpath,/home/marc/co/sage/local/lib build/temp.linux-x86_64-2.7/foo.o
-L/home/marc/co/sage/local/lib -lpython2.7 -o build/lib.linux-x86_64-2.7/foo.so
----- 8< ----- 8< ----- 8< ----- 8< ----- 8< ----- 8< ----- 8< ----- 8< -----
but the variant below doesn't?
----- 8< ----- 8< ----- 8< ----- 8< ----- 8< ----- 8< ----- 8< ----- 8< -----
$ head foo.pyx setup.py
==> foo.pyx <==
from sage.libs.mpfr.types cimport mpfr_t # <<<< changed
==> setup.py <==
import setuptools, sage.env
from Cython.Build import cythonize
from distutils.core import Extension
ext = Extension("foo", ["foo.pyx"],
include_dirs=sage.env.sage_include_directories())
setuptools.setup(ext_modules=cythonize(ext))
$ ~/co/sage/sage -python setup.py build
foo.pyx: cannot find cimported module 'sage.libs.mpfr.types'
Compiling foo.pyx because it changed.
[1/1] Cythonizing foo.pyx
Error compiling Cython file:
------------------------------------------------------------
...
from sage.libs.mpfr.types cimport mpfr_t
^
------------------------------------------------------------
foo.pyx:1:0: 'sage/libs/mpfr/types.pxd' not found
Error compiling Cython file:
------------------------------------------------------------
...
from sage.libs.mpfr.types cimport mpfr_t
^
------------------------------------------------------------
foo.pyx:1:0: 'sage/libs/mpfr/types/mpfr_t.pxd' not found
Traceback (most recent call last):
File "setup.py", line 7, in <module>
setuptools.setup(ext_modules=cythonize(ext))
File
"/home/marc/co/sage/local/lib/python2.7/site-packages/Cython/Build/Dependencies.py",
line 1039, in cythonize
cythonize_one(*args)
File
"/home/marc/co/sage/local/lib/python2.7/site-packages/Cython/Build/Dependencies.py",
line 1161, in cythonize_one
raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: foo.pyx
(exit 1)
----- 8< ----- 8< ----- 8< ----- 8< ----- 8< ----- 8< ----- 8< ----- 8< -----
Thanks,
--
Marc
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.