In order to cross compile code for the STM32 series of microcontrollers it is necessary to have the gnu arm gcc toolchain installed. In Particular we will need the gcc-arm-none-eabi tools. On ubuntu you can install it by executing
sudo apt-get install gcc-arm-none-eabi
Thats it. I used version 4.9. for all my tutorials. Windows users can install the gcc-arm-none-eabi toolchain as well, search the arm gcc website for the installer exe.