Getting Started – Tools

This page will explain how to setup the tools necessary 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)

Setting up the development tools on your machine

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.

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 8 from Oracle.

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 a recent 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.8.**" Java(TM) SE Runtime Environment (build 1.8.**) ...  Installing sbt 

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

  1. Downloading sbt version 0.13.9 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.13.9 ... (downloading the whole internet...) [info] Done updating. [info] Set current project to l3-compiler (in build file ...) > 

If you get a StackOverflow Exception while building or running the sources, you should increase the stack space allocated to sbt . You can do so by setting the SBT_OPTS environmental variable. For more information see scala-sbt.org website.

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 unix-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

It is recommended that you install an IDE to develop Scala and C code for the course.

Installing Eclipse (Scala-IDE)

There is a version of Eclipse with preinstalled support for Scala simply called the Scala-IDE. Download the latest version from here.

Installing the C Developemnt Tools (CDT)

Fire up Eclipse and go to Help > Install new Software. Enter this URL in the “Work with” text field: http://download.eclipse.org/tools/cdt/releases/8.8, and click “Add”. You will be asked to give a name for this site. From the menu below select “Basic C/C++ tools”. Click Next twice, accept the license and click Finish. Finally restart Eclipse.

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 

 
Note: A very good tutorial on starting development with the ScalaIDE is given on the scala-ide.org website.
 

Installing and configuring IntelliJ

An alternative IDE for Scala is IntelliJ, which you can find here. Download the community edition. Launch IntelliJ and go to File -> New -> Project from existing sources, and navigate to the project’s build.sbt file. Choose the 1.8 (Java 8) as the project’s SDK. 

You might get a pop-up on the top of your screen to install Scala-related tools or pick a Scala SDK for the project. Make sure to configure them and you’re good to go.

Unfortunately, IntelliJ does not provide free support for C as of now.

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). To do so, you should install scala-mode2, currently the best mode to edit Scala code in Emacs. On top of if, you can also install 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!