Motoko Build Errors
I'm having trouble getting the Motoko benchmarks to run locally, likely because there are additional setup steps necessary to get motoko to build.
I have followed the steps in Reproduce Performance Report. I've installed the prerequisites, copied the networks.json into ~/.config/dfx, set the MOC_VERSION to 0.10.0, and run make.
Specifically, when on the main branch if I run dfx start --clean in one terminal, and then in another one cd into /dapps and run make (with the MOC_VERSION set) I get the following error:
set -e; cd motoko; envsubst < mops.template.toml > mops.toml; mops install; dfx canister create --all; dfx ledger fabricate-cycles --t 100 --canister $(dfx identity get-wallet); dfx build; rm mops.toml; echo "Optimize with ic-wasm"; for f in .dfx/local/canisters//*/*.wasm; do ic-wasm -o $f $f optimize O3 --keep-name-section; done; cd ..
(node:559214) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
All packages installed
Creating a wallet canister on the local network.
The wallet canister on the "local" network for user "default" is "bnz7o-iuaaa-aaaaa-qaaaa-cai"
Creating canister basic_dao...
basic_dao canister created with canister id: bkyz2-fmaaa-aaaaa-qaaaq-cai
Creating canister dip721_nft...
dip721_nft canister created with canister id: bd3sg-teaaa-aaaaa-qaaba-cai
Fabricating 100000000000000 cycles onto bnz7o-iuaaa-aaaaa-qaaaa-cai
Fabricated 100000000000000 cycles, updated balance: 193_800_000_000_000 cycles
Building canisters...
Error: Failed while trying to build all canisters.
Caused by: Failed while trying to build all canisters.
The build step failed for canister 'bd3sg-teaaa-aaaaa-qaaba-cai' (dip721_nft) with an embedded error: Failed to build Motoko canister 'dip721_nft'.: Failed to compile Motoko.: Failed to run 'moc'.: The command '"/home/dan/.cache/dfinity/versions/0.15.1/moc" "/home/dan/repos/demergent-labs/canister-profiling/dapps/motoko/dip721-nft/Main.mo" "-o" "/home/dan/repos/demergent-labs/canister-profiling/dapps/motoko/.dfx/local/canisters/dip721_nft/dip721_nft.wasm" "-c" "--debug" "--idl" "--stable-types" "--public-metadata" "candid:service" "--public-metadata" "candid:args" "--actor-idl" "/home/dan/repos/demergent-labs/canister-profiling/dapps/motoko/.dfx/local/canisters/idl/" "--actor-alias" "basic_dao" "bkyz2-fmaaa-aaaaa-qaaaq-cai" "--actor-alias" "dip721_nft" "bd3sg-teaaa-aaaaa-qaaba-cai" "--package" "base" ".mops/_github/[email protected]/src"' failed with exit status 'exit status: 1'.
Stdout:
Stderr:
.mops/_github/[email protected]/src/Region.mo:44.35-44.41: type error [M0030], type field Region does not exist in type
module {
type Any = Any;
type Blob = Blob;
type Bool = Bool;
type Char = Char;
type Error = Error;
type Float = Float;
type Int = Int;
type Int16 = Int16;
type Int32 = Int32;
type Int64 = Int64;
type Int8 = Int8;
type Nat = Nat;
type Nat16 = Nat16;
type Nat32 = Nat32;
type Nat64 = Nat64;
type Nat8 = Nat8;
type None = None;
type Null = Null;
type Principal = Principal;
type Text = Text
}
make: *** [Makefile:7: motoko] Error 255
This is happening for more than just the dapps example though.
Here are the versions of my installed prerequisites:
- dfx 0.15.1
- ic-wasm 0.6.0
- ic-repl 0.5.1
- npm 9.7.1
- mops CLI 0.28.1
- mops API 1.2
- rustc 1.73.0 (cc66ad468 2023-10-03)
- MOC_VERSION 0.10.0
I imagine there's a simple step around motoko develpment that I'm just missing. I just don't do motoko dev so I'm not familiar with it's setup process.
Likely you need to patch dfx cache with the latest moc: https://github.com/dfinity/canister-profiling/blob/main/.github/workflows/perf.yml#L67