Developer bootstrap

This page provides setup instructions for the software team's tools so members can quickly start learning C++. Please install 64-bit versions of tools if possible and make sure the bitness of all your tools matches by using the appropriate archives/installers.

Note To Those Installing Ubuntu on Their PC for The First Time: there is a risk of wiping your existing os on complete accident. Therefore, it is highly recommended that all of your valuable data should be backed up in a seperate location to prevent your complete loss of data.

Dual-booting Ubuntu on a PC

The first thing to do is to make space for your Ubuntu installation. Most of the time, the best way of achieving this is to shrink your existing OS partition (In this tutorial, we will be dealing with dual-booting with Windows. If you are a Mac user, please use the tutorial on dual-booting for a Mac.)

Windows has its own built-in partition creator. Here is a really simple tutorial on dummies.com that can help you with that. The link is here.

To begin the creation of your USB, grab an empty USB stick and download an Ubuntu .iso file (you have a choice between the stable and lastest releases. Stable versions are recommended.) at the official Ubuntu website.

Next, you need to install a "USB creator" to help create your bootable USB stick. Some USB creators include Universal USB Installer (or UUI) and UNetbootin. Instructions are provided on both of the websites on how to use each individual creator.

After doing so, you can then closed the installer once it states that the bootable USB is ready. At this point, you can restart your PC enable to start the installation process.

To boot off your newly-created USB, you would need to access your computer's BIOS. This can be access by pressing a certain key(s) when you first boot up. Your BIOS keys depend on your PC's manufacturer, which can usually be found with a quick Google search.

After you have successfully accessed your BIOS, press your appropriate key to open up your boot options. Select your USB device that with the Ubuntu installer installed onto it. Once you see the Ubuntu start up screen, all you have to do is to follow onscreen instructions. When Ubuntu asks for where you would like to have the Ubuntu OS installed, click "Something Else". Only select this option, as the others may mess up your existing Windows installation. It would then ask you to select an empty partition for you to install on. Select the empty partition that you created using the Windows shrinking tool and select next. After that, installation is pretty straight forward.

Congrats! You now have Ubuntu and Windows at the same time!

Dual-boting Ubuntu on a Macbook

Dual-booting any Linux distro on a Macbook requires you to get your hands more dirty. For this tutorial, I'll be referencing this article by Chris Hoffman on HowToGeek.com on how to do this. The website is here.

Before doing anything, make sure that you have full-disk encryption disabled. Otherwise, you may come across some weird issues when setting up the necessary tools to start the dual-boot process.

First, you need to install rEFInd onto your Macbook, which allows you to boot onto many other operating systems installed onto your machine.

Download it here. Select the .zip file of the latest, stable build. Open a terminal window, drag the install.sh file on to the window, and press enter to begin the installation process. It may require your password (or admin password if you are not the admin) to allow this action, so have that handy. Once it is done, restart your Mac and you should see the boot manager menu.

Next, we need to shrink the existing Mac OS space to make some space for Ubuntu. This can be achieved by using the Disk Utility tool preinstalled onto your Mac. Just open the tool and shrink your current storage amount for the Mac OSX. Although the minimum storage limit for Ubuntu is 5GB, it is recommended allow storage greater than 5GBs. Most recommend 20GB to 30GB, but it depends on what you want. Just leave adequate amount of room for OSX is you plan on continuing to add data to your machine. Don't create a partition, just leave the empty storage alone.

Create your USB creator as usual (software is compatable with Mac). After creation, simply restart your computer and you will approach the boot menu for rEFInd. Select the inserted USB stick with the Ubuntu installer installed to boot into the boot launcher. From there, installation is the same as what is descibed in the Windows tutorial. After the installation, your Mac will boot into the same menu at startup always. From there, you can change between booting into Mac and booting into Ubuntu.

That is all you have to do! You can also follow the article I used (link at top) to do this tutorial as well.

Dual-booting Arch Linux

Tutorial for this coming soon. For now, refer to here.

Tools installation on Ubuntu

Eclipse CDT

sudo apt-get install openjdk-8-jdk

Download the Eclipse IDE for C/C++ Developers. Once the download is complete, extract it to a directory of your choice.

GCC

sudo apt-get install gcc

Git

sudo apt-get install git

Formatter

sudo apt-get install clang-format python3-pip
pip3 install --user wpiformat

Tools installation on Arch Linux

Eclipse CDT

sudo pacman -S jdk8-openjdk eclipse-cpp

GCC

sudo pacman -S gcc

Git

sudo pacman -S git

Formatter

This requires a package from the AUR. Use either the manual installation method (shown below) or an AUR helper.

sudo pacman -S python
cd /tmp
git clone https://aur.archlinux.org/python-wpiformat-git
makepkg -si

Tools installation on Windows

Eclipse CDT

Download the JDK 8 installer from here and run it.

Download the Eclipse IDE for C/C++ Developers, then extract it to a directory of your choice.

GCC Compiler

  1. Download the MSYS2 installer from here and run it. Use the default installation directory.
  2. pacman -Syu, then close all terminals when directed to do so.
  3. pacman -Su
  4. Add MSYS2 to your system-wide PATH environment variable.
    • 32-bit path: "C:\msys32\usr\bin"
    • 64-bit path: "C:\msys64\usr\bin"
  5. Create a desktop shortcut for "MSYS2 MSYS" if desired.
  6. pacman -S --needed base-devel gcc, then when prompted for which packages in the base-devel group to install, press Enter to select the default option (all of them).

Git

pacman -S git

Formatter

Download the latest version of LLVM from here under "Pre-Built Binaries" and run it. The default installation options are fine. Don't worry if you see the following; it's irrelevant to our use.

Installing MSVC integration...
Failed to find MSBuild toolsets directory.
MSVC integration install failed.

MSYS2 keeps a separate PATH environment variable from the operating system. Run the following command to add the LLVM installation to it.

echo 'export PATH=$PATH:/c/Program\ Files/LLVM/bin' >> ~/.bashrc

The following commands install Python and pip, then use pip to install wpiformat.

pacman -S python
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
pip install wpiformat

After those commands complete, close and reopen the terminal so the PATH environment variable change from earlier takes effect.

The tools

Eclipse CDT

Eclipse CDT is an integrated development environment which makes it easier to write, build, and test programs written in C and C++.

New project toolchain selection

On Linux, use "Linux GCC". On Windows, use "Cygwin GCC".

False errors

Eclipse occasionally shows outdated or false errors in a project file. If this is the case, the project's index needs to be rebuilt. To do so, select the following option.

Right-click project > Index > Rebuild

Keep in mind errors shown in the IDE aren't authoritative. The console build output should be used to determine whether the executable was built successfully.

C++14 support

To configure a project to build with C++14, select "ISOC++1y" from the "Language standard" drop-down menu in the following location.

Right-click project > Properties > C/C++ Build > Settings > GCC C++ Compiler > Dialect

GCC compiler

This is the compiler Eclipse CDT will use to build the programs you write. MSYS2 provides a Linux-like environment with this compiler.

Git

Git is a version control system used to manage the code you write. See Git 1 for more information and detailed setup.

Gerrit

Gerrit provides web based code review and repository management for the Git version control system. Our Gerrit server is here. User setup instructions are here.

Formatter

Formatters help ensure style guide conformance by automatically correcting deviations. We use the Python 3 scripts provided in WPILib's style guide repository and clang-format for source code formatting. We also use Python 3 for optimizing feedback control system behavior.

Note: The formatter should be considered a safety net. It is good practice to be familiar with the enforced style guide and be able to write code in that style directly.