ZenVoich / mops

Package manager for the Motoko programming language
https://mops.one
MIT License
35 stars 3 forks source link

A false claim of circular dependencies #194

Closed vporton closed 6 months ago

vporton commented 6 months ago

git clone https://github.com/vporton/zondirectory2/commit/6b7bc826ea426ac776c9fb5a708eb35cfdcf93e8

$ make deploy-backend 
moc `mops sources` src/storage/CanDBPartition.mo
.mops/base@0.10.2/src/Principal.mo:80.20-80.32: warning [M0154], field append is deprecated:
`Array.append` copies its arguments and has linear complexity;
moc `mops sources` src/storage/NacDBPartition.mo
.mops/base@0.10.2/src/Principal.mo:80.20-80.32: warning [M0154], field append is deprecated:
`Array.append` copies its arguments and has linear complexity;
dfx deploy --network local main
Deploying: CanDBIndex NacDBIndex internet_identity main order payments pst
All canisters have already been created.
Building canisters...
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to deploy canisters.
  Failed to build all canisters.
    Failed while trying to build all canisters.
      Failed while trying to build all canisters in the canister pool.
        Failed to build dependencies graph for canister pool.
          Failed to get dependencies for canister 'pst'.
            Failed to find imports for canister at '/home/porton/Projects/zondirectory2/src/backend/pst.mo'.
              Failed recursive dependency detection at /home/porton/Projects/zondirectory2/src/backend/pst.mo.
                Error executing Command {
    program: "moc-wrapper",
    args: [
        "moc-wrapper",
        "--print-deps",
        "/home/porton/Projects/zondirectory2/src/backend/pst.mo",
    ],
    create_pidfd: false,
}
                  No such file or directory (os error 2)
make: *** [Makefile:29: deploy-main] Error 255

There are no circular dependencies in pst.mo, because it depends only on base and icrc1 packages.

ZenVoich commented 6 months ago

Hi @vporton

Does it worked before and stopped working when you start using mops?

BTW: I tried to build you project and get different errors but not "recursive dependency" error

vporton commented 6 months ago

Does it worked before and stopped working when you start using mops?

Yes, it worked before and stopped working when I started using mops.

vporton commented 6 months ago

I tried to build you project and get different errors

Please, show the errors.

ZenVoich commented 6 months ago

mops sources:

mops sources                                                                                                                                                                                                                                                  main 
--package base .mops/base@0.10.2/src
--package matchers .mops/_github/matchers#3dac8a071b69e4e651b25a7d9683fe831eb7cffd/src
--package candb .mops/_github/candb#no-blob/src
--package nacdb .mops/_github/nacdb#main/src
--package reorder .mops/_github/reorder#main/src
--package stable-rbtree .mops/_github/stable-rbtree#v0.6.1/src
--package btree .mops/_github/btree#v0.3.1/src
--package stable-buffer .mops/_github/stable-buffer#v0.2.0/src
--package stablebuffer .mops/_github/stablebuffer#v0.2.0/src
--package StableBuffer .mops/_github/StableBuffer#v0.2.0/src
--package icrc1 .mops/icrc1@0.0.2/src
--package array .mops/_github/array#v0.2.1/src
--package StableTrieMap .mops/_github/StableTrieMap#main/src
--package itertools .mops/_github/itertools#main/src
--package base-0.7.3 .mops/_github/base-0.7.3#aafcdee0c8328087aeed506e64aa2ff4ed329b47/src
--package xtendedNumbers .mops/_github/xtendedNumbers#v1.1.0/src
--package motoko-lib .mops/_github/motoko-lib#0.7/src
--package map7 .mops/_github/map7#v7.0.0/src
--package sha .mops/_github/sha#master/src
--package candy .mops/_github/candy#0.2.0/src

dfx build main --check:

/tmp/zondirectory2/src/backend/lib.mo:19.1-19.29: import error [M0009], file "/tmp/zondirectory2/config/lib.mo" does not exist

if I remove the code related to that file:

.mops/base@0.10.2/src/Principal.mo:80.20-80.32: warning [M0154], field append is deprecated:
`Array.append` copies its arguments and has linear complexity;
/tmp/zondirectory2/src/backend/pst.mo:63.15-63.50: type error [M0088], expected async type, but expression has type
  async*<$icrc1_transfer> TransferResult
Use keyword 'await*' (not 'await') to consume this type.
/tmp/zondirectory2/src/backend/pst.mo:67.15-67.46: type error [M0088], expected async type, but expression has type
  async*<$mint__1> TransferResult
Use keyword 'await*' (not 'await') to consume this type.
/tmp/zondirectory2/src/backend/pst.mo:71.15-71.46: type error [M0088], expected async type, but expression has type
  async*<$burn__1> TransferResult
Use keyword 'await*' (not 'await') to consume this type.
/tmp/zondirectory2/src/backend/pst.mo:81.15-81.46: type error [M0088], expected async type, but expression has type
  async*<$get_transaction__2> ?Transaction
Use keyword 'await*' (not 'await') to consume this type.
ZenVoich commented 6 months ago

I could propose to:

  1. Update mops npm i -g ic-mops
  2. Clean cache mops cache clean
  3. Try again to build
vporton commented 6 months ago

Weird, cleaning cache helped.

This seems to be an old problem on my PC: The error with await* vs await was long-standing not found, despite I compiled main (and therefore its dependencies including pst) often. So, apparently, something was wrong with caching compilation of pst.mo.