Tool-dfuutil for macOS M1 / ARM_64

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…

Tool Manager: Installing platformio/tool-dfuutil @ ~1.9.190708
. . .
> file ~/.platformio/packages/tool-dfuutil/bin/dfu-util
.../bin/dfu-util: Mach-O 64-bit executable x86_64

Is there some hint I can give to the Tool Manager to make it download the ARM64 version of these tools?

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.

CC @ivankravets – maybe this was already solved with the new package versions introduced in Updated used dfu-util to latest version available (#630) · platformio/platform-ststm32@9ce784b · GitHub?

1 Like

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.

Could you share somewhere tar.gzipped packages? We will re-publish them in the registry. Thanks!