pythongcccython

Cython Multiple Definitions of Function


I am using Cython to generate multiple C files from multiple Python files and then compile them using GCC. Using Python3.10 on Ubuntu 22.04 my tool flow works fine. When I switch to Kubuntu 20.04 with Python3.8, the compilation of the generated C files fails.

multiple definitions of '__pyx_CommonTypesMetaclass_get_module'

Does someone know what the issue might be here? I used Cython on the Kubuntu machine to regenerate the C files.

Here are the Cython package versions used on the two machines:


Solution

  • This is a bug with Cython 3.1.2. Essentially the word static was missing.

    Bug report and bug fix

    It'll be fixed in the next release, but until that's out you want to pin Cython to 3.1.1.


    (Side note: In order to see this, you will be doing something slightly odd involving combining multiple C files into a library. This is the sort of detail it might have been worth mentioning in the question)