Can not compile firmware even dependencies are fulfilled.
Describe the Bug
After manually installed the osx-cross/avr/avr-gcc (which installs avr-gcc@9 at the time present) and arm-none-eabi-gcc, qmk doctor passed with just a warning about the avr-gcc version, I can run the build command on my M1 Macbook Pro. However, the build failed with just saying that
ERROR: Can not run "qmk" command!
Please run util/qmk_install.sh to install all the dependencies QMK requires.
make: *** [phoenix:default] Error 1
After digging into the code, I found that it fails at loading the dynamic library HIDAPI, which fails at the __init__.py of the hid site package. I checked my LD_LIBRARY_PATH and the libhidapi.dylib is right there.
This happens because the homebrew path changed on M1 machines into /opt/homebrew, thus the search failed. I know this may not be the issue of qmk_cli, but there are some improvements we can make:
- Improve the error message without just saying
ERROR: Can not run "qmk" command!, at least make the error clear with different log levels such as debug.
- Find a workaround for fixing this:
- Could be setting some environment variables to make the search of dynamic library successful? I am not sure about that because looks like it is using another process without passing environment variables.
- Document the workaround such as make a soft link pointing to the old search path.
Additional Context
I have tested by manually setting the load path to
hidapi = ctypes.cdll.LoadLibrary("/opt/homebrew/lib/libhidapi.dylib")
in /opt/homebrew/Cellar/qmk/0.0.52/libexec/lib/python3.9/site-packages/hid/__init__.py and I can compile the firmware without any problem.
Can not compile firmware even dependencies are fulfilled.
Describe the Bug
After manually installed the
osx-cross/avr/avr-gcc(which installs avr-gcc@9 at the time present) andarm-none-eabi-gcc,qmk doctorpassed with just a warning about theavr-gccversion, I can run the build command on my M1 Macbook Pro. However, the build failed with just saying thatAfter digging into the code, I found that it fails at loading the dynamic library HIDAPI, which fails at the
__init__.pyof the hid site package. I checked myLD_LIBRARY_PATHand thelibhidapi.dylibis right there.This happens because the homebrew path changed on M1 machines into
/opt/homebrew, thus the search failed. I know this may not be the issue ofqmk_cli, but there are some improvements we can make:ERROR: Can not run "qmk" command!, at least make the error clear with different log levels such as debug.Additional Context
I have tested by manually setting the load path to
in
/opt/homebrew/Cellar/qmk/0.0.52/libexec/lib/python3.9/site-packages/hid/__init__.pyand I can compile the firmware without any problem.