sagemath / cysignals

cysignals: interrupt and signal handling for Cython. Source repository for https://pypi.org/project/cysignals/
GNU Lesser General Public License v3.0
44 stars 23 forks source link

Compilation failure #111

Closed videlec closed 5 years ago

videlec commented 5 years ago

During the build_ext step of an installation of badic I am facing the following relatively strange error

    gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wno-unused -fPIC -Ibadic -I/opt/sage/sage-py3-gcc/local/lib/python3.7/site-packages/cysignals -I/opt/sage/sage-py3-gcc/local/include/python3.7m -c badic/cautomata.c -o build/temp.linux-x86_64-3.7/badic/cautomata.o
    In file included from badic/cautomata.c:511:
    ../../opt/sage/sage-py3-gcc/local/lib/python3.7/site-packages/cysignals/macros.h: In function '_sig_on_prejmp':
    ../../opt/sage/sage-py3-gcc/local/lib/python3.7/site-packages/cysignals/macros.h:117:5: error: 'cysigs' undeclared (first use in this function); did you mean 'cysigs_t'?
      117 |     cysigs.s = message;
          |     ^~~~~~
          |     cysigs_t
    ../../opt/sage/sage-py3-gcc/local/lib/python3.7/site-packages/cysignals/macros.h:117:5: note: each undeclared identifier is reported only once for each function it appears in
    ../../opt/sage/sage-py3-gcc/local/lib/python3.7/site-packages/cysignals/macros.h: In function '_sig_on_postjmp':
    ../../opt/sage/sage-py3-gcc/local/lib/python3.7/site-packages/cysignals/macros.h:149:9: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
      149 |     if (unlikely(jmpret > 0))
          |         ^~~~~~~~
    ../../opt/sage/sage-py3-gcc/local/lib/python3.7/site-packages/cysignals/macros.h:152:9: warning: implicit declaration of function '_sig_on_recover' [-Wimplicit-function-declaration]
      152 |         _sig_on_recover();
          |         ^~~~~~~~~~~~~~~
    ../../opt/sage/sage-py3-gcc/local/lib/python3.7/site-packages/cysignals/macros.h:158:5: error: 'cysigs' undeclared (first use in this function); did you mean 'cysigs_t'?
      158 |     cysigs.sig_on_count = 1;
          |     ^~~~~~
          |     cysigs_t
jdemeyer commented 5 years ago

Works for me. But I noticed many changes to badic after you posted this, so maybe it got fixed upstream.

videlec commented 5 years ago

It got "fixed" but I have no idea why. The setup.py was somewhat messed up but I do not explain myself why we got such an error from gcc.

jdemeyer commented 5 years ago

If you remember the badic commit that you built from, I could have a look.

tobiasdiez commented 3 years ago

I encounter the same problem in https://trac.sagemath.org/ticket/30371 (in src/setup.py uncomment the lines following # TODO: Fails due to problem in cysignals (missing cysigs) to trigger this error when running pipenv install).

