Fixing Error after Compiling Arduino Sketch for WisCore RAK4631 on the Arduino IDE on Mac OS Catalina
If you’re the person who still uses macOS Catalina on an old MacBook and having a problem with Arduino IDE and RAK4631, then this post is for you.
As the title said, the error itself is not in the framework or the source code nor the compilation process, but it is during the creation of the firmware package after the source code is compiled. Here’s how the error looks like:
/Users/x/Library/Arduino15/packages/rakwireless/hardware/nrf52/1.0.1/tools/adafruit-nrfutil/macos/adafruit-nrfutil dfu genpkg --dev-type 0x0052 --sd-req 0x00B6 --application /var/folders/jv/5w8126955kb085pm6qjynw0r0000gn/T/arduino_build_534434/sketch_oct22b.ino.hex /var/folders/jv/5w8126955kb085pm6qjynw0r0000gn/T/arduino_build_534434/sketch_oct22b.ino.zip
[72668] Error loading Python lib '/var/folders/jv/5w8126955kb085pm6qjynw0r0000gn/T/_MEIyKZkrL/libpython3.8.dylib': dlopen: dlopen(/var/folders/jv/5w8126955kb085pm6qjynw0r0000gn/T/_MEIyKZkrL/libpython3.8.dylib, 10): Symbol not found: _preadv
Referenced from: /var/folders/jv/5w8126955kb085pm6qjynw0r0000gn/T/_MEIyKZkrL/libpython3.8.dylib (which was built for Mac OS X 11.1)
Expected in: /usr/lib/libSystem.B.dylib
in /var/folders/jv/5w8126955kb085pm6qjynw0r0000gn/T/_MEIyKZkrL/libpython3.8.dylib
exit status 255
/private/var/folders/jv/5w8126955kb085pm6qjynw0r0000gn/T/AppTranslocation/1B161C65-7921-47FD-8454-51262D67CB80/d/Arduino.app/Contents/Java/arduino-builder returned 255
Error compiling for board WisBlock RAK4631.
Well, that’s a lot of things to process. The one that matters is this part:
/Users/x/Library/Arduino15/packages/rakwireless/hardware/nrf52/1.0.1/tools/adafruit-nrfutil/macos/adafruit-nrfutil dfu genpkg --dev-type 0x0052 --sd-req 0x00B6 --application
and this part:
/var/folders/jv/5w8126955kb085pm6qjynw0r0000gn/T/_MEIyKZkrL/libpython3.8.dylib (which was built for Mac OS X 11.1)
The root cause is we’re trying to use a tool that is compiled for Mac OS X 11.1 on a Mac OS X 10.15.
The first thing that came to my mind is that I need to replace the adafruit-nrfutil tool. The way I do that is by installing the same tool using pip3 and replacing the executable with a symlink to the one installed by pip3.
# install adafruit-nrfutil using pip3pip3 install adafruit-nrfutil# go to the adafruit-nrfutil tool that comes with the RAK4631 board support packagecd /Users/x/Library/Arduino15/packages/rakwireless/hardware/nrf52/1.0.1/tools/adafruit-nrfutil/macos# backup the original adafruit-nrfutilmv adafruit-nrfutil adafruit-nrfutil.backup# create a symlink to the adafruit-nrfutil that is installed by pip3ln -s $(which adafruit-nrfutil)
Then, I re-compiled the source code and everything worked!