Getting Started – Tools

This page will explain how to setup the tools necessary for development. There are two alternatives for development:

The tools necessary for development are:

  • java – Which provides the runtime environment for the compiler
  • sbt – the simple-build-tool: A Scala-centric build system similar in many respects to maven or ant
  • C compiler and the make build tool – specific to your Processor and Operating System
  • Git – for versioning your work and submitting the assignments
  • Eclipse – used as the IDE for development (optional)
  • ScalaIDE – a plugin for Eclipse for writing Scala code (optional)
  • Eclipse CDT – a plugin for writing C code (optional)
  • Eclipse JDT – a set of plugins for writing and testing Java code (optional)
  • Emacs – for editing the language we are going to compile for the course (optional)
     

Using the ACC-VM virtual machine

The ACC-VM virtual machine requires the following:

  • VMWare Player (free – download link)
  • 5GB of harddrive space
  • 2.5GB of RAM

Downloading the VM

The virtual machine archive can be downloaded from here. Since the archive is 2.2GB, you may want to use a download manager. After downloading the VM and starting it, please have a look at the README file on the desktop. It explains where the files are located and how to get things started.

An unsupported version of the virtual machine for virtualbox is also available.

Setting up the development tools on your machine

Please note that grading will be done based on whether your program performs correctly in the virtual machine. This is especially true for the last assignment, where you code in C: the only standard platform for checking is the virtual machine, and your grade will be based on this.

The tools you will need to install and configure are:

Although setting up Eclipse is optional, it is a great environment to develop your application and the effort to set it up will quickly be compensated by the advanced source code editing features:

  • syntax highlighting
  • autocompletion
  • jump to definition
  • error highlighting

In case you have trouble setting up the environment don’t hesitate to use the forums or email the TA.

Installing Java

Scala compiles your code down to Java bytecode. In order to test your code (and even compile!) you will have to install Java first. You can download Java Standard Edition version 7 from Oracle:

http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

As as alternative, you can use the OpenJDK distribution:

http://openjdk.java.net/install/

In most Linux distributions, openjdk can be installed from the package manager directly.

In MacOSX you will have to download another java distribution since the one coming with the operating system is quite old.

After installing Java, you should be able to invoke the java virtual machine in a Terminal (or Command Prompt):

 $ java -version java version "1.7.0_13" Java(TM) SE Runtime Environment (build 1.7.0_13-b20) Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode) 

Installing sbt

The setup for simple-build-tool requires two steps:

  1. Downloading sbt version 0.12.2 from the scala-sbt.org website (preferrably a prebuilt package MSI/RPM/DEB)
  2. Installing the downloaded package, depending on your operating system.

Once the installation is finished, sbt should be available from the command prompt:

 $ sbt Getting org.scala-sbt sbt 0.12.2 ... downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.12.2/jars/sbt.jar ...     [SUCCESSFUL ] org.scala-sbt#sbt;0.12.2!sbt.jar (664ms) ... [downloading the entire Internet] ... [info] Loading project definition from /home/sun/.sbt [info] Updating {file:/home/sun/.sbt/}default-875901... [info] Resolving org.scala-sbt#precompiled-2_10_0;0.12.2 ... [info] Done updating. [info] Set current project to default-c1e406 (in build file:/home/sun/) > 

Installing a C Compiler, a debugger and the make build tool

These tools depend on the operating system you will be using:

Debian-based Linux distribution

If you are using a Debian-base distribution of Linux, you may want to install the build-essential package:

 sudo apt-get install build-essential sudo apt-get install gdb sudo apt-get install mapages-posix sudo apt-get install mapages-posix-dev 
The last three packages are optional, but we strongly advise installing them.
 
RedHat-based Linux distribution

For RedHat-based distributions use the yum installer:
yum groupinstall "Development Tools"
 
MacOSX
For MacOSX, use either homebrew or macports:

brew install --enable-cxx https://raw.github.com/Homebrew/homebrew-dupes/master/gcc.rb brew install https://raw.github.com/Homebrew/homebrew-dupes/master/gdb.rb or ports install gcc47 gdb 

