cython memoryview - compilation error

asked 2014-12-02 05:36:15 -0600

ATSpringer gravatar image

I'm trying to use typed memoryviews in a cython cell in a sage notebook. But even

%cython
cdef double [:] x

fails with a compiler error. See the full output below. I installed sage from the Ubuntu binary packages on OpenSuse 13.1 and 13.2. Everything seems to work fine including everything I tried with cython except memoryviews. System gcc versions are 4.8.1 and 4.8.3. I'd be very happy to know the reason for this and a workaround.

Here is the full output:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_47.py", line 10, in <module>
    exec compile(u'_support_.cython_import_all("/home/fred-2012-05-23/.sage/sage_notebook.sagenb/home/dlc/25/code/sage67.spyx", globals())' + '\n', '', 'single')
  File "", line 1, in <module>

  File "/home/fred-2012-05-23/SAGE/sage-6.3-base/local/lib/python2.7/site-packages/sagenb-0.10.8.2-py2.7.egg/sagenb/misc/support.py", line 541, in cython_import_all
    create_local_c_file=create_local_c_file)
  File "/home/fred-2012-05-23/SAGE/sage-6.3-base/local/lib/python2.7/site-packages/sagenb-0.10.8.2-py2.7.egg/sagenb/misc/support.py", line 518, in cython_import
    create_local_c_file=create_local_c_file)
  File "/home/fred-2012-05-23/SAGE/sage-6.3-base/local/lib/python2.7/site-packages/sage/misc/cython.py", line 536, in cython
    raise RuntimeError("Error compiling {}:\n{}\n{}".format(filename, log, err))
RuntimeError: Error compiling /home/fred-2012-05-23/.sage/sage_notebook.sagenb/home/dlc/25/code/sage67.spyx:
running build
running build_ext
building '_home_fred_2012_05_23__sage_sage_notebook_sagenb_home_dlc_25_code_sage67_spyx_0' extension
creating build
creating build/temp.linux-x86_64-2.7
gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/fred-2012-05-23/SAGE/sage-6.3-base/local/include/csage -I/home/fred-2012-05-23/SAGE/sage-6.3-base/local/include -I/home/fred-2012-05-23/SAGE/sage-6.3-base/local/include/python2.7 -I/home/fred-2012-05-23/SAGE/sage-6.3-base/local/lib/python/site-packages/numpy/core/include -I/home/fred-2012-05-23/SAGE/sage-6.3-base/src/sage/ext -I/home/fred-2012-05-23/SAGE/sage-6.3-base/src -I/home/fred-2012-05-23/SAGE/sage-6.3-base/src/sage/gsl -I/home/fred-2012-05-23/.sage/sage_notebook.sagenb/home/dlc/25/code -I/home/fred-2012-05-23/SAGE/sage-6.3-base/local/include/python2.7 -c _home_fred_2012_05_23__sage_sage_notebook_sagenb_home_dlc_25_code_sage67_spyx_0.c -o build/temp.linux-x86_64-2.7/_home_fred_2012_05_23__sage_sage_notebook_sagenb_home_dlc_25_code_sage67_spyx_0.o -w -O2

_home_fred_2012_05_23__sage_sage_notebook_sagenb_home_dlc_25_code_sage67_spyx_0.c:2111:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token
 static char __pyx_doc_15View.MemoryView_5array_2__getbuffer__[] = "File:  (starting at line 183)";
                             ^
_home_fred_2012_05_23__sage_sage_notebook_sagenb_home_dlc_25_code_sage67_spyx_0.c:2113:44: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token
 struct wrapperbase __pyx_wrapperbase_15View.MemoryView_5array_2__getbuffer__;
                                            ^
_home_fred_2012_05_23__sage_sage_notebook_sagenb_home_dlc_25_code_sage67_spyx_0.c:2601:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token
 static char __pyx_doc_15View.MemoryView_5array_6__getattr__[] = "File:  (starting at line 229)";
                             ^
_home_fred_2012_05_23__sage_sage_notebook_sagenb_home_dlc_25_code_sage67_spyx_0.c:2603:44: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token
 struct wrapperbase __pyx_wrapperbase_15View.MemoryView_5array_6__getattr__;
                                            ^
_home_fred_2012_05_23__sage_sage_notebook_sagenb_home_dlc_25_code_sage67_spyx_0.c:2673:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token
 static char __pyx_doc_15View.MemoryView_5array_8__getitem__[] = "File:  (starting at line 232)";
                             ^
_home_fred_2012_05_23__sage_sage_notebook_sagenb_home_dlc_25_code_sage67_spyx_0.c:2675:44: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token
 struct wrapperbase __pyx_wrapperbase_15View.MemoryView_5array_8__getitem__;
                                            ^
_home_fred_2012_05_23__sage_sage_notebook_sagenb_home_dlc_25_code_sage67_spyx_0.c:2745:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token
 static char __pyx_doc_15View.MemoryView_5array_10__setitem__[] = "File:  (starting at line 235)";
                             ^
_home_fred_2012_05_23__sage_sage_notebook_sagenb_home_dlc_25_code_sage67_spyx_0.c:2747:44: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token
 struct wrapperbase __pyx_wrapperbase_15View.MemoryView_5array_10__setitem__;
                                            ^
_home_fred_2012_05_23__sage_sage_notebook_sagenb_home_dlc_25_code_sage67_spyx_0.c:2978:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token ...
(more)
edit retag flag offensive close merge delete

Comments

Hello. I got the very same error. Did you used memory view before? Did you report it on one of the Cython mailing lists?

vdelecroix gravatar imagevdelecroix ( 2015-01-28 16:08:27 -0600 )edit