I'm trying to build and distribute an abandoned package. I made a fork. Building it with cibuildwheel instead on each machine will make thinks much more easier, but it's giving me a lot of issues. I successfully ran the building procedure in cibuildwheel of py3{7,8,9,10}-manylinux_x86_64
(manulinux2014
which has Glibc 2.17) and the test are running successfully in the docker image for all the python versions compiled. It also runs well on the machine I built it, outside the docker, which is Ubuntu 18.04 python 3.8. But when I install it in another machine (Fedora 36 Python 3.10 GLibc 2.36), one of the compiled binaries of the pyx extensions gives me this error:
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_glove.py:4: in <module>
from glove import Corpus, Glove
../venv-glove/lib64/python3.10/site-packages/glove/__init__.py:2: in <module>
from .glove import Glove
../venv-glove/lib64/python3.10/site-packages/glove/glove.py:16: in <module>
from .glove_cython import fit_vectors, transform_paragraph
E ImportError: /home/user/venv-glove/lib64/python3.10/site-packages/glove/glove_cython.cpython-310-x86_64-linux-gnu.so: undefined symbol: __pow_finite
At the Fedora machine, the local build of the wheel with python setup.py wheel
works well.
After some search here and here, I found that it is related with the -ffast-math
option. Disabling it avoids the issue but the performance is dropping a lot. Also adding -fno-builtin
does not solve the issue.
Then I asked at cibuildwheel issue tracker here and they helped me to make it run defining the operator in the .c generated by Cython (see here). After compiling with that and without specific -march
parameter I'm able to run the code but it ends in an infinite loop. The function that runs indefinitely is this one.
It seems that I'm facing the deprecation problem building with Glibc under 2.31 and using it in a system that has a higher version. I wonder if anyone here knows how to properly define the operators or if it's possible to compile the extensions without having to remove -ffast-math
.
I also tried to debug the test that is failing with gdb -ex r --args $(pyenv which python) -m pytest .
but the debugger can't catch the cython packages:
ImportError while importing test module '/home/user/work/glove/glove-python/tests/test_corpus.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_corpus.py:9: in <module>
from glove import Corpus
glove/__init__.py:1: in <module>
from .corpus import Corpus
glove/corpus.py:10: in <module>
from .corpus_cython import construct_cooccurrence_matrix
E ModuleNotFoundError: No module named 'glove.corpus_cython'