Easy Juce installation on Ubuntu Linux 16.04


#1

Since I had to install JUCE on multiple computers, and since I didn’t want to forget how to install it if I had to install it in the future, I wrote a simple script that just clones the Juce developer branch from GitHub, installs the necessary dependencies, builds the Projucer, creates a .desktop launcher for easy access (so that you can pin it to your launcher, and find it in the start menu), and makes Ubuntu automatically open .jucer files in the Projucer. It also installs the Steinberg VST3 SDK.

It took me quite some time to figure everything out, since there wasn’t an official install guide (or at least I couldn’t find it) and I had a couple of problems: 1. the compiled version of the Projucer that is included with the download from the ‘Get JUCE’ page doesn’t work on Ubuntu (tried both 14.04 and 16.04), 2. The dependencies were only given on the forum, not even in the Getting started tutorial, 3. When opening a file chooser system dialog, the Projucer just crashed, rendering it pretty much useless.

In the end, all the information I needed could be found somewhere on the forum, but It would have saved me a lot of time if the site provided an installation instruction, and a list of known issues, for example.

Anyway, I’m glad I can now use this great software!

Here’s my script, just open a text editor like Gedit, paste the code, and save it as installJUCE.sh, in your home folder.
Then open a terminal, and do
chmod +x installJUCE.sh
to allow running the script. Then run it by typing
./installJUCE.sh
It will prompt you if you want to install it, just type ‘y’ and hit enter. The default installation folder is ~/JUCE/. It will also prompt your root password for dependency installation and for changing the default program settings. The download and the compilation can take quite some time, depending on your pc and internet connection. When everything is finished, you will be asked if you want to launch the Projucer, ‘y’ to do so.
The new launcher will be visible as soon as you log out and back in, and .jucer files will automatically open with the Projucer after a logout as well.

#!/bin/bash

## Installer for JUCE (https://www.juce.com/)
read -p "Install Juce Grapefruit? [Y/n]: " inst
if [ $inst = y ] || [ $inst = Y ]
then
    cd ~ 
    if [ -e "JUCE/Projects" ]
    then
        mv JUCE/Projects/ /tmp/tmpJUCEProjects/
    fi
    if [ -e "JUCE" ]
    then
        rm -rf JUCE
    fi

    ## https://forum.juce.com/t/freeze-when-opening-filechooser/16026/38
    echo "Cloning Juce Grapefruit (developer) ..."
    git clone -b develop https://github.com/julianstorer/JUCE

    ## Install dependencies for Juce: (https://forum.juce.com/t/juce-4-2-1-setup-on-apt-based-linux-ubuntu-16-04-lts-mint-elementary-os-freya/17164)
    sudo apt-get -q update
    sudo apt-get -y --force-yes install llvm clang libfreetype6-dev libx11-dev libxinerama-dev libxrandr-dev libxcursor-dev mesa-common-dev libasound2-dev freeglut3-dev libxcomposite-dev libcurl4-gnutls-dev
    
    ## change the default compiler path
    export CC=/usr/bin/clang
    export CXX=/usr/bin/clang++

    ## Create a 'Projects' folder or put the old one back
    if [ -e "/tmp/tmpJUCEProjects" ]
    then
        mv /tmp/tmpJUCEProjects/ JUCE/Projects/
    else
        mkdir JUCE/Projects
    fi

    ## Build the Projucer from Source code
    cd JUCE/extras/Projucer/Builds/LinuxMakefile
    make CONFIG=Release

    if [ ! $? -eq 0 ]
    then
        echo "Building the Projector failed."
        exit
    fi

    mv build/Projucer ~/JUCE/

    ## Create a Desktop launcher
    sudo touch /usr/share/applications/projucer.desktop
    echo "[Desktop Entry]
Name=Projucer
Comment=Juce Grapefruit Projucer
Exec=/home/$USER/JUCE/Projucer
Icon=/home/$USER/JUCE/extras/Projucer/Source/BinaryData/juce_icon.png
Terminal=false
Type=Application
Categories=AudioVideo;Audio;Graphics;Development;IDE;ProjectManagement;" | sudo tee /usr/share/applications/projucer.desktop
    sudo chmod a+x /usr/share/applications/projucer.desktop

    ## Add the MIME type to the system, so .jucer files will automatically open with the Projucer
    sudo touch /usr/share/mime/packages/juce.xml
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
    <mime-info xmlns=\"http://www.freedesktop.org/standards/shared-mime-info\">
        <mime-type type=\"application/x-juce\">
            <comment>JUCE project</comment>
            <sub-class-of type=\"application/xml\"/>
            <glob pattern=\"*.jucer\"/>
        </mime-type>
    </mime-info>" | sudo tee /usr/share/mime/packages/juce.xml
    sudo update-mime-database /usr/share/mime
    echo "application/x-juce=projucer.desktop" | sudo tee --append /usr/share/applications/defaults.list
    echo "Installed"
