Build issues on M2 Mac

Hi @brocaar and everyone,
I tried building the binaries on an m2 mac. Tried nix-shell as well as make docker-devshell. I was successful at building the UI then successful at ‘make dev-dependencies’ from the devshell. I’m not able to make debug-amd64, etc however. Tried this from both nix-shell and devshell and always get the following error. I was able to add jq by starting ‘nix-shell -p jq’, however not recognizing ‘cross’ is something I haven’t been able to resolve after searching for possible solutions.

sh: line 1: jq: command not found
cross build --target x86_64-unknown-linux-musl
make: cross: No such file or directory
make: *** [Makefile:6: debug-amd64] Error 127

I wonder if you’d have a clue as to how to proceed.
Thanks, Peter

I actually got further than the previous post.
I realized that jq was just for parsing the version from json and I could just enter the result.
The cross command I was able to fix by specifying the full path to it.
Since on the mac natively I always get an error ld: library not found for -liconv which I have not been able to fix I switched to Ubuntu in UTM on the mac.
There I got the error
ERROR: failed to solve: no match for platform in manifest
After reading further I added the platform specification in the Dockerfile
FROM --platform=“linux/amd64”
Now the error is that it probably is unable to run the image.

Again, any thoughts please.

So I did clear all of the previous issues on an Intel Win 11 with Ubuntu in VMWare.
Now the log looks like this with an error at the end

[nix-shell:~/chirpstack/chirpstack]$ make debug-amd64
cross build --target x86_64-unknown-linux-musl
[+] Building 0.3s (10/10) FINISHED
=> [internal] load build definition from Dockerfile.x86_64-unknown-linux-musl 0.0s
=> => transferring dockerfile: 58B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 34B 0.0s
=> [internal] load metadata for Package x86_64-unknown-linux-musl · GitHub 0.2s
=> [1/6] FROM 0.0s
=> CACHED [2/6] RUN apt-get update && apt-get --assume-yes install protobuf-compil 0.0s
=> CACHED [3/6] RUN echo “Building OpenSSL” && cd /tmp && curl -fLO "https://www.o 0.0s
=> CACHED [4/6] RUN echo “Building zlib” && cd /tmp && curl -fLO " 0.0s
=> CACHED [5/6] RUN echo “Building libpq” && cd /tmp && curl -fLO "https://ftp.pos 0.0s
=> CACHED [6/6] RUN objcopy --redefine-sym unicode_to_utf8=unicode_to_utf8_rename /usr/loc 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:b31b3f8ef0f169148023bcae0437ae669f41b3cba0d25cd9a1508c62414a645 0.0s
=> => naming to Docker 0.0s
sh: 1: cargo: not found
make: *** [Makefile:6: debug-amd64] Error 127

I do not have experience on compiling ChirpStack under a non Linux environment. However, I noticed that there is an open issue with regards to M2 support: Support running natively on aarch64 / arm64 hosts / Mac M1/M2 · Issue #751 · cross-rs/cross · GitHub.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.