gl-sergei / u2f-token

u2f token firmware for stm32f103 and efm32hg boards
GNU General Public License v3.0
339 stars 56 forks source link

undefined_symbol: hid_enumerate #18

Closed matmunn closed 5 years ago

matmunn commented 5 years ago

Trying to run ./certtool init is throwing the following errors:

Traceback (most recent call last):
  File "./certtool", line 139, in <module>
    main()
  File "./certtool", line 136, in main
    args.func(args)
  File "./certtool", line 102, in command_init
    e = easyhid.Enumeration()
  File "/home/server/Dev/venv/lib/python3.7/site-packages/easyhid/easyhid.py", line 358, in __init__
    self.device_list = _hid_enumerate(vid, pid)
  File "/home/server/Dev/venv/lib/python3.7/site-packages/easyhid/easyhid.py", line 420, in _hid_enumerate
    start = hidapi.hid_enumerate(vendor_id, product_id)
  File "/home/server/Dev/venv/lib/python3.7/site-packages/cffi/api.py", line 882, in __getattr__
    make_accessor(name)
  File "/home/server/Dev/venv/lib/python3.7/site-packages/cffi/api.py", line 878, in make_accessor
    accessors[name](name)
  File "/home/server/Dev/venv/lib/python3.7/site-packages/cffi/api.py", line 808, in accessor_function
    value = backendlib.load_function(BType, name)
AttributeError: function/symbol 'hid_enumerate' not found in library '<None>': python: undefined symbol: hid_enumerate
(venv) [server@server cert]$ sudo ./certtool init
Traceback (most recent call last):
  File "./certtool", line 139, in <module>
    main()
  File "./certtool", line 136, in main
    args.func(args)
  File "./certtool", line 102, in command_init
    e = easyhid.Enumeration()
  File "/home/server/Dev/venv/lib/python3.7/site-packages/easyhid/easyhid.py", line 358, in __init__
    self.device_list = _hid_enumerate(vid, pid)
  File "/home/server/Dev/venv/lib/python3.7/site-packages/easyhid/easyhid.py", line 420, in _hid_enumerate
    start = hidapi.hid_enumerate(vendor_id, product_id)
  File "/home/server/Dev/venv/lib/python3.7/site-packages/cffi/api.py", line 882, in __getattr__
    make_accessor(name)
  File "/home/server/Dev/venv/lib/python3.7/site-packages/cffi/api.py", line 878, in make_accessor
    accessors[name](name)
  File "/home/server/Dev/venv/lib/python3.7/site-packages/cffi/api.py", line 808, in accessor_function
    value = backendlib.load_function(BType, name)
AttributeError: function/symbol 'hid_enumerate' not found in library '<None>': python: undefined symbol: hid_enumerate

I've tried on both macOS 10.12.6 and a Linux system running kernel 4.20.6. As far as I can tell I've installed all the dependencies required, I've also tried Python 3.6.8 and 3.7.2

gl-sergei commented 5 years ago

It looks like easy_hid package cannot find hidapi library. This library is available as brew formula on OS X and as a package on debian/ubuntu.

matmunn commented 5 years ago

Yep, that was the problem. Seems to be all good now, thanks for that

V3ntus commented 1 year ago

I'm having this issue as well, although I've followed instructions with installing hidapi with brew. I've unlinked and relinked it as well. Using Python 3.10. Not sure where to start with troubleshooting, I assume it's still a path problem

Mac OS Catalina

  1. Installing through port didn't work
  2. Specifying DYLD_LIBRARY_PATH to point to the libhidapi.dylib directory before the command didn't work

Edit: just switched to Linux and it worked