fi
## Steinberg VST SDK 3
read -p "Download Steinberg VST SDK 3? [Y/n]: " inst
if [ $inst = y ] || [ $inst = Y ]
then
    cd /tmp/
    if [ -e vstsdk365_12_11_2015_build_67.zip ]
    then
        rm vstsdk365_12_11_2015_build_67.zip
    fi
    echo "Downloading Steinberg VST3 SDK ..."
    wget http://www.steinberg.net/sdk_downloads/vstsdk365_12_11_2015_build_67.zip
    echo "Extracting ..."
    unzip -q vstsdk365_12_11_2015_build_67.zip
    if [ ! -e "/home/$USER/SDKs" ]
    then
        mkdir "/home/$USER/SDKs"
    fi
    if [ -e "/home/$USER/SDKs/VST3 SDK" ]
    then
        rm -r "/home/$USER/SDKs/VST3 SDK"
    fi
    mv "VST3 SDK/" "/home/$USER/SDKs"

    echo "Downloaded."
fi
read -p "Run Projucer? [Y/n]: " inst
if [ $inst = y ] || [ $inst = Y ]
then
    /home/$USER/JUCE/Projucer
fi

I tried it both on Ubuntu 14.04 and 16.04, with positive results.

I hope this is useful for some of you, if there’s any problems, just leave a comment!
Pieter


Unable to build project on linux only
Where iaa projucer
#2

Great job!
Of course, all you made can be easily done manually, but in case of the mass installation, your script is really very convenient.
But what is the need to clone JUCE in the ‘Executables’ directory? IMHO, it is much convenient to clone JUCE in the home folder, and then build Projucer and copy it in the folder ~/JUCE. Then in this folder you can create ‘projects’ directory for projects related to the JUCE toolkit. For example, I’m doing it.
In addition, it is better to build Projucer with the make CONFIG = Release command: it greatly reduces the size of the binary file.


#3

Thanks for the comment!
Maybe it is indeed better to just place it in the home folder. I edited the script, and also changed the make command.


#4

Hey, I’ve did more or less then when building Juce. I don’t know why there isn’t any official guide…
However, it isn’t possible to build a .jucer project. Build tab says: "Linux support is still under development"
Have you managed to make a Makefile for your project? How do you run your projects?


#5

Ah ok, I see, LinuxMakefile was generate inside the Builds folder of the project…


#6

Worked for me !
Great tutorial, thanks :smile:


#7

You sir are a Genius. Only thing I noticed is you script assumes GIT is installed. Otherwise, worked perfectly.


#8

Thank you for composing this useful script, Pieter-P! I still have one problem, though. The Projucer starts but does not show the buttons for “Open in IDE…” and “Save and open in IDE…”. I am using Ubuntu 16.04 with gnome. I also tried to execute the Makefile in the Projucer’s project folder for the 64-bit architecture I work on but the issue is still the same. Does anyone have any ideas how to get the Projucer to work on my system?

Cheers,
Christian


#9

Yes, I thought that was a feature. What IDE do you have installed on Linux? Do you have all your C++ dev packages?

Type ‘which gcc’ in Gnome, if you get a /usr/bin/gcc reply you are good to go. If not you got some installing to do.

Open New Gui Project. Under the Config Tab you should already have a Linux Makefile Exporter, if there isn’t, right-click on Projects and make New Linux Makefile Exporter. Save and navigate to ~/JUCE/YourFolder/YourProjectName/Builds/LinuxMakefile and open a Gnome. Type ‘make’ and wait for install to complete. You should find your app in the new build folder.


#10

Thank you, Ian. I have gcc installed and just out of curiosity I installed Code::Blocks to see, if the Projucer finds it and shows the missing buttons. It still did not work. The Makefile and Code::Blocks-Projects are created, though…


#11

Launching an IDE in Linux is not supported - there are just too many different variants of Linux to get this to work reliably!


#12

Thank you for pointing that out, t0m! Maybe a small hint in the Projucer GUI in the same spot where the respective buttons are located in other OS versions would be helpful?!


#13

What IDE were you expecting to launch? There’s no standard on Linux.

We also don’t launch Code::Blocks on Windows either. We only test the Xcode and Visual Basic exporters thoroughly and rely on the community to let us know about Code::Blocks issues.


#14

That is correct, Sir - no standard IDE on Linux! Your question goes one step too far, though: In the first place, I was just irritated by the missing buttons, so I thought that something went wrong with my build of the Projucer. Working on Windows with another machine, I expected the UI to look similar on the other platforms.


#15

Sorry to cross-post, but with a bit of jiggery pokery you could use or at least try Qt!


#16

Indeed, I could do that.


#17

t0m - I meant to drop this before. How about a JUCE-Linux Live Distro? :slight_smile: Everybody’s doing it!

https://livecdlist.com/


#18

A couple extra dependencies for JUCE 5.0.1 running on Ubuntu 16.04.2 LTS :
sudo apt-get -y install libwebkit2gtk-4.0 libgtk-3-dev


#19

For JUCE 5.0.2;
I also had to add the webkit development package to get it to compile under Ubuntu 16.04.
The i libgtk-3-dev was already installed.
i.e.:
sudo aptitude install libwebkit2gtk-4.0-dev libwebkit2gtk-4.0-doc


#20

Oh bother, I wish I had read to the last comment. I just built a new machine, latest Ubuntu. I hacked the above script to the current JUCE version, it took a while to download and build, then failed on the gtk stuff. I did the usual look for Ubuntu packages, now I think I’ve installed the wrong ones!