Opened 4 years ago

Closed 4 years ago

Last modified 6 months ago

#20258 closed defect (fixed)

giacpy does not build on 7.1

Reported by: tmonteil Owned by:
Priority: critical Milestone: sage-duplicate/invalid/wontfix
Component: packages: optional Keywords: sdl
Cc: frederichan, jdemeyer Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by frederichan)

Tested on Debian jessie, both 32 and 64 bits, gives the following:

Here is the relevant part of the log:

running install
running build
running build_ext
cythoning giacpy.pyx to giacpy.cpp
building 'giacpy' extension
creating build
creating build/temp.linux-x86_64-2.7
gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wno-unused -fPIC -I/opt/sagemath/sage-source/local/include -I/opt/sagemath/sage-source/local/include/python2.7 -I/opt/sagemath/sage-source/local/lib/python2.7/site-packages/numpy/core/include -I/opt/sagemath/sage-source/local/lib/python2.7/site-packages -I/opt/sagemath/sage-source/local/lib/python2.7/site-packages/sage/ext -I/opt/sagemath/sage-source/local/include/python2.7 -c giacpy.cpp -o build/temp.linux-x86_64-2.7/giacpy.o
In file included from /opt/sagemath/sage-source/local/include/giac/poly.h:25:0,
                 from /opt/sagemath/sage-source/local/include/giac/giac.h:5,
                 from giacpy.cpp:257:
/opt/sagemath/sage-source/local/include/giac/index.h:33:0: warning: ignoring #pragma anon_unions  [-Wunknown-pragmas]
 #pragma anon_unions
 ^
giacpy.cpp:262:28: fatal error: struct_signals.h: No such file or directory
 #include "struct_signals.h"
                            ^
compilation terminated.

I add Jeroen in cc since it might be related to changes in cython signals.

This trac will be solved by #19873.

Change History (10)

comment:1 Changed 4 years ago by jdemeyer

