I am trying to use a very simple zig function in my Nerves app, but it isn’t working.
First I get an error:
Error while loading project :zigler at /Users/herman/Projects/GratWiFi/nerves/firmware/deps/zigler
The firmware compilation continues, I can see zig building my file, but the it errors out:
10:30:00.943 [info] searching for zig in /Users/herman/Library/Caches/zigler/zig-macos-aarch64-0.13.0/zig
10:30:00.945 [info] zig expected (via cache) in /Users/herman/Library/Caches/zigler/zig-macos-aarch64-0.13.0/zig
10:30:00.945 [debug] running command: /Users/herman/Library/Caches/zigler/zig-macos-aarch64-0.13.0/zig fmt /var/folders/01/8bmlqt_922q399bvltpk4z7h0000gn/T/Elixir.GratWiFi.Zig.Datetime/build.zig
10:30:00.990 [debug] wrote build.zig to /var/folders/01/8bmlqt_922q399bvltpk4z7h0000gn/T/Elixir.GratWiFi.Zig.Datetime/build.zig
10:30:00.998 [info] searching for zig in /Users/herman/Library/Caches/zigler/zig-macos-aarch64-0.13.0/zig
10:30:00.998 [info] zig expected (via cache) in /Users/herman/Library/Caches/zigler/zig-macos-aarch64-0.13.0/zig
10:30:00.998 [debug] running command: /Users/herman/Library/Caches/zigler/zig-macos-aarch64-0.13.0/zig run -lc --dep analyte -Mmain=/Users/herman/Projects/GratWiFi/nerves/firmware/_build/gratwifi_rpi5_dev/lib/zigler/priv/beam/sema.zig -Merl_nif=/Users/herman/Projects/GratWiFi/nerves/firmware/_build/gratwifi_rpi5_dev/lib/zigler/priv/beam/stub_erl_nif.zig --dep erl_nif -Mbeam=/Users/herman/Projects/GratWiFi/nerves/firmware/_build/gratwifi_rpi5_dev/lib/zigler/priv/beam/beam.zig -Mattributes=/var/folders/01/8bmlqt_922q399bvltpk4z7h0000gn/T/Elixir.GratWiFi.Zig.Datetime/attributes.zig --dep erl_nif --dep beam --dep attributes -Manalyte=/Users/herman/Projects/GratWiFi/nerves/firmware/lib/gratwifi/zig/.Elixir.GratWiFi.Zig.Datetime.zig
10:30:01.797 [info] searching for zig in /Users/herman/Library/Caches/zigler/zig-macos-aarch64-0.13.0/zig
10:30:01.797 [info] zig expected (via cache) in /Users/herman/Library/Caches/zigler/zig-macos-aarch64-0.13.0/zig
10:30:01.797 [debug] running command: /Users/herman/Library/Caches/zigler/zig-macos-aarch64-0.13.0/zig fmt /var/folders/01/8bmlqt_922q399bvltpk4z7h0000gn/T/Elixir.GratWiFi.Zig.Datetime/module.zig
10:30:01.842 [debug] wrote module code to /var/folders/01/8bmlqt_922q399bvltpk4z7h0000gn/T/Elixir.GratWiFi.Zig.Datetime/module.zig
10:30:01.842 [info] searching for zig in /Users/herman/Library/Caches/zigler/zig-macos-aarch64-0.13.0/zig
10:30:01.842 [info] zig expected (via cache) in /Users/herman/Library/Caches/zigler/zig-macos-aarch64-0.13.0/zig
10:30:01.842 [debug] running command: /Users/herman/Library/Caches/zigler/zig-macos-aarch64-0.13.0/zig build -Doptimize=Debug --prefix /Users/herman/Projects/GratWiFi/nerves/firmware/_build/gratwifi_rpi5_dev/lib/zigler/priv
10:30:01.923 [debug] built library at /Users/herman/Projects/GratWiFi/nerves/firmware/_build/gratwifi_rpi5_dev/lib/zigler/priv/lib/Elixir.GratWiFi.Zig.Datetime.so
10:30:01.934 [error] loading module Elixir.GratWiFi.Zig.Datetime {:load_failed, ~c"Failed to load NIF library: 'dlopen(/Users/herman/Projects/GratWiFi/nerves/firmware/_build/gratwifi_rpi5_dev/lib/zigler/priv/lib/Elixir.GratWiFi.Zig.Datetime.so, 0x0002): tried: '/Users/herman/Projects/GratWiFi/nerves/firmware/_build/gratwifi_rpi5_dev/lib/zigler/priv/lib/Elixir.GratWiFi.Zig.Datetime.so' (not a mach-o file), '/System/Volumes/Preboot/Cryptexes/OS/Users/herman/Projects/GratWiFi/nerves/firmware/_build/gratwifi_rpi5_dev/lib/zigler/priv/lib/Elixir.GratWiFi.Zig.Datetime.so' (no such file), '/Users/herman/Projects/GratWiFi/nerves/firmware/_build/gratwifi_rpi5_dev/lib/zigler/priv/lib/Elixir.GratWiFi.Zig.Datetime.so' (not a mach-o file), '/Users/herman/Projects/GratWiFi/nerves/firmware/deps/zigler/priv/lib/Elixir.GratWiFi.Zig.Datetime.so' (not a mach-o file), '/System/Volumes/Preboot/Cryptexes/OS/Users/herman/Projects/GratWiFi/nerves/firmware/deps/zigler/priv/lib/Elixir.GratWiFi.Zig.Datetime.so' (no such file), '/Users/herman/Projects/GratWiFi/nerves/firmware/deps/zigler/priv/lib/Elixir.GratWiFi.Zig.Datetime.so' (not a mach-o file)'"}
The firmware gets build, but when you deploy it, it goes into a reboot-loop because it cannot find the nif file.
Thinking I somehow missed something, I downloaded the nerves-examples
repo, and tried the hello-zig
example, but this behaves the same.
I am on a Mac Mini M4, if that makes a difference.