1

I'm compiling a CPython Extension for an in-house library, and I'm pretty sure one of the functions that I'm using from the library is cursed.

When I run ld on the CPython Extension .so, it prints

./pyextension.so: undefined reference to `le_sig_cursed'

I don't believe it's an issue with the ordering of -l flags or it not finding the shared lib somehow, as the shared library contains hundreds of functions and they all work fine except this one.

Running nm --extern-only | grep le_sig_cursed on the shared lib shows that it does indeed exist.

0002ff70 T le_sig_cursed

Running that on the extension shows undefined (as expected).

U le_sig_cursed

Its prototype in the shared library's header looks like this

void le_sig_cursed(void);

There are other functions in the same header file with the exact same signature yet they link fine.

I'm using --no-undefined, and it doesn't complain at link time. Only when I run it or pass the extension into ld does it fail to resolve this one function.

I could understand if the library failed to load and none of the functions worked, but this one doesn't seem to have anything special about it yet it's the only one that fails. How do I diagnose this?

Dmiters
  • 2,011
  • 3
  • 23
  • 31

0 Answers0