I believe that this is no longer supported in Cython (at least I don't find it in the Cython documentation):

from Cython.Distutils import build_ext
setup(...
    cmdclass={'build_ext': build_ext}
)

I recommend you to use cythonize() instead, see http://docs.cython.org/src/userguide/source_files_and_compilation.html

Last edited 4 years ago by jdemeyer (previous) (diff)

comment:2 Changed 4 years ago by frederichan

Thank you for the report and the suggestion. I could reproduce the error with sage 7.1.beta6. So I have tried the following setup.py:

#!/usr/bin/env python


from sage.env import SAGE_LOCAL,SAGE_SRC
import os

from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize


conf = {'CXXFLAGS' : [], 'LDFLAGS' : []}

libraries=['giac']
library_dirs=[SAGE_LOCAL+'/lib']
# in sage 6.7 cimport Integer needs ccobject.h but it was moved to SAGE_SRC/sage/ext
# But in sage 6.8>= the function sage_include_directories was introduced to gives the includes.
try:
    # Sage >= 6.8
    from sage.env import sage_include_directories
except ImportError:
    # Sage < 6.8
    def sage_include_directories():
        return [
            os.path.join(SAGE_LOCAL, "include"),
            os.path.join(SAGE_LOCAL, "include", "csage"),
            os.path.join(SAGE_SRC),
            os.path.join(SAGE_SRC, "sage", "ext"),
            ]
    # (on sage 6.7 without csage gives undefined symbols _signals)
    libraries.append('csage')
###

include_dirs=sage_include_directories()

ext_modules=[]

ext_modules+=cythonize([Extension(
                   "giacpy",                 # name of extension
                   ["giacpy.pyx"], #  our Cython source
                   libraries=libraries,
                   library_dirs=library_dirs,
                   include_dirs=include_dirs,
                   extra_compile_args=conf["CXXFLAGS"],
                   extra_link_args=conf["LDFLAGS"],
                   language="c++")])
#cmdclass={'build_ext': build_ext}
    


setup(


    name='giacpy',
    version='0.5.2',
    description='A Cython frontend to the c++ library giac. (Computer Algebra System)',
    author='Frederic Han',
    author_email="frederic.han@imj-prg.fr",
    url='http://webusers.imj-prg.fr/~frederic.han/xcas/giacpy/',
    long_description=open('README.txt').read(),
    license='GPLv2 or above',
    ext_modules=ext_modules
    )

I can build giacpy on sage 7.1.beta6, but now older version of sage can't because:

 File "/usr/local/sage-6.9-x86_64-Linux/local/lib/python2.7/site-packages/Cython-0.23.1-py2.7-linux-x86_64.egg/Cython/Compiler/Errors.py", line 177, in error
    raise InternalError(message)
Cython.Compiler.Errors.InternalError: Internal compiler error: 'sage/ext/interrupt.pxi' not found

comment:3 Changed 4 years ago by jdemeyer

Is it really a problem that older versions do not work?

Anyway, check if you're doing something different with Cython's include_path.

comment:4 Changed 4 years ago by frederichan

  • Dependencies set to #19873
  • Description modified (diff)

comment:5 Changed 4 years ago by frederichan

  • Status changed from new to needs_review

This is now solved by #19873.

comment:6 Changed 4 years ago by vdelecroix

  • Dependencies #19873 deleted
  • Milestone changed from sage-7.2 to sage-duplicate/invalid/wontfix
  • Status changed from needs_review to positive_review

comment:7 Changed 4 years ago by mmarco

I am getting this error when i try to install giacpy:

sage-logger 'sage-spkg  giacpy-0.5.5' '/home/mmarco/sage/logs/pkgs/giacpy-0.5.5.log'
Found local metadata for giacpy-0.5.5
Using cached file /home/mmarco/sage/upstream/giacpy-0.5.5.tar.gz
giacpy-0.5.5
====================================================
Setting up build directory for giacpy-0.5.5
Finished set up
****************************************************
Host system:
Linux neumann 4.1.15-gentoo-r1 #1 SMP PREEMPT Wed Jan 27 20:58:07 CET 2016 x86_64 Intel(R) Core(TM) i7 CPU 950 @ 3.07GHz GenuineIntel GNU/Linux
****************************************************
C compiler: gcc
C compiler version:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/mmarco/sage/local/libexec/gcc/x86_64-unknown-linux-gnu/4.9.3/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../src/configure --prefix=/home/mmarco/sage/local --with-local-prefix=/home/mmarco/sage/local --with-gmp=/home/mmarco/sage/local --with-mpfr=/home/mmarco/sage/local --with-mpc=/home/mmarco/sage/local --with-system-zlib --disable-multilib --disable-nls --enable-languages=c,c++,fortran --disable-libitm  
Thread model: posix
gcc version 4.9.3 (GCC) 
****************************************************
Deleting /home/mmarco/sage/local/lib/python/site-packages/giacpy*

Error compiling Cython file:
------------------------------------------------------------
...
     g=(g*M+gen(<long long>i))
     a=a-(i<<size)

   g=g*gen(<long long>(1<<size))+gen(<long long> a)
   if aneg:
     g=-g
      ^
------------------------------------------------------------

giacpy.pyx:5112:7: Invalid operand type for '-' (gen)
Compiling giacpy.pyx because it changed.
[1/1] Cythonizing giacpy.pyx
Traceback (most recent call last):
  File "setup.py", line 47, in <module>
    language="c++")], include_path=include_path
  File "/home/mmarco/sage/local/lib/python2.7/site-packages/Cython-0.24-py2.7-linux-x86_64.egg/Cython/Build/Dependencies.py", line 912, in cythonize
    cythonize_one(*args)
  File "/home/mmarco/sage/local/lib/python2.7/site-packages/Cython-0.24-py2.7-linux-x86_64.egg/Cython/Build/Dependencies.py", line 1034, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: giacpy.pyx

real    0m3.364s
user    0m3.251s
sys     0m0.131s

comment:8 Changed 4 years ago by frederichan

I think it is a different problem, I can reproduce it with sage 7.2.rc1 so I am opening #20569 for this

comment:9 Changed 4 years ago by vbraun

  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:10 Changed 6 months ago by tmonteil

  • Keywords sdl added
Note: See TracTickets for help on using tickets.