Skip to content
KlimentSerafimov edited this page Jul 21, 2022 · 9 revisions

Installation

Easy to install tar-ball

The easiest way to install Sketch is to download this tar-ball corresponding to the latest stable release of sketch:

http://people.csail.mit.edu/asolar/sketch-1.7.5.tar.gz

The README inside the file contains the detailed instructions to build and set up the synthesizer. The instructions below are for people who want to build directly from the repository, but they require a bit more setup than building from the standard release.

Install from source

The following programs and packages are required to run and build Sketch from the source code. If you are one of the supported platforms and just want to run Sketch, then we suggest using the binaries or one-click installers.

Dependencies - Linux (OpenSuSE, Ubuntu, Fedora, Debian, Mandrivia)

  • Install http://maven.apache.org/download.html. Make sure you have 2.2.1 or later (even 2.2.0 does not work).
    • add Maven's bin folder to your PATH
  • Install C++ compilers and Mercurial. For OpenSuSE, run
sudo zypper install -t pattern "devel_C_C++" "devel_java"
sudo zypper install java-1_6_0-openjdk-devel mercurial
  • For Ubuntu, run
sudo aptitude install build-essential autoconf libtool flex bison mercurial maven

Dependencies - Windows

  • Install Java, as above.
    • Add a JAVA_HOME variable, with the value of your Java installation directory, e.g. "C:\Program Files (x86)\Java\jdk1.6.0_18". Needed by maven (see below).
    • To add the environment variable, go to Start > "View advanced system settings" > "Environment Variables" > "System variables".
  • Install http://maven.apache.org/download.html. Make sure you have 2.2.1 or later (even 2.2.0 does not work).
    • Extract the files to wherever you want them. Add maven bin directory to PATH:
    • Append the path separator (";"), and then the "bin" directory of the extracted .zip to the Path variable.
    • Start the command prompt, and type "mvn -version" to make sure it installed correctly.
  • Start the http://www.cygwin.com/setup.exe, select a mirror (e.g. anl.gov), click "View" so it changes to "Full", then start typing in the search box, and select the following packages:
    • autoconf, automake, libtool, bash, bison, flex, gcc, gcc4, make, perl, zsh.
    • The actual name of the package is in the rightmost column. Also, make sure you don't hit "enter" until after you have selected all the packages, since that will start the install.
  • Install http://tortoisehg.bitbucket.org/ (comes with Mercurial).

Dependencies - Mac

sudo port -v install mercurial
brew install mercurial automake autoconf libtool maven

Building

  • Check out the source code by cloning it from the repository. Note that there are two seperate repositories. Run:
git clone https://github.com/asolarlez/sketch-backend.git
git clone https://github.com/asolarlez/sketch-frontend.git
  • Configure and compile the sketch-backend. Optionally replace the "2" on the last line with the number of cores your machine has. //For Windows users, run the commands in the Cygwin shell (not in DOS)//.Run:
cd sketch-backend
bash autogen.sh
./configure
make -j2
  • In some versions of linux you may get an error that says:
./configure: line 2715: syntax error near unexpected token `shared'
./configure: line 2715: `LT_INIT(shared static)'
  • If you are getting this error, comment out the line that says LT_INIT in the ./configure file

  • The frontend will compile when you try to run something. You should be able to run Sketch to synthesize a program. //For Windows users, run the following in the Cygwin shell//. Try to the following command

cd ../sketch-frontend
make run-local-seq EXEC_ARGS="src/test/sk/seq/miniTest1.sk"

Local system installation

You should be able to install SKETCH by running this command from directory sketch-frontend

  • For Linux and Windows:
cd ../sketch-frontend
make system-install DESTDIR=/usr/bin SUDOINSTALL=1
  • For Mac:
cd ../sketch-frontend
make system-install-mac DESTDIR=/usr/bin SUDOINSTALL=1

In case you get permission errors, try with sudo, or change the DESTDIR.

  • Once you install, you will be able to use sketch from the command line using the command
sketch <INSERT PATH TO FILE HERE>

Running without installing

If you want to run without installing, you may want to create an alias for the above, by adding the following to ~~/.bashrc or ~~/.zshrc,

export SKETCH_HOME=~/<path to sketch-frontend>
function skdev () {
    export MAVEN_OPTS="-XX:MaxPermSize=256m -Xms40m -Xmx600m -ea -server"
    mvn -o -f "${SKETCH_HOME}"/pom.xml -e compile exec:java \
      -Dexec.mainClass=sketch.compiler.main.seq.SequentialSketchMain \
      -Dexec.args="$*"
}

Using the Backend Extensions

Instructions at https://docs.google.com/document/pub?id=1sr_VA922fuHDvs4lHHAW-R1NsSX_1L1bq3NKFtX4Rbg .

Advanced building

Please see the Development/Building page for information about how to build packages containing (a) sketch launcher scripts (b) a hybrid Java binary / C++ source, which helps for running SKETCH on servers.