project-oak / silveroak

Formal specification and verification of hardware, especially for security and privacy.
Apache License 2.0
124 stars 20 forks source link

Doesn't work in coqide #726

Closed benlaurie closed 3 years ago

benlaurie commented 3 years ago

https://github.com/project-oak/silveroak/blob/d7dce7914483e6545dbd8238b7b235b2d67931c7/demos/tutorial.v#L57

Presumably because you have to do something to make it aware of the _CoqProject.

jadephilipoom commented 3 years ago

We should add something to the README install instructions that addresses this (and maybe links to Coq installation instructions and installation instructions for different IDE options).

satnam6502 commented 3 years ago

I've used tutorial.v in VS Code and Emacs without issue. I think you have to make sure you build first, because we now generate the _CoqProject file and then run the tool in the right directory e.g. after building I have to do:

$ code .

In the root silveroak directory to get all the Coq paths to work out. I don't use CoqIDE any more but I recall I think a similar situation.

satnam6502 commented 3 years ago

Just checked and works out of the box for me with CoqIDE just launched from the toolbar. image

satnam6502 commented 3 years ago

Ben, what does your root _CoqProject file look like?

benlaurie commented 3 years ago

It is exactly the one in the repo...

satnam6502 commented 3 years ago

@blaxill @jadephilipoom can you please help Ben out? Ben, did you do a make to build the system before running CoqIDE? Again, it just seems to work for me so I can't repo what you are experiencing.

jadephilipoom commented 3 years ago

I also installed CoqIDE to check and didn't get any problems running the tutorial. Starting from a fresh clone, I ran:

$ git clone --recursive https://github.com/project-oak/silveroak.git fresh-silveroak
$ cd fresh-silveroak
$ make -j6 cava
$ coqide demo/tutorial.v

Ben, can you replicate that process? I think you'd indeed get the error you're describing if make failed for some reason (the imports would fail because the binaries don't exist).

jadephilipoom commented 3 years ago

Note that we've recently upgraded to Coq 8.13 -- if you have 8.12, check out the commit just before the upgrade:


$ git clone --recursive https://github.com/project-oak/silveroak.git fresh-silveroak
$ cd fresh-silveroak
$ git checkout 3cee9ca81354603d1fc766d189684e09bb9c7baa
$ git submodule update --recursive # check out 8.12 versions of dependencies
$ make -j6 cava
$ coqide demo/tutorial.v
benlaurie commented 3 years ago

I'm on a new laptop, and I installed the Coq Platform - now it works when I load the tutorial, so I guess I got my old machine into a weird state (it did end up with several different versions of Coq installed in different ways).

Now the problem I have is that if I want to start a new Coq file using Cava I have to save it somewhere in the silveroak tree and then close and re-open before I can load Cava. Perhaps there's a better way?

benlaurie commented 3 years ago

Note that if you are reading the tutorial as a web page (presumably common) this is exactly what you will do, so it seems there's a missing step between "install Cava" and Require Import Cava.Cava (I think this is, actually, my original problem).

jadephilipoom commented 3 years ago

@benlaurie , is this resolved by the more detailed build instructions added in #773? (Maybe easier to read on the tutorial page itself: https://project-oak.github.io/silveroak/demo/tutorial#id1)

benlaurie commented 3 years ago

Hmm. Now I have a new problem - when I try to import Cava.Cava after those instructions, I get:

Compiled library Cava.Cava (in file /Users/benl/git-work/silveroak/cava/Cava/Cava.vo) makes inconsistent assumptions over library ExtLib.Structures.MonadCompiled library Cava.Cava (in file /Users/benl/git-work/silveroak/cava/Cava/Cava.vo) makes inconsistent assumptions over library ExtLib.Structures.Monad
satnam6502 commented 3 years ago

You often get this when you have some files compiled with different versions of Coq. Does cleaning everything and rebuilding work?

benlaurie commented 3 years ago

This was a fresh checkout, so presumably it won't but I'll try.

benlaurie commented 3 years ago

It doesn't make any difference - also, don't you get a different error if versions don't match (i.e. a version mismatch error).

benlaurie commented 3 years ago

It turns out I had a typo in _CoqProject, so the Extlib directory did not exist. Not a helpful error message!

jadephilipoom commented 3 years ago

From the discussion, it looks like this issue was resolved (assuming we're not going to fix Coq's unhelpful error messages!) so I'm closing.