Skip to content

FTBS cython errors

Description:

I wanted to rebuild python-pycapn in the context of https://archlinux.org/todo/capnproto-1011-rebuild/ but it generally fails to build right now:

Click to view buildlog
==> Starting build()...
* Getting build dependencies for wheel...
warning: capnp/includes/capnp_cpp.pxd:364:17: Rvalue-reference as function argument not supported
performance hint: capnp/lib/capnp.pyx:297:5: Exception check on 'make_reader_opts' will always require the GIL to be acquired. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
    cdef _init(self, capnp.DynamicEnum other, object parent):
        self.thisptr = other
        self._parent = parent
        return self

    cpdef _as_str(self) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:1011:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        """
        self._check_write()
        _write_packed_message_to_fd(file.fileno(), self._parent)
        self._is_written = True

    cpdef to_bytes(_DynamicStructBuilder self) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:1303:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        cdef const char* ptr = <const char *>array.begin()
        cdef bytes ret = ptr[:8*array.size()]
        self._is_written = True
        return ret

    cpdef to_segments(_DynamicStructBuilder self) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:1320:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        self._check_write()
        cdef _MessageBuilder builder = self._parent
        segments = builder.get_segments_for_output()
        return segments

    cpdef _to_bytes_packed_helper(_DynamicStructBuilder self, word_count) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:1334:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        array = helpers.messageToPackedBytes(deref(builder.thisptr), word_count)
        cdef const char* ptr = <const char *>array.begin()
        cdef bytes ret = ptr[:array.size()]
        return ret

    cpdef to_bytes_packed(_DynamicStructBuilder self) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:1341:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        return self

    def __dealloc__(self):
        del self.thisptr

    cpdef _get(self, field) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:1611:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
    cdef _init(self, C_DynamicObject.Reader other, object parent):
        self.thisptr = other
        self._parent = parent
        return self

    cpdef as_struct(self, schema) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:1681:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        else:
            s = schema

        return _DynamicStructReader()._init(self.thisptr.getAs(s._thisptr()), self._parent)

    cpdef as_interface(self, schema) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:1690:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        else:
            s = schema

        return _DynamicCapabilityClient()._init(self.thisptr.getAsCapability(s.thisptr), self._parent)

    cpdef as_list(self, schema) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:1699:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        else:
            s = schema

        return _DynamicListReader()._init(self.thisptr.getAsList(s.thisptr), self._parent)

    cpdef as_text(self) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:1708:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        return self

    def __dealloc__(self):
        del self.thisptr

    cpdef as_struct(self, schema) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:1724:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        else:
            s = schema

        return _DynamicStructBuilder()._init(self.thisptr.getAs(s._thisptr()), self._parent)

    cpdef as_interface(self, schema) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:1733:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        else:
            s = schema

        return _DynamicCapabilityClient()._init(self.thisptr.getAsCapability(s.thisptr), self._parent)

    cpdef as_list(self, schema) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:1742:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        else:
            s = schema

        return _DynamicListBuilder()._init(self.thisptr.initAsList(s.thisptr, size), self._parent)

    cpdef as_text(self) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:1768:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
    cdef capnp.AsyncIoContext * thisptr

    def __init__(self):
        self._init()

    cdef _init(self) except +reraise_kj_exception:
         ^
------------------------------------------------------------

capnp/lib/capnp.pyx:1781:9: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        self.thisptr = new capnp.AsyncIoContext(capnp.setupAsyncIo())

    def __dealloc__(self):
        del self.thisptr #TODO:MEMORY: fix problems with Promises still being around

    cpdef _remove(self) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:1787:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...

    cdef _init(self, capnp.Timer * timer):
        self.thisptr = timer
        return self

    cpdef after_delay(self, time) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:1828:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        return self

    def __dealloc__(self):
        del self.thisptr

    cpdef wait(self) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:1969:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...

        self.is_consumed = True

        return ret

    cpdef then(self, func, error_func=None) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:1981:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        ret = _Promise()._init(self.thisptr.attach(capnp.makePyRefCounter(<PyObject *>args)), self)
        self.is_consumed = True

        return ret

    cpdef cancel(self, numParents=1) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2012:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        return self

    def __dealloc__(self):
        del self.thisptr

    cpdef wait(self) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2040:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...

        helpers.waitVoidPromise(self.thisptr, deref(self._event_loop.thisptr).waitScope)

        self.is_consumed = True

    cpdef then(self, func, error_func=None) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2049:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        cdef _Promise new_promise = _Promise()._init(
            helpers.then(deref(self.thisptr), <PyObject *>func, <PyObject *>error_func), self)
        return _Promise()._init(new_promise.thisptr.attach(
            capnp.makePyRefCounter(<PyObject *>func), capnp.makePyRefCounter(<PyObject *>error_func)), new_promise)

    cpdef as_pypromise(self) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2070:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        ret = _VoidPromise()._init(self.thisptr.attach(capnp.makePyRefCounter(<PyObject *>args)), self)
        self.is_consumed = True

        return ret

    cpdef cancel(self, numParents=1) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2086:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        return self

    def __dealloc__(self):
        del self.thisptr

    cpdef _wait(self) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2114:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        ret = self._wait()
        self.is_consumed = True

        return ret

    cpdef as_pypromise(self) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2146:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        if self.is_consumed:
            raise KjException(
                "Promise was already used in a consuming operation. You can no longer use this Promise object")
        return _Promise()._init(helpers.convert_to_pypromise(deref(self.thisptr)), self)

    cpdef then(self, func, error_func=None) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2152:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        cdef _Promise new_promise = _Promise()._init(
            helpers.then(deref(self.thisptr), <PyObject *>func, <PyObject *>error_func), self)
        return _Promise()._init(new_promise.thisptr.attach(
            capnp.makePyRefCounter(<PyObject *>func), capnp.makePyRefCounter(<PyObject *>error_func)), new_promise)

    cpdef _get(self, field) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2174:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        return list(set(self.schema.fieldnames + tuple(dir(self.__class__))))

    def to_dict(self, verbose=False, ordered=False):
        return _to_dict(self, verbose, ordered)

    cpdef cancel(self, numParents=1) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2205:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
    #     self.is_consumed = True

    #     return ret


cpdef join_promises(promises) except +reraise_kj_exception:
      ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2224:6: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...

        if kwargs is not None:
            for key, val in kwargs.items():
                _setDynamicField(<DynamicStruct_Builder>deref(request), key, val, self)

    cpdef _send_helper(self, name, word_count, args, kwargs) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2351:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...

        self._set_fields(request, name, args, kwargs)

        return _RemotePromise()._init(request.send(), self)

    cpdef _request_helper(self, name, firstSegmentWordSize, args, kwargs) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2360:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
                raise AttributeError('Method named %s not found' % name)
            return _partial(self._send, name)
        except KjException as e:
            raise e._to_python(), None, _sys.exc_info()[2]

    cpdef upcast(self, schema) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2389:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        else:
            s = schema

        return _DynamicCapabilityClient()._init(self.thisptr.upcast(s.thisptr), self._parent)

    cpdef cast_as(self, schema) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2398:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...

    cdef _init_pipe(self, _TwoWayPipe pipe, Side side, schema_cpp.ReaderOptions opts):
        self.thisptr = makeTwoPartyVatNetwork(deref(pipe._pipe.ends[0]), side, opts)
        return self

    cpdef on_disconnect(self) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2451:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
            # Set TCP_NODELAY on socket to disable Nagle's algorithm. This is not
            # neccessary, but it speeds things up.
            sock.setsockopt(_socket.IPPROTO_TCP, _socket.TCP_NODELAY, 1)
        return sock

    cpdef bootstrap(self) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2545:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        return sock

    cpdef bootstrap(self) except +reraise_kj_exception:
        return _CapabilityClient()._init(helpers.bootstrapHelper(deref(self.thisptr)), self)

    cpdef on_disconnect(self) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2548:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...

    def __dealloc__(self):
        del self.thisptr
        del self._task_set

    cpdef on_disconnect(self) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2671:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        if self.port_promise is None:
            raise KjException("You must pass a string as the socket parameter in __init__ to use this function")

        wait_forever()

    cpdef bootstrap(self) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2694:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
    cdef TwoWayPipe _pipe

    def __init__(self):
        self._init()

    cpdef _init(self) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2717:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
    cdef _EventLoop _event_loop

    def __init__(self, int fd):
        self._init(fd)

    cdef _init(self, int fd) except +reraise_kj_exception:
         ^
------------------------------------------------------------

capnp/lib/capnp.pyx:2729:9: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        self.parent = parent

    def __dealloc__(self):
        free(self.thisptr)

    cdef ArrayPtr[StringPtr] asArrayPtr(self) except +reraise_kj_exception:
         ^
------------------------------------------------------------

capnp/lib/capnp.pyx:3438:9: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        self._all_imports = []

    def __dealloc__(self):
        del self.thisptr

    cpdef _parse_disk_file(self, displayName, diskPath, imports) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:3457:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
            s = schema.schema
        else:
            s = schema
        return _DynamicStructBuilder()._init(self.thisptr.initRootDynamicStruct(s._thisptr()), self, True)

    cpdef get_root(self, schema) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:3625:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
            s = schema.schema
        else:
            s = schema
        return _DynamicStructBuilder()._init(self.thisptr.getRootDynamicStruct(s._thisptr()), self, True)

    cpdef get_root_as_any(self) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:3650:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
        :rtype: :class:`_DynamicObjectBuilder`
        :return: An AnyPointer that you can set fields in
        """
        return _DynamicObjectBuilder()._init(self.thisptr.getRootAnyPointer(), self)

    cpdef set_root(self, value) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:3660:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
            return self.get_root(value.schema)
        elif value_type is _DynamicStructReader:
            self.thisptr.setRootDynamicStruct((<_DynamicStructReader>value).thisptr)
            return self.get_root(value.schema)

    cpdef get_segments_for_output(self) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:3676:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
            ptr = <const char *> segment.begin()
            segment_bytes = ptr[:8*segment.size()]
            res.append(segment_bytes)
        return res

    cpdef new_orphan(self, schema) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:3688:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
    cdef schema_cpp.MessageReader * thisptr

    def __init__(self):
        raise NotImplementedError("This is an abstract base class")

    cpdef get_root(self, schema) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:3746:10: Only extern functions can throw C++ exceptions.

