Skip to content
This repository has been archived by the owner on Apr 16, 2023. It is now read-only.

Error when trying to flash on a Mac #44

Open
PaulDokken opened this issue May 30, 2022 · 3 comments
Open

Error when trying to flash on a Mac #44

PaulDokken opened this issue May 30, 2022 · 3 comments

Comments

@PaulDokken
Copy link

I have an M1 mac and am trying to run the flasher and the companion. When i run the flasher i got the following error.
image

Also the companion does not recognize my radio.

@jeremyhu
Copy link

jeremyhu commented Jul 22, 2022

This is a pretty serious issue that makes the flasher completely unusable on macOS for most users.

The issue here is that the dfu-util executable has a link against a library that it depends on (libusb-1.0.0.dylib). At build time, the library that was linked against contained a dylib id of /usr/local/opt/libusb/lib/libusb-1.0.0.dylib which is where the dynamic linker / loader (dyld) looks for it on the system at runtime.

This library is located within the edgetx-flasher.app app bundle. The build system should be using @loader_path relative links to resolve these. There's also no reason to distribute these win64 and linux binaries as part of the darwin flasher app, but that's not the core problem here.

Also note that the release contains two separate copies of the dylib. Presumably these were at one point hard or symlinks. There's also a static archive version and a libtool .la which are useless to end users:

$ ls -al
total 980
drwxr-xr-x 11 jeremy admin    352 Apr 18 08:02 .
drwxr-xr-x  5 jeremy admin    160 Apr 18 08:02 ..
-rwxr-xr-x  1 jeremy admin  19612 Apr 18 07:59 dfu-prefix
-rwxr-xr-x  1 jeremy admin  19604 Apr 18 07:59 dfu-suffix
-rwxr-xr-x  1 jeremy admin  57756 Apr 18 07:59 dfu-util
-rwxr-xr-x  1 jeremy admin 124856 Apr 18 07:59 libusb-1.0.0.dylib
-rw-r--r--  1 jeremy admin 405136 Apr 18 07:59 libusb-1.0.a
-rwxr-xr-x  1 jeremy admin 124856 Apr 18 07:59 libusb-1.0.dylib
-rwxr-xr-x  1 jeremy admin    975 Apr 18 07:59 libusb-1.0.la
-rwxr-xr-x  1 jeremy admin 206188 Apr 18 07:59 lsusb
-rwxr-xr-x  1 jeremy admin  28368 Apr 18 07:59 usbhid-dump

Ok... so users can fix things themselves while waiting for a new release by using install_name_tool to fixup the linkage:

cd /Applications/edgetx-flasher.app/Contents/src/support/dfu-util/darwin 
rm libusb-1.0.a libusb-1.0.la libusb-1.0.dylib
install_name_tool -id @loader_path/libusb-1.0.0.dylib libusb-1.0.0.dylib
install_name_tool -change /Users/tormod/dfu-util/libusb-git/../build/lib/libusb-1.0.0.dylib @loader_path/libusb-1.0.0.dylib lsusb
install_name_tool -change /Users/tormod/dfu-util/libusb-git/../build/lib/libusb-1.0.0.dylib @loader_path/libusb-1.0.0.dylib usbhid-dump 
install_name_tool -change /usr/local/opt/libusb/lib/libusb-1.0.0.dylib @loader_path/libusb-1.0.0.dylib dfu-prefix
install_name_tool -change /usr/local/opt/libusb/lib/libusb-1.0.0.dylib @loader_path/libusb-1.0.0.dylib dfu-suffix 
install_name_tool -change /usr/local/opt/libusb/lib/libusb-1.0.0.dylib @loader_path/libusb-1.0.0.dylib dfu-util 

@richard-scott
Copy link

I've had to run this to get it to work:

brew install dfu-util

@bigtwin
Copy link

bigtwin commented Jul 28, 2022

I have a highly similar symptom while trying to use edgetx-flasher on my Intel-based Mac OSX Mojave to work with my Taranis X9 Lite. Unfortunately I neither understand @jeremyhu analysis nor what is ment by @richard-scott contribution. I cannot judge whether this is related at all:

Waiting for dfu-util...dyld: Library not loaded: /usr/local/opt/libusb/lib/libusb-1.0.0.dylib
Referenced from: /Applications/edgetx-flasher.app/Contents/src/support/dfu-util/darwin/dfu-util
Reason: image not found

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants