Skip to content Skip to sidebar Skip to footer

Cython Build Resulting In Undefined Symbol

I've got a c++ program I'm trying to wrap/convert to Cython. It uses a particular library that for some reason, will not result in a working module for importing. There is a workin

Solution 1:

You should use nm -C, to unmangle your symbols. It also looks like you are mixing static and shared libraries which is generally not a good idea. Also, gcc's linker is a one pass linker which means the order of library flags matters. You want to list the libraries in reverse dependency order. In other words, if a depends on b, then b must appear before a in the linker flags.

Solution 2:

Well I can't try to recreate your setup and then work out and test a solution on my setup since I don't have your source, but it seems to me that when you recompiled libnmf with fpic, it was recompiled with dynamic linking, while before it used to be statically linked.

If my guess is correct, then you can try either:

  1. compiling libnmf again with -fPIC , AND -static.
  2. changing your setup.py - add "elemental" to the libraries list - this will make the linker fetch that lib as well.

You should note that approach #1 is usually considered less desirable, but as I said it could be that it was originally compiled that way anyways. #2, however, could take more work because if there are other libs that are required, you will have to find and add them as well.

Post a Comment for "Cython Build Resulting In Undefined Symbol"