Error compiling Cython file:
------------------------------------------------------------
...
            s = schema.schema
        else:
            s = schema
        return _DynamicStructReader()._init(self.thisptr.getRootDynamicStruct(s._thisptr()), self)

    cpdef get_root_as_any(self) except +reraise_kj_exception:
          ^
------------------------------------------------------------

capnp/lib/capnp.pyx:3770:10: Only extern functions can throw C++ exceptions.
Compiling capnp/lib/capnp.pyx because it changed.
[1/1] Cythonizing capnp/lib/capnp.pyx
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
    main()
  File "/usr/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
    return hook(config_settings)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/build_meta.py", line 355, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=['wheel'])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/build_meta.py", line 325, in _get_build_requires
    self.run_setup()
  File "/usr/lib/python3.11/site-packages/setuptools/build_meta.py", line 507, in run_setup
    super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
  File "/usr/lib/python3.11/site-packages/setuptools/build_meta.py", line 341, in run_setup
    exec(code, locals())
  File "<string>", line 230, in <module>
  File "/usr/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1154, in cythonize
    cythonize_one(*args)
  File "/usr/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1321, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: capnp/lib/capnp.pyx

ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheel
==> ERROR: A failure occurred in build().
    Aborting...
==> ERROR: Build failed, check /var/lib/archbuild/extra-x86_64/chris-2/build

Additional info:

  • package version(s): 1.3.0-3
  • config and/or log files etc. see build log above
  • link to upstream bug report, if any: Didnt find any, maybe this has to be raised upstream

Steps to reproduce:

$ pkgctl repo clone python-pycapnp
$ pkgctl build python-pycapnp
Edited by Christian Heusel
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information