Python ctypes loading error: undefined symbol -


i trying load shared library compiled c source python ctypes. shared library (named "libsub.so" below) used libusb libraries. "make" did:

gcc -c -o2 -wall -werror -g -i../src -i../boot/vnd/fw -i. -fpic -dlibusb_1_0 -i/usr/include/libusb-1.0 -o libsub.o libsub.c gcc -shared -wl,-soname,libsub.so -o libsub.so libsub.o 

and tried python after that:

import ctypes h = ctypes.cdll.loadlibrary('./libsub.so') 

however, got error this

oserror: ./libsub.so: undefined symbol: libusb_open

i found "libusb_open" function of libusb header in "/usr/include/libusb-1.0/libusb.h", included in source of library "libsub.c".

a few posts in stackexchange talked such "undefined symbol" errors when loading c++ shared libraries ctypes, , problems solved changing compiler gcc g++. however, source had written in c --- might different situation (actually tried g++ compile source got bunch of errors). can point out missing here? thanks!

i believe should require, in second line, libsub.so linked pointer original libusb.so:

gcc -shared -wl,-soname,libsub.so -lusb -o libsub.so libsub.o                                   ^^^^^ 

maybe need specify path libusb.so -l/path.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -