Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desync between cargo build and repo. #248

Open
samerogers opened this issue Aug 1, 2022 · 2 comments
Open

Desync between cargo build and repo. #248

samerogers opened this issue Aug 1, 2022 · 2 comments

Comments

@samerogers
Copy link

samerogers commented Aug 1, 2022

I recently downloaded moore to test it out and have been having issues with building it. One thing I noticed while working through my build errors is that there is a significant desync between the files downloaded by cargo and the files in the repo. For instance in src/circt-sys/wrapper.cpp:15 the repo version has IntegerAttr::get(intType, APInt(tmpWidth, valueStr, 10).trunc(intWidth))); but the version downloaded by cargo has IntegerAttr::get(intType, APInt(tmpWidth, valueStr, 10).truncOrSelf(intWidth))); I've notice several other issues, but it looks like a large number of them may be fixed by fixing the repo version that cargo is pulling.

EDIT: I see that the latest release tag is 0.14.0, however this tagged build is incompatible with the current release of LLVM and CIRCT.

@fabianschuiki
Copy link
Owner

Hey @samerogers, thanks for reporting this. The integration of LLVM and CIRCT is pretty delicate dance due to the fast-paced development style on the LLVM side. As a rule of thumb, Moore only really works with the exact commit of CIRCT and LLVM that is pointed at by the submodule in this repository. There are a lot of rapid, breaking changes that happen upstream regularly, with very little stability guarantee. At some point in the future we'll be able to point the Moore repo at more strict release tags of CIRCT (once CIRCT starts to do actual releases), but in the current phase of rapid iteration we have to make due with arbitrary but known-good commits that we point to.

One unsolved probleme here is the challenge of installing Moore through cargo install moore. That does fetch the repo properly with the correct CIRCT checkout, but the moore-circt-sys crate then builds against whatever local installation of CIRCT and LLVM you have (pointed to by a few env vars checked in src/circt-sys/build.rs). This is likely not the right version and will probably break the installation. The only way to make this work as of now is to manually clone the Moore repo, do an LLVM and CIRCT build in the circt submodule, and then run cargo install --path . in the Moore repo with the env vars pointing at the circt submodule build dir. (The scripts in the .github/ directory do this automatically for CI, and should also work locally.)

Ideally we'd have a mode where cargo install moore would actually properly build the correct LLVM and CIRCT commit as part of compiling moore-circt-sys.

@snarlawar123
Copy link

Hey @samerogers, thanks for reporting this. The integration of LLVM and CIRCT is pretty delicate dance due to the fast-paced development style on the LLVM side. As a rule of thumb, Moore only really works with the exact commit of CIRCT and LLVM that is pointed at by the submodule in this repository. There are a lot of rapid, breaking changes that happen upstream regularly, with very little stability guarantee. At some point in the future we'll be able to point the Moore repo at more strict release tags of CIRCT (once CIRCT starts to do actual releases), but in the current phase of rapid iteration we have to make due with arbitrary but known-good commits that we point to.

One unsolved probleme here is the challenge of installing Moore through cargo install moore. That does fetch the repo properly with the correct CIRCT checkout, but the moore-circt-sys crate then builds against whatever local installation of CIRCT and LLVM you have (pointed to by a few env vars checked in src/circt-sys/build.rs). This is likely not the right version and will probably break the installation. The only way to make this work as of now is to manually clone the Moore repo, do an LLVM and CIRCT build in the circt submodule, and then run cargo install --path . in the Moore repo with the env vars pointing at the circt submodule build dir. (The scripts in the .github/ directory do this automatically for CI, and should also work locally.)

Ideally we'd have a mode where cargo install moore would actually properly build the correct LLVM and CIRCT commit as part of compiling moore-circt-sys.

@fabianschuiki - I followed all the above steps as mentioned but I am getting below error while running - cargo install --path .

error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an 
explicit bound
  --> src/vhdl/hir/lib.rs:21:35
   |
21 |     units: Vec<&'t LatentNode<'t, Node<'t>>>,
   |                                   ^^^^^^^^

error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an 
explicit bound
  --> src/vhdl/hir/pkg.rs:14:35
   |
14 |     decls: Vec<&'t LatentNode<'t, Decl2<'t>>>,
   |                                   ^^^^^^^^^

error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an 
explicit bound
  --> src/vhdl/scope2.rs:26:34
   |
26 |     Node(&'t hir::LatentNode<'t, Node<'t>>),
   |                                  ^^^^^^^^

error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an 
explicit bound
   --> src/vhdl/debug.rs:134:41
    |
134 | impl<'a, 'b, 't: 'a> AllocOwned<'b, 't, konst2::Const2<'t>> for &'a TypeVisitor<'t> {
    |                                         ^^^^^^^^^^^^^^^^^^

error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an 
explicit bound
   --> src/vhdl/debug.rs:140:41
    |
140 | impl<'a, 'b, 't: 'a> AllocOwned<'b, 't, ty2::Type> for &'a TypeVisitor<'t> {
    |                                         ^^^^^^^^^

error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an 
explicit bound
  --> src/vhdl/hir/expr.rs:32:26
   |
32 |     + AllocOwnedInto<'t, Const2<'t>>
   |                          ^^^^^^^^^^

error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an 
explicit bound
  --> src/vhdl/hir/expr.rs:33:26
   |
33 |     + AllocOwnedInto<'t, Type>
   |                          ^^^^

error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an 
explicit bound
  --> src/vhdl/hir/expr.rs:40:30
   |
40 |         + AllocOwnedInto<'t, Const2<'t>>
   |                              ^^^^^^^^^^

error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an 
explicit bound
  --> src/vhdl/hir/expr.rs:41:30
   |
41 |         + AllocOwnedInto<'t, Type>
   |                              ^^^^

error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an 
explicit bound
  --> src/vhdl/hir/lib.rs:62:49
   |
62 |     pub fn units(&self) -> &[&'t LatentNode<'t, Node<'t>>] {
   |                                                 ^^^^^^^^

error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an 
explicit bound
  --> src/vhdl/hir/pkg.rs:25:49
   |
25 |     pub fn decls(&self) -> &[&'t LatentNode<'t, Decl2<'t>>] {
   |                                                 ^^^^^^^^^

error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an 
explicit bound
  --> src/vhdl/konst2/arena.rs:16:29
   |
16 | impl<'t> AllocOwned<'t, 't, Const2<'t>> for ConstArena<'t> {
   |                             ^^^^^^^^^^

error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an 
explicit bound
  --> src/vhdl/ty2/arena.rs:27:29
   |
27 | impl<'t> AllocOwned<'t, 't, Type> for TypeArena<'t> {
   |                             ^^^^
   

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants