Reputation: 309
We are using swig to add python bindings to out c++ library. I have created the .i file and compile the swig generated output into the library.
However when trying and use our library from within Python, the following error occurs:
ImportError: /home/satpal/src/alpha/USBDrDaq/examples/libUSBDrDAQ.so: undefined symbol: libusb_clear_halt
As you can see the library uses LibUSB. the .i file has an include for libusb.h, this doesn't seem to be enough.
Is Python going to need bindings for libUSB aswell?
Upvotes: 2
Views: 836
Reputation: 52739
You need to link libUSB into the shared library that you are producing. That is, the command line that builds your shared library should be something like this:
gcc -shared example.o example_wrap.o -o _example.so -lusb
Note the -lusb
at the end.
Upvotes: 3