Skip to content Skip to sidebar Skip to footer

Python, ImportError: Undefined Symbol: G_utf8_skip

There are like tens of similar questions on StackOverflow, but after several hours of lurking I finally gave up. So I'm trying to write a C extension for Python. Let's call it myli

Solution 1:

Well, actually I found the solution. A had to add library links to extra_link_args:

extra_link_args=["-I", "/usr/include/glib-2.0", "-l", "glib-2.0", "-I", "/usr/lib/x86_64-linux-gnu/glib-2.0/include"]

which appends them to the end of compile string.


Solution 2:

I found adding -fPIC to "extra_compile_args" in the Extension constructor also helped. Like so:

my_module = Extension('modulename',
                      ...
                      extra_compile_args=["-fPIC"]
                      sources = ['mycode.c'])

Post a Comment for "Python, ImportError: Undefined Symbol: G_utf8_skip"