我正在为我的AVR板使用图形用户界面的PyQt,我想在我的应用程序中实现dfu-programmer引导加载程序,这样我就可以在里面使用它了。我已经使用以下命令生成了libdfu.so (并复制到我的/usr/lib中):
gcc -shared -Wl,-soname,libdfu -o libdfu.so -fPIC arguments.o main.o commands.o dfu.o atmel.o util.o intel_hex.o 所有的目标文件都来自dfu-programmer源代码,我真的不知道这样做是不是一个好方法。我试着在这里用testlib.py加载库:
import ctypes
testlib = ctypes.CDLL('libdfu.so')
testlib.usage()它给了我这个错误:
$ python teslib.py
Traceback (most recent call last):
File "teslib.py", line 3, in <module>
testlib = ctypes.CDLL('libdfu.so')
File "/usr/lib/python2.6/ctypes/__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /usr/lib/libdfu.so: undefined symbol: usb_init我还尝试在库之前导入libusb-1.0.so,因为bootloader使用它,但它不起作用(同样的错误)……
有什么解决方案吗?谢谢。
发布于 2011-03-25 01:56:17
我找到了问题所在,这是一个与libusb.so相关的问题。为此,我设置了LDFLAGS和CPPFLAGS (分别位于/usr/lib和/usr/include目录),并在前面的命令中添加了-libusb选项:
gcc -shared -Wl,-soname,dfulib.so.1 -o dfulib.so.1.0.1 arguments.o commands.o atmel.o dfu.o intel_hex.o main.o util.o -lusb -ldl 谢谢。:) (希望能再次帮助别人)
https://stackoverflow.com/questions/5418337
复制相似问题