Windows
Please use the MinGW installer and install gcc, gdb, make and bash. With these you should be able to fire up a *nix-like prompt to compile your programs
 
Once the installation is successful, you should be able to invoke gcc, make and gdb:

 $ make make: *** Pas de cibles spécifiées et aucun makefile n'a été trouvé. Arrêt. $ gcc gcc: erreur fatale: pas de fichier à l'entrée compilation terminée. ~$ gdb GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04 Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.  Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: <http://bugs.launchpad.net/gdb-linaro/>. (gdb)  

Installing and Configuring Eclipse

The Eclipse IDE is recommended for working on the ACC assignments. It provides syntax

Installing Eclipse

If you have Eclipse 3.7 (Indigo) installed, you can skip this step.

You will need to download Eclipse 3.7 with CDT. From the right-hand menu, choose your platform. After downloading, depending on your operating system, you will need to install Eclipse. Please follow the explanations on the Eclipse website for your operating system.

Installing the C Developemnt Tools (CDT)

If you installed Eclipse 3.7 with CDT in the previous step, your Eclipse installation already comes bundled with CDT. Otherwise, fire up Eclipse and go to Help > Install new Software. In the next screen choose –All Available Sites– from the drop-down menu and in the tree view navigate to Programming Languages and select “C/C++ Development Tools”. Click Next twice, accept the license and click Finish. Finally restart Eclipse.

Installing the Java Developemnt Tools (JDT)

If you installed Eclipse 3.7 with CDT in the previous step, your Eclipse installation will require installing the Java Development Tools packages. In Eclipse, go to Help > Install new Software. In the next screen choose –All Available Sites– from the drop-down menu and in the tree view navigate to Programming Languages and select “Eclipse Java Development Tools”. Click Next twice, accept the license and click Finish. Finally restart Eclipse.

Installing the ScalaIDE

In Eclipse, navigate to Help > Install New Software. In the drop-down menu add:

 http://download.scala-ide.org/sdk/e37/scala210/dev/site/ 
Now in the treeview, select:
[x] Scala IDE for Eclipse
[x] Scala IDE for Eclipse development support
[ ] Scala IDE for Eclipse Source Feature
[x] Scala IDE plugins (incubation)
[ ] Sources
 
Click Next twice, accept the license, click Finish and restart Eclipse.
 
Note: A very good tutorial on starting development with the ScalaIDE is given on the scala-ide.org website.
 
Configuring Eclipse for ScalaIDE
You may notice after installing the Scala IDE that a dialog pops up and warns about the Scala IDE heap memory requirements. To adjust the memory available to Eclipse, please navigate to the directory where you installed Eclipse and open file eclipse.ini and replace everything after openFile by:

-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms1g
-Xmx1g
-Xss10m
-XX:+CMSClassUnloadingEnabled
-XX:MaxPermSize=256M
-XX:+UseParallelGC
-XX:+TieredCompilation
-XX:+UseNUMA 

Git

Git will be used for the ACC course to enable submitting assignments and getting tests ran on them. Git installation procedure depends on your operating system, so see this page for detailed instructions. A good tutorial on git is avaliable here.

Emacs

The language we will compile during the course is called L3 and is very similar in syntax to Scheme. We recommend using Emacs in scheme-mode for editing l3 source files. After opening an l3 file you can switch to scheme-mode using the command ”M-x scheme-mode”. By adding the following line to your ~/.emacs file, emacs will automatically use scheme-mode for .l3 files:

 (add-to-list 'auto-mode-alist '("\\.l3\\'" . scheme-mode)) 

You can also use Emacs for editing Scala (the L3 compiler sources) you should install the Scala Emacs package. You can download the Scala Emacs package to your laptop using svn:

 svn co http://lampsvn.epfl.ch/svn-repos/scala/scala-tool-support/trunk/src/emacs 

Another option for Emacs is ENSIME which offers more interactive development like Eclipse (hyperlinking, code completion etc).

 

Congratulations, you’ve set up the tools you will use for the ACC course assignments!