We have more and more customers who use our products on Macs equipped with Apple silicon (ARM) processors. This week, we are going to look at the implications that these new systems have on our products.
The first thing we need to specify is that this change in processor has strictly no impact on the USB communication between the Mac and our modules. Our modules use the USB HID protocol and are thus natively managed by the OS and you don't need to modify any driver. In the same way, YoctoHubs use standard network protocols and are not impacted by these new processors.
This change of processor impacts only the applications which are executed on the machine. Let's have a look at the applications using our modules.
The VirtualHub is fully functional. Since version 42982, it is even compiled into Universal binaries (UB) which allows us to include an optimized version for Apple processors.
The command line library
The command line library is fully functional, although it is not compiled into Universal binaries (UB). Binaries which are included in the zip file are binaries designed for Intel processors, but macOS runs these binaries with Roseta 2 and it works also on the Apple processor.
We made this choice because the UB compilation generates executables files which are significatively larger and the performance gain is minimal. In the opposite to the VirtualHub, command line tools are executables which have a very short execution time and spend most of their time waiting for USB packets.
If you want to use a version optimized for Apple silicon, the sources of the command line library are available on GitHub and on our web site. You can therefore recompile them with the options that you want.
C++ and Objective-C libraries
All the versions of these two libraries are fully compatible with all the processors. As these libraries are compiled at the same time as your application, they will automatically work with your application. By default, Xcode generates UB binaries, so compatible with all the processors.
Python and Java libraries
For these libraries, it's slightly more complex. These libraries are composed of a high level part written in Python or Java, and of a dynamic library (libyapi.dylib) which is precompiled. The high level doesn't raise any issue, but the dynamic library must be compatible with the Python or Java virtual machine.
Since version v1.10.49416, these libraries include a Universal binaries (UB) version of libyapi.dylib. Since this version, our libraries are thus compatible with Intel and Apple processors.
The Python version installed on Macs with Apple processors is compiled with the Hardened Runtime feature. This feature blocks the loading of dynamic libraries which have not been authorized.
Therefore, the first time that you use our Python library, the code is going to crash with the following error message:
code signature in <XXXXXXXXXXXXXX>; '../Sources/cdll/libyapi.dylib' not valid for use in process: library load disallowed by system policy
To authorized the libyapi.dylib dynamic library, you must open the system preferences and access the Security and Privacy panel. In the General tab, you see a note indicating that libyapi.dylib is blocked because it doesn't come from an authorized developer. You must click on the Allow anyway button.
The first time, you must authorize the libyapi.dylib dynamic library
When you have performed this operation, the virtual machine accepts the dynamic library.
Alternative solutions for older Yoctopuce libraries
Note that if you have an existing project which must run on Apple silicon, but that you don't want to update our library, you can work around the issue by installing an Intel version of the VM.
For example, you can use our old Python libraries on a Apple Mac by installing an Intel version of Python 2.7. When executing, macOS uses Roseta 2 to execute Python and our library.
Despite the change in processor on the newest Macs, it's still possible to use Yoctopuce modules. The only issue of the new machines is that Apple persists in removing USB-A ports. For these machines, you must therefore use a USB hub to be able to connect a standard USB device, such as a USB key, a mouse, or a Yoctopuce module...