Cython compilation fail after separating code

26 views
Skip to first unread message

Alex

unread,
Nov 16, 2022, 11:43:40 PM11/16/22
to sage-support
This is essentially the same as my post on ask.sagemath.org, but after a while with no comments, I figured it would be okay to get more eyes on it here. I also asked on Zulip, but no dice there either.

It would be a bit redundant of me to copy+paste the entire post, so I will give a brief summary. To view more details, please refer to the linked post above. I can certainly provide anything else that is needed as well.

------------------------------------------------------------------------------------------------------------------------

In short, I had a huge file that had all of my code in it. In this file, I used the sage.data_structures.bitset and sage.data_structures.bitset_base modules. When I tried to compile this (aptly named) ginormous file, the compilation succeeded and I was able to instantiate all classes and call all functions in this file.

However, I tried doing some code cleanup and tried separating the code into logical modules. When doing so, I got some confusing compilation errors. Here is just the first, but again, please refer to the linked ask.sagemath.org post above for the entire output:

###############################################################
>sage --python3 setup.py build_ext --inplace

Compiling zeroforcing/metagraph/metagraph.pyx because it changed.
[1/1] Cythonizing zeroforcing/metagraph/metagraph.pyx

Error compiling Cython file:
------------------------------------------------------------
...
cdef mp_bitcnt_t extra

bits.size = size
if fused_bitset_t is bitset_t:
    bits.limbs = (size - 1) / (8 * LIMB_SIZE) + 1
                                                                         ^
------------------------------------------------------------
/mnt/e/projects/python/sage/src/sage/data_structures/bitset_base.pxd:177:50: Cannot assign type 'double' to 'mp_size_t'
###############################################################

I am by no means a Cython expert so I am quite stuck here. If anyone has ideas to remediate this, please let me know.

Thank you!
Reply all
Reply to author
Forward
0 new messages