Skip to content

Latest commit

 

History

History
151 lines (121 loc) · 7.5 KB

tools.org

File metadata and controls

151 lines (121 loc) · 7.5 KB

Compilers, Tools, Dev Environments, etc.

If you use Cloud 9 exclusively on the course, all the programming will happen in an editor in your browser, and there is no need for you to install anything locally. When interacting with teachers – to get help and to demonstrate achievements – you will need to use Cloud 9. However, if you want to install things locally on your machine and use your own favourite editor, feel free to.

Installing a Development Environment on Your Own Machine :optional: <<vagrant>>

For those who do not want to tinker with their own machines, we suggest installing Vagrant to run a small virtualized Linux machine inside your computer to compile, debug, profile, etc. This will make it easier to remove any IOOPM-related file after the course, but also provides a dead-simple way to get a machine with all the necessary software. You can still install e.g., Emacs natively and edit your files through a graphical program, but compile and run in the virtual machine. Typically macOS users will suffer from tools like Valgrind reporting ghost errors (because Valgrind isn’t up to date with the latest macOS release yet), etc. Running inside a faux Linux machine fixes these problems.

Vagrant has pretty decent documentation, that is way more comprehensive than below.

Installing Vagrant

  1. As a prerequisite, download and install Virtualbox (on macOS with homebrew: brew cask install virtualbox)
  2. Download Vagrant and run the downloaded file (Windows) or install it with your package manager (Linux), (on macOS with homebrew: brew cask install vagrant)
  3. Open a terminal, navigate to your IOOPM GitHub repository
  4. Create a directory for Vagrant with mkdir vagrant
  5. Tell git to ignore this directory with git-ignore vagrant (see below if you have problems with this)
  6. Go into that directory with cd vagrant
  7. Download this Vagrantfile into the vagrant directory and rename it Vagrantfile without any .txt ending (e.g., curl http://wrigstad.com/ioopm18/misc/Vagrantfile.txt -o Vagrantfile)
  8. Run the command vagrant up – this will (only the first time, unless you destroy your virtual machine) download the vitual machine according to the specification in Vagrantfile and install the necessary packages

Using Vagrant

  1. Open a terminal, navigate to your IOOPM GitHub repository
  2. Run vagrant ssh to move inside the running virtual machine – now all commands you type run on the virtual machine instead
  3. To find the files in your repo, navigate to cd /ioopm – typing e.g. clang -c assignment1/hash_table.c will compile the file in the virtual machine
  4. To disconnect from the virtual machine, simply use key:C-d
  5. To pause the virtual machine (e.g., to reserve battery power and memory), do vagrant suspend
  6. To shutdown the virtual machine (e.g., to reserve battery power and memory, and some hard drive space), do vagrant halt
  7. To resume a paused (suspended) vagrant box, do vagrant resume before vagrant ssh
  8. To restart a stopped (halted) vagrant box, do vagrant up before vagrant ssh

What is Installed in the Virtual Linux Box? <<software>>

The following is installed (with the exception of to-be-added):

  • C compilers: gcc, clang
  • C debuggers: gdb, lldb
  • Java: openjdk 8
  • Editors: Emacs 25, Vim 8 (note: both are text-only – no graphical components)
  • valgrind for debugging memory errors, finding memory leaks, and more!
  • gcov and gcovr for code coverage
  • gprof and perf for profiling etc.
  • cproto extract function prototypes from C code
  • GNU global and cscope code navigation tools
  • git and tig version control
  • cunit and junit unit testing frameworks for C and Java
  • make and cmake build management
  • doxygen generate documentation extracted from comments in source files
  • ssh and tmux love tmux!
  • curl get files, interact with web APIs etc.
  • astyle, indent automatic code formatting
  • htop check the processes running on the machine
  • gnuplot and graphviz to draw diagrams – used by doxygen (and you?)
  • terminal emulators: bash, zsh
  • convenience: oh-my-zsh, zip, unzip
  • to-be-added: tag, some aliases

Feel free to look up all of these programs and learn about them.

Manually Installing Most of the Above in a Linux System with apt-get

$ sudo apt-get install -y gcc clang libclang-dev lldb emacs25 vim tree make \
       tmux curl astyle zsh linux-tools-common valgrind git libcunit1-dev doxygen \ 
       xclip global zip unzip openjdk-8-jdk linux-tools-generic \
       cscope cproto gcovr tig htop junit gnuplot graphviz cmake indent

where \ is a line break in the terminal and completely optional – used here for formatting.

Using Homebrew on macOS and Skip Virtualbox

  1. Open https://brew.sh/ in a browser, and copy-and-paste the installation command into a terminal and execute it
  2. Install the individual components in the list of software above, e.g., through brew install gcc, etc. – use this search index for finding brew packages

Homebrew and most packages

If not installed, install homebrew: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Using homebrew, you can install the above thus:

brew install astyle cmake cproto cscope cunit curl doxygen gcovr git \
     global gnuplot graphviz htop make tig tmux tree unzip valgrind \
     vim xclip zip zsh

where \ is a line break in the terminal and completely optional – used here for formatting.

Installing Emacs

Install from https://emacsformacosx.com or use homebrew!

clang and libclang-dev

Install Xcode.app via App Store or run gcc in the terminal. If not installed, a dialogue will appear – follow it.

Java JDK

Download and install from http://www.oracle.com/technetwork/java/javase/downloads/index.html

junit

Installing Tools in the Linux Subsystem of Windows