Matico-Platform / matico

An open source platform for building civic tech and geospatial apps
https://matico.app
46 stars 3 forks source link

m1 mac/arm docker environment setup #146

Open TyceHerrman opened 2 years ago

TyceHerrman commented 2 years ago

While using the docker-compose up environment setup, I receive the following warning (not sure if it's relevant) and error on my m1 mac:


=> ERROR [rust-builder 22/31] RUN wasm-pack build  --release --scope maticoapp

#0 384.1 warning: be sure to add `/root/.cache/.wasm-pack/.wasm-bindgen-cargo-install-0.2.81/bin` to your PATH to be able to run the installed binaries
#0 384.2 Error: no prebuilt wasm-opt binaries are available for this platform: Unrecognized target!
#0 384.2 To disable `wasm-opt`, add `wasm-opt = false` to your package metadata in your `Cargo.toml`.
------
failed to solve: executor failed running [/bin/sh -c wasm-pack build  --release --scope maticoapp]: exit code: 1

This seems to be related to this issue with wasm-pack: https://github.com/rustwasm/wasm-pack/issues/913.

It looks like it was addressed in wasm-pack v0.10.2: https://github.com/rustwasm/wasm-pack/releases/tag/v0.10.2

I'm not able to definitively determine which version of wasm-pack Matico is using, but it looks like in the Dockerfile that it's pulling the latest version from the wasm-pack github repo (I could be misinterpreting that though). If that's the case, not sure why this error would occur.

TyceHerrman commented 2 years ago

Tried disabling wasm-opt as suggested in the original error message, but was unsuccessful (don't really know how to use Cargo.toml). First tried adding wasm-opt = false, then tried adding [package.metadata.wasm-pack.profile.release] wasm-opt = false

to Cargo.toml in my local repo cloned from Matico repo (the second Cargo.toml edit based on https://rustwasm.github.io/docs/wasm-pack/cargo-toml-configuration.html).

Both attempts to no avail - same error for the first attempt, and the second attempt produced the following:

`=> ERROR [rust-builder 20/31] RUN cargo build --release

[rust-builder 20/31] RUN cargo build --release:

0 0.215 error: failed to parse manifest at /app/Cargo.toml

0 0.215

0 0.215 Caused by:

0 0.215 missing field name for key package


failed to solve: executor failed running [/bin/sh -c cargo build --release]: exit code: 101 `

stuartlynn commented 2 years ago

Hey @TyceHerrman Thanks for the bug report. I unfortunately don't have an M1 mac to reproduce this but @nofurtherinformation does. He is away on holiday for a little bit but when he gets back I can ask him to take a look at this.

We are revamping the way we do builds this week. There is a good chance the tweaks will fix this problem. Will ping you when it's merged to give it a go.

TyceHerrman commented 2 years ago

Tried this again today and am now getting the same issue as #148. Found this https://stackoverflow.com/questions/72061535/getting-this-error-message-while-installing-solana-error-failed-to-run-custom, which after completing the steps described, allowed me to run first step of individual components (cd matico_spec; cargo build; wasm-pack build --scope maticoapp), which had been failing previous to following the steps linked above. Still failed at (cd matico_charts; yarn build) - see #151.