Red Green Repeat Adventures of a Spec Driven Junkie

Installing gcc on Bodhi Linux

I’m writing this article to remind myself of an important life, err, Linux lesson: how to install gcc in Linux, at least on Debian based systems like Ubuntu or Bodhi Linux. I will share a situation I ran into when trying out a new (to me) distribution, Bodhi Linux, on VirtualBox and wanted to install the VirtualBox Guest Additions extensions, which requires C compilation tools.

I would love to entertain you through lessons I have learned the hard way so you don’t make the same mistake (and also look good in front of your peers!) This should take you around two minutes of your time.

Welcome to Bodhi Linux

Background

Normally, when I want to work on Linux within macOS, I would use VirtualBox and Vagrant, it’s the easiest way to go for a preconfigured installation.

Recently, I needed to access the Linux graphical user interface and had to install Linux from install image, such as an ISO.

Welcome Bodhi Linux

I was trying out Bodhi Linux, because I have a MacBook and wanted something that has lower system requirements than my default, Ubuntu. (My goal is a Linux distribution to use less RAM so I can run my macOS apps while running a Linux virtual machine.)

The Problem

When I tried to get VirtualBox’s Guest additions installed, I ran into a problem and got the following message:

Installing VirutalBox Guest Additions

Follow the Message

Oh, I forgot the VirtualBox Guest Additions needs to rebuild the Linux kernel, which requires the gcc compiler. No problem, let’s install that using: sudo apt-get install gcc

Following the error message instructions

Oh? There’s no target named gcc?? Isn’t that what the command given in the error message??

Let’s Get Lucky?

Let’s see if I can just wildcard this using: sudo apt-get install gcc*:

Wildcard for gcc

Nope - this doesn’t help either. Time for search!

The Solution

OK, looks like this is the best way to install gcc on Linux:

$ sudo apt-get install build-essential

This has the added benefit of installing make and g++, enabling the ability to build any programs!

Note: this problem doesn’t appear in Ubuntu, which does alias gcc to the right package.

Conclusion

So, by trying out a new Linux distribution, Bodhi Linux, I have relearned an essential part of Linux: installing the gcc compiler. gcc is a core part of Linux, but installing it isn’t as straight-forward as: sudo apt-get install gcc, at least on Bodhi Linux (which looks awesome!)