Error with the packages 'tool-dfuutil/bin/dfu-suffix'

Hello !
I have a problem when i’m building my project which was working few weeks ago.

Here the configuration loaded :

Processing l0 (platform: ststm32; board: l0; framework: stm32cube)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/l0.html
PLATFORM: ST STM32 (15.4.1) > L0
HARDWARE: STM32F072VBT6 48MHz, 16KB RAM, 128KB Flash
DEBUG: Current (stlink) External (stlink)
PACKAGES: 
 - framework-stm32cubef0 @ 1.11.3 
 - tool-dfuutil @ 1.11.0 
 - tool-ldscripts-ststm32 @ 0.2.0 
 - toolchain-gccarmnoneeabi @ 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ off, Compatibility ~ soft

Here is the error i get :

Building .pio/build/l0/firmware.bin
Adding dfu suffix to firmware.bin
dyld[2872]: Library not loaded: '/usr/local/opt/libusb/lib/libusb-1.0.0.dylib'
  Referenced from: '/Users/benjamin/.platformio/packages/tool-dfuutil/bin/dfu-suffix'
  Reason: tried: '/usr/local/opt/libusb/lib/libusb-1.0.0.dylib' (no such file), '/usr/local/lib/libusb-1.0.0.dylib' (no such file), '/usr/lib/libusb-1.0.0.dylib' (no such file)
*** [.pio/build/l0/firmware.bin] Error -6

I tried to brew uninstall libusb then brew install libusb again. I tried also to clean my local packages under : ~/Users/benjamin/.platformio/packages to force PlatformIO to download latest version.
But still the same error; have you any idea how to fix this ?

Regards,
Benjamin

Supposedly, this issue has been fixed:

But I have also experienced last week that it still doesn’t work. Maybe it hasn’t been released yet? Or does it have a different underlying cause?

Are you maybe running into compatibility problems with an M1 ARM Mac? The dfuutil binary is compiled for x64 so you need the x64 libusb, similiar to e.g. M1 OpenOCD Upload Issues · Issue #703 · earlephilhower/arduino-pico · GitHub

@ivankravets linked this issue to Updated used dfu-util to latest version available by jhaand · Pull Request #630 · platformio/platform-ststm32 · GitHub which is already merged. So yes maybe a different cause ?

Yes it’s maybe a compatibility issue since i’m using a M1 ARM Mac, but i’m not sure what to do even after reading the GitHub issue :sweat_smile:

The command arch -x86_64 brew install libhidapi lead me to a “Not found Formula” and suggest ‘libhid’, which Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)! … The suggestion is to reinstall homebrew…

There is no native tool-dfuutil@1.11.0 for macOS ARM. Could you try to add into the platformio.ini

[env:...]
platform_packages = 
    tool-dfuutil@~1.9

Does it work?

You’re right @ivankravets, the build works with this config !

@benjamin_luos could you compile the native macOS ARM tool-dfutil? dfu-util - Browse Files at SourceForge.net

Later, please package it using tar or tar.gz and upload it somewhere. We will update packages in our registry.

cc @jhaand

1 Like