Skip to content
Advertisement

Undefined symbol, despite being defined in linked library (CUDA 10.1)

I have a library my_lib.so which links to several CUDA 10.1 libraries, including libnppicc.so.

Running ldd on the library outputs the following – all dependencies are resolved correctly:

JavaScript

Next, I have a python bindings library which correctly links against this shared library lib_tf.so. When I try to run a simple python program which imports the python module, I get the following error:

JavaScript

So we are getting an undefined symbol error to nppiGammaInv_8u_C3IR. The strange thing is that this symbol is defined in libnppicc.so which is being linked.

We can confirm this is the case by running nm:

JavaScript

Why am I getting this error when the symbol has a definition? What’s stranger is that when I run the same test script & libs on other machines with CUDA 10.1 installed, it works fine. So something is wrong with this specific machine, but I can’t figure out what. I also have cuda 11.1 installed on this machine, not sure if that’s relevant.

Edit

Someone suggested I also run ldd on the python bindings library, so here it is:

JavaScript

Advertisement

Answer

You are importing a Python module, which depends on my_python_bindings_lib.cpython-37m-x86_64-linux-gnu.so.

That library:

  1. has unresolved symbol nppiGammaInv_8u_C3IR (defined in libnppicc), and
  2. does not depend on libnppicc.so.10 where the symbol is defined.

It is exceedingly likely that my_python_bindings_lib should depend on libnppicc (since it uses a symbol defined there), and that adding that dependency will fix your import problem.

Advertisement