x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./sage/cpython -I/home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cypari2 -I/home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals -I/home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/numpy/core/include -Isrc -Isrc/sage/ext -I. -I/home/tobias/.local/share/virtualenvs/src-hLmulNTy/include -I/usr/include/python3.8 -c sage/rings/padics/padic_capped_absolute_element.c -o build/temp.linux-x86_64-3.8/sage/rings/padics/padic_capped_absolute_element.o
    In file included from ./sage/rings/padics/transcendantal.c:10,
                     from sage/rings/padics/padic_capped_absolute_element.c:651:
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h: In function ‘_sig_on_prejmp’:
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h:117:5: error: ‘cysigs’ undeclared (first use in this function); did you mean ‘cysigs_t’?
      117 |     cysigs.s = message;
          |     ^~~~~~
          |     cysigs_t
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h:117:5: note: each undeclared identifier is reported only once for each function it appears in
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h: In function ‘_sig_on_postjmp’:
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h:149:9: warning: implicit declaration of function ‘unlikely’ [-Wimplicit-function-declaration]
      149 |     if (unlikely(jmpret > 0))
          |         ^~~~~~~~
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h:152:9: warning: implicit declaration of function ‘_sig_on_recover’ [-Wimplicit-function-declaration]
      152 |         _sig_on_recover();
          |         ^~~~~~~~~~~~~~~
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h:158:5: error: ‘cysigs’ undeclared (first use in this function); did you mean ‘cysigs_t’?
      158 |     cysigs.sig_on_count = 1;
          |     ^~~~~~
          |     cysigs_t
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h:168:9: warning: implicit declaration of function ‘_sig_on_interrupt_received’ [-Wimplicit-function-declaration]
      168 |         _sig_on_interrupt_received();
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h: In function ‘_sig_off_’:
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h:190:18: error: ‘cysigs’ undeclared (first use in this function); did you mean ‘cysigs_t’?
      190 |     if (unlikely(cysigs.sig_on_count <= 0))
          |                  ^~~~~~
          |                  cysigs_t
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h:192:9: warning: implicit declaration of function ‘_sig_off_warning’ [-Wimplicit-function-declaration]
      192 |         _sig_off_warning(file, line);
          |         ^~~~~~~~~~~~~~~~
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h: In function ‘sig_check’:
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h:218:18: error: ‘cysigs’ undeclared (first use in this function); did you mean ‘cysigs_t’?
      218 |     if (unlikely(cysigs.interrupt_received) && cysigs.sig_on_count == 0)
          |                  ^~~~~~
          |                  cysigs_t
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h: In function ‘sig_block’:
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h:252:7: error: ‘cysigs’ undeclared (first use in this function); did you mean ‘cysigs_t’?
      252 |     ++cysigs.block_sigint;
          |       ^~~~~~
          |       cysigs_t
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h: In function ‘sig_unblock’:
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h:265:7: error: ‘cysigs’ undeclared (first use in this function); did you mean ‘cysigs_t’?
      265 |     --cysigs.block_sigint;
          |       ^~~~~~
          |       cysigs_t
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h: In function ‘sig_retry’:
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h:281:18: error: ‘cysigs’ undeclared (first use in this function); did you mean ‘cysigs_t’?
      281 |     if (unlikely(cysigs.sig_on_count <= 0))
          |                  ^~~~~~
          |                  cysigs_t
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h: In function ‘sig_error’:
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h:294:18: error: ‘cysigs’ undeclared (first use in this function); did you mean ‘cysigs_t’?
      294 |     if (unlikely(cysigs.sig_on_count <= 0))
          |                  ^~~~~~
          |                  cysigs_t
    In file included from sage/rings/padics/padic_capped_absolute_element.c:651:
    ./sage/rings/padics/transcendantal.c: In function ‘padiclog’:
    ./sage/rings/padics/transcendantal.c:26:31: warning: unused variable ‘saveN’ [-Wunused-variable]
       26 |     unsigned long i, v, e, N, saveN, Np, tmp, trunc, step;
          |                               ^~~~~
    sage/rings/padics/padic_capped_absolute_element.c: At top level:
    sage/rings/padics/padic_capped_absolute_element.c:4384:15: error: ‘_sig_on_interrupt_received’ redeclared as different kind of symbol
     4384 | static void (*_sig_on_interrupt_received)(void); /*proto*/
          |               ^~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from ./sage/rings/padics/transcendantal.c:10,
                     from sage/rings/padics/padic_capped_absolute_element.c:651:
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h:168:9: note: previous implicit declaration of ‘_sig_on_interrupt_received’ was here
      168 |         _sig_on_interrupt_received();
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
    sage/rings/padics/padic_capped_absolute_element.c:4385:15: error: ‘_sig_on_recover’ redeclared as different kind of symbol
     4385 | static void (*_sig_on_recover)(void); /*proto*/
          |               ^~~~~~~~~~~~~~~
    In file included from ./sage/rings/padics/transcendantal.c:10,
                     from sage/rings/padics/padic_capped_absolute_element.c:651:
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h:152:9: note: previous implicit declaration of ‘_sig_on_recover’ was here
      152 |         _sig_on_recover();
          |         ^~~~~~~~~~~~~~~
    sage/rings/padics/padic_capped_absolute_element.c:4386:15: error: ‘_sig_off_warning’ redeclared as different kind of symbol
     4386 | static void (*_sig_off_warning)(char const *, int); /*proto*/
          |               ^~~~~~~~~~~~~~~~
    In file included from ./sage/rings/padics/transcendantal.c:10,
                     from sage/rings/padics/padic_capped_absolute_element.c:651:
    /home/tobias/.local/share/virtualenvs/src-hLmulNTy/lib/python3.8/site-packages/cysignals/macros.h:192:9: note: previous implicit declaration of ‘_sig_off_warning’ was here
      192 |         _sig_off_warning(file, line);
          |         ^~~~~~~~~~~~~~~~
    sage/rings/padics/padic_capped_absolute_element.c: In function ‘__pyx_f_4sage_5rings_6padics_29padic_capped_absolute_element_26pAdicCappedAbsoluteElement__to_gen’:
    sage/rings/padics/padic_capped_absolute_element.c:32843:233: warning: passing argument 4 of ‘__pyx_f_4sage_4libs_4pari_11convert_gmp_new_gen_from_padic’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
    32843 |   __pyx_t_4 = ((PyObject *)__pyx_f_4sage_4libs_4pari_11convert_gmp_new_gen_from_padic(__pyx_v_val, (__pyx_v_self->__pyx_base.absprec - __pyx_v_val), __pyx_v_self->__pyx_base.__pyx_base.prime_pow->__pyx_base.__pyx_base.prime->value, __pyx_t_3, __pyx_v_4sage_5rings_6padics_29padic_capped_absolute_element_holder->value)); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 152, __pyx_L1_error)
          |                                                                                                                                                                                                                                         ^~~~~~~~~
    sage/rings/padics/padic_capped_absolute_element.c:32843:233: note: expected ‘__mpz_struct *’ {aka ‘struct <anonymous> *’} but argument is of type ‘mpz_srcptr’ {aka ‘const struct <anonymous> *’}
    At top level:
    sage/rings/padics/padic_capped_absolute_element.c:38376:18: warning: ‘__pyx_pw_4sage_9structure_7element_3have_same_parent’ defined but not used [-Wunused-function]
    38376 | static PyObject *__pyx_pw_4sage_9structure_7element_3have_same_parent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
          |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    sage/rings/padics/padic_capped_absolute_element.c:38375:13: warning: ‘__pyx_doc_4sage_9structure_7element_2have_same_parent’ defined but not used [-Wunused-variable]
    38375 | static char __pyx_doc_4sage_9structure_7element_2have_same_parent[] = "\n    Return ``True`` if and only if ``left`` and ``right`` have the\n    same parent.\n\n    .. WARNING::\n\n        This function assumes that at least one of the arguments is a\n        Sage :class:`Element`. When in doubt, use the slower\n        ``parent(left) is parent(right)`` instead.\n\n    EXAMPLES::\n\n        sage: from sage.structure.element import have_same_parent\n        sage: have_same_parent(1, 3)\n        True\n        sage: have_same_parent(1, 1/2)\n        False\n        sage: have_same_parent(gap(1), gap(1/2))\n        True\n\n    These have different types but the same parent::\n\n        sage: a = RLF(2)\n        sage: b = exp(a)\n        sage: type(a)\n        <... 'sage.rings.real_lazy.LazyWrapper'>\n        sage: type(b)\n        <... 'sage.rings.real_lazy.LazyNamedUnop'>\n        sage: have_same_parent(a, b)\n        True\n    ";
          |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    sage/rings/padics/padic_capped_absolute_element.c:38031:18: warning: ‘__pyx_pw_4sage_9structure_7element_1parent’ defined but not used [-Wunused-function]
    38031 | static PyObject *__pyx_pw_4sage_9structure_7element_1parent(PyObject *__pyx_self, PyObject *__pyx_v_x) {
          |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    sage/rings/padics/padic_capped_absolute_element.c:38030:13: warning: ‘__pyx_doc_4sage_9structure_7element_parent’ defined but not used [-Wunused-variable]
    38030 | static char __pyx_doc_4sage_9structure_7element_parent[] = "\n    Return the parent of the element ``x``.\n\n    Usually, this means the mathematical object of which ``x`` is an\n    element.\n\n    INPUT:\n\n    - ``x`` -- an element\n\n    OUTPUT:\n\n    - If ``x`` is a Sage :class:`Element`, return ``x.parent()``.\n\n    - Otherwise, return ``type(x)``.\n\n    .. SEEALSO::\n\n        `Parents, Conversion and Coercion <http://doc.sagemath.org/html/en/tutorial/tour_coercion.html>`_\n        Section in the Sage Tutorial\n\n    EXAMPLES::\n\n        sage: a = 42\n   
     sage: parent(a)\n        Integer Ring\n        sage: b = 42/1\n        sage: parent(b)\n        Rational Field\n        sage: c = 42.0\n        sage: parent(c)\n        Real Field with 53 bits of precision\n\n    Some more complicated examples::\n\n        sage: x = Partition([3,2,1,1,1])\n        sage: parent(x)\n        Partitions\n        sage: v = vector(RDF, [1,2,3])\n        sage: parent(v)\n        Vector space of dimension 3 over Real Double Field\n\n    The following are not considered to be elements, so the type is\n    returned::\n\n        sage: d = int(42)  # 
Python int\n        sage: parent(d)\n        <... 'int'>\n        sage: L = list(range(10))\n        sage: parent(L)\n        <... 'list'>\n    ";
          |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1