When I run pio build with a target that has upload_command = dfu-util ... on a Mac system with an M1 / ARM64 architecture, the x86_64 version of dfu-prefix, dfu-suffix, and dfu-util are installed, so the final step of the build fails…
PlatformIO relies on the Rosetta x86/64 translation layer to execute these binaries. There are no native-compiled binaries for Mac in the PlatformIO registry, just x86 ones retagged as ARM.
The time is nigh to start including a Universal binary with correct linkage to libusb-1.0.0.dylib because the x86_64 build of dfu-suffix will not load that arm64 library – which in any case is not even included with macOS by default. You must install it from something like Homebrew or MacPorts. But, the default for M1 is the arm64-only build of the library.
For the build of our project, we can’t ask users to install a package manager and then use it to install the non-default version of libusb-1.0.0.dylib. Nor can we really ask the user to authorize us to install it. So it would just be best and proper to have a universal build of dfu-suffix (and the others) that can run without any other system additions.
See my comment on the relevant GitHub issue. It’s the right version, just not a universal binary. I built the dfu utilities as arm64 with ./configure && make and they work great, with no complaints about being unable to find libusb. But the versions being distributed with PlatformIO are still just x86_64 builds that cannot link to dynamic libusb on the M1 / M2 architecture. I can build x86_64 versions as well, join them all together into universal binaries, and submit them to the PIO project, if needed.
But the lib/ directory next to it also contains x86_64 files, so this may need a little more work to get PIO’s own version working properly on Apple Silicon.
With the October 29, 2024 version we should finally have a linked and complete dfu-util. Use the following in your environments to get the latest patched 1.11.