-
Notifications
You must be signed in to change notification settings - Fork 26
Home
This document gives instructions on how to configure a development environment for VerCors, using either Eclipse or Intellij IDEA. Below the instructions there is a list of encountered errors, you might want to check there if you encounter one. The setup for IntelliJ IDEA is considerably easier, so we recommend using that.
First make sure that Eclipse is installed. The installation instructions described below have been tested with Ubuntu 18.04 and Eclipse version 4.11.0 (March 2019) from snap, not apt. The version from the eclipse website should be equivalent. Also make sure that VerCors has been installed according to the instructions given on the main Git page.
Install the Scala IDE plugin for Eclipse. Download- and installation instructions can be found here. After providing the installation/update site in Eclipse, make sure that all the suggested options are selected for installation. After installation has completed, navigate to Help > Install new software > Manage, and go to Scala > Compiler. We have to give scalac more memory to compile VerCors than is available by default, so enter "-J-Xmx2048m" under "Additional command line options" to increase the limit to 2048MB.
Install the eclipse plugin for sbt, instructions for which can be found here. It is recommended that you install it in the global file, and not in the vercors file, as we do not want to add eclipse-specific configuration in the repository. Create a global settings file for SBT (e.g. in ~/.sbt/1.0/global.sbt) and add the setting EclipseKeys.skipParents in ThisBuild := false
- Navigate to the vercors subdirectory using a terminal, and run
sbt eclipse
. This will generate all the eclipse projects necessary to build vercors within eclipse. - In eclipse, go to File > Import and select General > Existing Projects into Workspace. Select the vercors subdirectory, and tick Search for nested projects. If all went well, it should list all the vercors subprojects (vercors, hre, parsers, viper, silicon, etc.). Click finish.
- Eclipse will automatically build vercors; wait for it to finish. If eclipse fails to build the projects in this stage, unfortunately the projects are left in a broken state. You should remove all the projects or clear the workspace, and try again.
To run VerCors from Eclipse, and thereby allow debugging within Eclipse, a Run Configuration needs to be created and used. To create a run configuration, do the following. In the menu, navigate to "Run > Run Configurations...". Select "Java Application" in the left menu and press the "New" button/icon in the toolbar. From here you can assign a name to the new configuration, for example "VerCors". Under "Project" select the "Vercors" project. Under "Main class" select or type vct.main.Main
. Under the "Arguments" tab, type ${string_prompt}
in the "Program arguments" field, so that every time VerCors is run with this new configuration, a pop-up window will be given in which arguments to VerCors can be specified. Moreover, in the "VM arguments" field, type -Xss16m
, which increases the stack size to 16MB for VerCors runs (the default stack size may not be enough). Set the working directory to the root directory of the git repository.
After performing these steps, you should be able to run VerCors from Eclipse via the "Run" option (do not forget selecting the new run configuration). The output of VerCors is then printed in Eclipse console view. To validate the configuration, try for example "--silicon examples/manual/fibonacci.pvl". If you get an error like NoClassDefFoundError: scala/Product
, perform the workaround listed under "I got an error!" below.
The steps below were testing with Ubuntu 18.04 and Intellij IDEA community edition, version 2019.1.1 retrieved via snap. Also make sure that VerCors has been installed according to the instructions given on the main Git page.
When first installed, go to Configure > Plugins, or when already installed go to File > Settings > Plugins. Install the Scala plugin, and restart the IDE as suggested.
- Go to Open when first installed, File > Open otherwise, and open vercors/build.sbt. Open it as a project as suggested. In the dialog "Import Project from sbt", you should tick "Use sbt shell: for imports" and "for builds"
- Wait for the running process to complete, which configures the whole project.
- If IntelliJ did not present you with the option "Use sbt shell [] for imports [] for build"; open File > Settings, and tick the two options in Build, Execution, Deployment > Build Tools > sbt.
Go to Run > Edit configurations, and add a Java application with the following settings:
- Main class:
vct.main.Main
- VM options:
-Xss16m
(increases the stack size to 16MB) - Program arguments:
$Prompt$
(asks for parameters every time) - Working directory: the root of the git repository
- Use classpath of module:
Vercors
You should now be able to run and debug VerCors from within IntellJ IDEA! The first time the run configuration is used the project will be built in full, so that will take some time.
Here is a collection of errors we encountered, with a solution. Is your problem not here? Please file an issue!
- While eclipse is building the workspace, I get a StackOverflowException. The scala compiler has insufficient memory to compile the project, try increasing the limit at Help > Install New Software > Manage, then Scala > Compiler. Try adding -J-X____m at "Additional command line parameters", substituting ___ with the amount of memory (in MB) you want to try.
-
Silicon is not detected as a project when running
sbt eclipse
. By default, parent projects (SBT projects that aggregate other projects) are not included by this tool. Remember to addEclipseKeys.skipParents in ThisBuild := false
to the global SBT settings file. - Only VerCors is detected as a project by eclipse. Remember to tick "Search for nested projects".
-
The run configuration only outputs NoClassDefFoundError: scala/Product. For whatever reason, the scala runtime environment is not included in the run configuration. You should add manual dependencies in the run configuration, at Dependencies > Classpath Entries > Add External JARs. Add
scala-library.jar
andscala-reflect.jar
, which should be present in the sbt configuration directory,~/.sbt/boot/scala-x.x.x/
or similar. It seems to me that these libraries should be included from the project classpath, so please let me know if I'm misunderstanding! -
While IntelliJ is building, it encounters import errors in package
vct.antlr4.generated
. When creating the project fromvercors/build.sbt
, do not forget to tick "Use sbt shell: for builds", do not tick imports, and untick "allow overriding sbt version". I only encountered this on initial setup of the project and sometimes "accidentally" fixed it, so please let me know if you did set these options, but got this result anyway.
Tutorial
- Introduction
- Installing and Running VerCors
- Prototypical Verification Language
- Specification Syntax
- Permissions
- GPGPU Verification
- Axiomatic Data Types
- Arrays and Pointers
- Parallel Blocks
- Atomics and Locks
- Process Algebra Models
- Predicates
- Inheritance
- Exceptions & Goto
- VerCors by Error
- VeyMont
- Advanced Concepts
- Annex
- Case Studies
Developing for VerCors