0

I have looked at this question but it doesn't seem to help my case.

I have a C++ library that I am wrapping parts of using SWIG (unfortunately swig 2.0). This library performs some socket communications with a remote server and I need to make use of it from Python. I am finally able to compile and link a .so file but during my testing, when importing the generated module, I get the following:

...
    _mod = imp.load_module('_YBB', fp, pathname, description)
ImportError: ./_YBB.so: undefined symbol: _Z11IPV4Gatewayhhhh

This undefined symbol equates to:

IPV4Gateway(unsigned char, unsigned char, unsigned char, unsigned char)

This is frustrating as I don't have a call to this function anywhere in the wrapped library. So it must be in the underlying socket library that I am calling.

Does anyone know what I have to do to clear up this undefined symbol?

melston
  • 2,198
  • 22
  • 39
  • Check whether *.c file related to missing function is compiled when you are building the library. To verify .so containing given symbol you can use techniques described in https://stackoverflow.com/questions/34732/how-do-i-list-the-symbols-in-a-so-file – amald Sep 17 '19 at 01:19
  • @amald, the problem is that the missing function isn't in the code I am wrapping at all. It must be required by the underlying socket library somewhere. – melston Sep 17 '19 at 01:33

1 Answers1

0

Ah, never mind. It turns out that it was declared in a header file but never implemented. So swig (correctly) wrote a wrapper for it but was never able to link against the underlying implementation (which didn't exist).

melston
  • 2,198
  • 22
  • 39