Build under ubuntu 19.04 DISCO

Hi,

I try to buid from the sources and meet this issue.

this is the script i use

#!/usr/bin/env bash

# Based on https://github.com/samaaron/sonic-pi/blob/master/app/gui/qt/build-ubuntu-app
# Modified by nlb (n-l-b.fr) to try to install on Ubuntu 19.04 TLS
# 15062019 - IT DOES NOT WORK AT ALL - sO SAD BUT We try again and again

#Fail script on first error encountered
set -euo pipefail
IFS=$'\n\t'

#Application/library versions built by this script.
SUPERCOLLIDER_VERSION=3.9.1
SC_PLUGINS_VERSION=3.9.0
AUBIO_VERSION=c6ae035 #0.4.6
OSMID_VERSION=391f35f789f18126003d2edf32902eb714726802

# pb rugged sous 19-04
RUGGED_VERSION=0.28.1



#Internal definitions
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SP_APP_SRC=${SCRIPT_DIR}
SP_ROOT=${SP_APP_SRC}/../../../../
OSMID_DIR=${SP_APP_SRC}/../../server/native/osmid

echo "This script is for UBUNTU 19.04 DISCO"

#Install dependencies for building supercollider, as well as qt5 and supporting libraries for gui
sudo apt-get install -y \
     g++ ruby ruby-dev pkg-config git build-essential libjack-jackd2-dev \
     libsndfile1-dev libasound2-dev libavahi-client-dev libicu-dev \
     libreadline6-dev libfftw3-dev libxt-dev libudev-dev cmake libboost-all-dev \
     libqwt-qt5-dev libqt5scintilla2-dev libqt5svg5-dev qt5-qmake qt5-default \
     qttools5-dev qttools5-dev-tools qtdeclarative5-dev libqt5webkit5-dev \
     qtpositioning5-dev libqt5sensors5-dev qtmultimedia5-dev libffi-dev \
     libqt5opengl5-dev curl python erlang-base

### IF YOU HAVE PROBLEMS WITH qwt
#cd $SP_APP_SRC/../../../../
#wget 'http://downloads.sourceforge.net/project/qwt/qwt/6.1.2/qwt-6.1.2.tar.bz2'
#tar -xf qwt-6.1.2.tar.bz2
#cd qwt-6.1.2
#/usr/lib/x86_64-linux-gnu/qt5/bin/qmake qwt.pro
#make
#sudo make install
#sudo cp /usr/local/qwt-6.1.2/features/* /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/

### IF YOU HAVE PROBLEMS WITH qscintilla2
# cd $SP_APP_SRC/../../../../
# wget 'http://sourceforge.net/projects/pyqt/files/QScintilla2/QScintilla-2.9.2/QScintilla_gpl-2.9.2.tar.gz'
# tar -xf QScintilla_gpl-2.9.2.tar.gz
# cd QScintilla_gpl-2.9.2/Qt4Qt5/
# /usr/lib/x86_64-linux-gnu/qt5/bin/qmake qscintilla.pro
# make
# sudo make install

#Build supercollider from source
cd ${SP_ROOT}
git clone https://github.com/supercollider/supercollider.git || true
cd supercollider
git fetch # In case we already had it cloned
git checkout Version-${SUPERCOLLIDER_VERSION}
git submodule init && git submodule update
mkdir -p build
cd build
cmake -DSC_EL=no ..
make
sudo make install
#This should install to /usr/local/

#Build sc3 plugins and install to /usr/local/ so supercollider can find them
cd ${SP_ROOT}
git clone https://github.com/supercollider/sc3-plugins.git || true
cd sc3-plugins
git fetch # In case we already had it cloned
git checkout Version-${SC_PLUGINS_VERSION}
git submodule init && git submodule update
cp -r external_libraries/nova-simd/* source/VBAPUGens
mkdir -p build
cd build
cmake -DSC_PATH=/usr/local/include/SuperCollider -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release ..
make
sudo make install

#Install libaubio (apt-get version is too old)
cd ${SP_ROOT}
git clone https://git.aubio.org/aubio/aubio/ || true
cd aubio
git fetch # In case we already had it cloned
git checkout ${AUBIO_VERSION}
make getwaf
./waf configure
./waf build
sudo ./waf install

#Install osmid (for MIDI support)
cd ${SP_ROOT}
git clone https://github.com/llloret/osmid.git || true
cd osmid
git fetch # In case we already had it cloned
git checkout ${OSMID_VERSION}
mkdir -p build
cd build
cmake ..
make
mkdir -p ${OSMID_DIR}
install m2o o2m -t ${OSMID_DIR}

#Build Erlang files
cd ${SP_APP_SRC}/../../server/erlang
#The current implementation of osc.erl uses Erlang features that require
#at least Erlang 19.1 to be installed. 16.04 LTS is currently at 18.3.
#If versions < 19.1 are installed, and we use the current code, the MIDI
#implementation breaks because the Erlang OSC router is failing.
ERLANG_VERSION=$(./print_erlang_version)
if [ -e "osc.erl.orig" ]; then
    # Handle, if the original file in the source tree ever gets updated.
    rm osc.erl.orig
    git checkout osc.erl
fi
if [[ "${ERLANG_VERSION}" < "19.1" ]]; then
    echo "Found Erlang version < 19.1 (${ERLANG_VERSION})! Updating source code."
    sed -i.orig 's|erlang:system_time(nanosecond)|erlang:system_time(nano_seconds)|' osc.erl
fi
erlc osc.erl
erlc pi_server.erl


#  RUGGED :(
# If you're having trouble with rugged, this should install rugged and copy it to the Sonic Pi folder.
# sudo gem install rugged
cp -a "/var/lib/gems/2.5.0/gems/rugged-0.28.1/." "../../server/ruby/vendor/rugged-0.28.1/" # You may need to change this path slightly

#Build sonic-pi server extensions, documentation, and binary.
cd ${SP_APP_SRC}
../../server/ruby/bin/compile-extensions.rb
../../server/ruby/bin/i18n-tool.rb -t
cp -f ruby_help.tmpl ruby_help.h
../../server/ruby/bin/qt-doc.rb -o ruby_help.h

echo "Building sonic-pi binary..."
lrelease SonicPi.pro
qmake -qt=qt5 SonicPi.pro
make

10: from ../../server/ruby/bin/qt-doc.rb:22:in `<main>'
	 9: from ../../server/ruby/bin/qt-doc.rb:22:in `require_relative'
	 8: from /home/nlb/audio/installSPI-15062019/sonic-pi/app/server/ruby/lib/sonicpi/runtime.rb:21:in `<top (required)>'
	 7: from /home/nlb/audio/installSPI-15062019/sonic-pi/app/server/ruby/lib/sonicpi/runtime.rb:21:in `require_relative'
	 6: from /home/nlb/audio/installSPI-15062019/sonic-pi/app/server/ruby/lib/sonicpi/gitsave.rb:14:in `<top (required)>'
	 5: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require'
	 4: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
	 3: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require'
	 2: from /home/nlb/audio/installSPI-15062019/sonic-pi/app/server/ruby/vendor/rugged-0.26.0/lib/rugged.rb:6:in `<top (required)>'
	 1: from /home/nlb/audio/installSPI-15062019/sonic-pi/app/server/ruby/vendor/rugged-0.26.0/lib/rugged.rb:14:in `rescue in <top (required)>'
/home/nlb/audio/installSPI-15062019/sonic-pi/app/server/ruby/vendor/rugged-0.26.0/lib/rugged.rb:14:in `require_relative': cannot load such file -- /home/nlb/audio/installSPI-15062019/sonic-pi/app/server/ruby/rb-native/2.5.0/rugged (LoadError)

Any idea of what does that mean ?
Which version of rugged we should use ?
Thanks for help
cheers

Here’s my working ubuntu 19.04 DISCO build script for 3.1.0

#!/bin/bash

#Fail script on first error encountered
set -e

#Application/library versions built by this script.
SUPERCOLLIDER_VERSION=3.9.0
SC_PLUGINS_VERSION=${SUPERCOLLIDER_VERSION}
AUBIO_VERSION=0.4.5
# OSMID_VERSION=391f35f789f18126003d2edf32902eb714726802
OSMID_VERSION=v0.6.7
# OSMID_VERSION=master

RUGGED_VERSION=v0.28.2

#Internal definitions
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SP_APP_SRC=${SCRIPT_DIR}
SP_ROOT=${SP_APP_SRC}/../../../../
OSMID_DIR=${SP_APP_SRC}/../../server/native/linux/osmid

echo "This script has been tested on ubuntu 19.04."
echo "We're working to make this script a one shot solution for all Linux platforms"
echo "Please direct rage and suggestions to Factoid in (https://gitter.im/samaaron/sonic-pi)"

#Install dependencies for building supercollider, as well as qt5 and supporting libraries for gui
sudo apt-get install -y \
     g++ ruby ruby-dev pkg-config git build-essential libjack-jackd2-dev \
     libsndfile1-dev libasound2-dev libavahi-client-dev libicu-dev \
     libreadline6-dev libfftw3-dev libxt-dev libudev-dev cmake libboost-dev \
     libqwt-qt5-dev libqt5svg5-dev qt5-qmake qt5-default \
     qttools5-dev qttools5-dev-tools qtdeclarative5-dev libqt5webkit5-dev \
     qtpositioning5-dev libqt5sensors5-dev qtmultimedia5-dev libffi-dev \
     libqt5opengl5-dev curl python erlang-base libqscintilla2-qt5-dev

### IF YOU HAVE PROBLEMS WITH qwt
#cd $SP_APP_SRC/../../../../
#wget 'http://downloads.sourceforge.net/project/qwt/qwt/6.1.2/qwt-6.1.2.tar.bz2'
#tar -xf qwt-6.1.2.tar.bz2
#cd qwt-6.1.2
#/usr/lib/x86_64-linux-gnu/qt5/bin/qmake qwt.pro
#make
#sudo make install
#sudo cp /usr/local/qwt-6.1.2/features/* /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/

### IF YOU HAVE PROBLEMS WITH qscintilla2
#cd $SP_APP_SRC/../../../../
#wget 'http://sourceforge.net/projects/pyqt/files/QScintilla2/QScintilla-2.9.2/QScintilla_gpl-2.9.2.tar.gz'
#tar -xf QScintilla_gpl-2.9.2.tar.gz
#cd QScintilla_gpl-2.9.2/Qt4Qt5/
#/usr/lib/x86_64-linux-gnu/qt5/bin/qmake qscintilla.pro
#make
#sudo make install

#Build supercollider from source
cd ${SP_ROOT}
git clone https://github.com/supercollider/supercollider.git || true
cd supercollider
git checkout Version-${SUPERCOLLIDER_VERSION}
git submodule init && git submodule update
mkdir -p build
cd build
cmake -DSC_EL=no ..
make
sudo make install
#This should install to /usr/local/

#Build sc3 plugins and install to /usr/local/ so supercollider can find them
cd ${SP_ROOT}
git clone https://github.com/supercollider/sc3-plugins.git || true
cd sc3-plugins
git checkout Version-${SC_PLUGINS_VERSION}
git submodule init && git submodule update
cp -r external_libraries/nova-simd/* source/VBAPUGens
mkdir -p build
cd build
cmake -DSC_PATH=/usr/local/include/SuperCollider -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release ..
make
sudo make install

#Install libaubio (apt-get version is too old)
cd ${SP_ROOT}
git clone https://git.aubio.org/aubio/aubio/ || true
cd aubio
git checkout ${AUBIO_VERSION}
make getwaf
./waf configure
./waf build
sudo ./waf install

#Install osmid (for MIDI support)
cd ${SP_ROOT}
git clone https://github.com/llloret/osmid.git || true
cd osmid
git checkout ${OSMID_VERSION}
mkdir -p build
cd build
cmake ..
make
mkdir -p ${OSMID_DIR}
install m2o o2m -t ${OSMID_DIR}

#Build Erlang files
cd ${SP_APP_SRC}/../../server/erlang
#The current implementation of osc.erl uses Erlang features that require
#at least Erlang 19.1 to be installed. 16.04 LTS is currently at 18.3.
#If versions < 19.1 are installed, and we use the current code, the MIDI
#implementation breaks because the Erlang OSC router is failing.
ERLANG_VERSION=$(./print_erlang_version)
if [ -e "osc.erl.orig" ]; then
    # Handle, if the original file in the source tree ever gets updated.
    rm osc.erl.orig
    git checkout osc.erl
fi
if [[ "${ERLANG_VERSION}" < "19.1" ]]; then
    echo "Found Erlang version < 19.1 (${ERLANG_VERSION})! Updating source code."
    sed -i.orig 's|erlang:system_time(nanosecond)|erlang:system_time(nano_seconds)|' osc.erl
fi
erlc osc.erl
erlc pi_server.erl

# Fix Rugged
cd ${SP_APP_SRC}/../../server/ruby/vendor
if [ ! -d rugged-${RUGGED_VERSION} ]; then
    git clone -b ${RUGGED_VERSION} --recurse-submodules https://github.com/libgit2/rugged.git rugged-${RUGGED_VERSION}
    cd rugged-${RUGGED_VERSION}/vendor/libgit2
    mkdir -p build
    cd build
    cmake ..
fi
cd ${SP_APP_SRC}
sed -i "s/rugged-0.26.0/rugged-${RUGGED_VERSION}/g" ../../server/ruby/bin/compile-extensions.rb

# Fix SonicPi.pro
sed -i "s/-lqt5scintilla2/-lqscintilla2_qt5/g" SonicPi.pro

#Build sonic-pi server extensions, documentation, and binary.
cd ${SP_APP_SRC}
../../server/ruby/bin/compile-extensions.rb
../../server/ruby/bin/i18n-tool.rb -t
cp -f ruby_help.tmpl ruby_help.h
../../server/ruby/bin/qt-doc.rb -o ruby_help.h
lrelease SonicPi.pro
qmake -qt=qt5 SonicPi.pro
make
1 Like

Lovely stuff.

Is there any chance you could make a pull request in the Github repo with these changes?

The changes are quite disco specific, I suggest we introduce a build-ubuntu-disco-app script or do you want to change everything the script changes in place?

Hi @mrvanes

You (the dj) save my life with this song (script)
It works like a charm with the latest verson of Sonic Pi pulled from GitHub. So we can say SonicPi is still working under Linux :slight_smile:

Again thanks !

2 Likes

Thx! The version in this pull request also bumps all dependencies to their latest version, and it still builds and works. https://github.com/samaaron/sonic-pi/pull/2098
Also, if you build 3.1.0 make sure to copy the synthdefs from master because the 3.1.0 versions are broken.

1 Like

Hi everyone, how do i run this script? thanks!

I guess you clone the sonic pi distro from github here onto your Ubuntu box. Then copy the script to the location SOINC-PI/app/gui/qt
where SONIC-PI is the location of your cloned copy. eg ~/home/username/sonic-pi if you have put it in your home folder.
if you call the script ubuntudiscobuild.sh you need to make it excutable using
chmod +x ubuntudiscobuild.sh
you then run it from that location using
./ubuntudiscobuild.sh

All being well you go and have a cup of tea, and wait for it to finish.
You run the compiled program using ~/home/username/sonic-pi/bin/sonic-pi assuming it is in your home folder.

2 Likes

Thanks @robin.newman but i got some problems.

I downloaded the ‘sonic-pi-master.zip’ from the link.
Extract and place the folder in:

/home/chip_luxury/sonic-pi-mastr

Created a new text file name sp3inst and paste the code from @mrvanes post.
I saved the text file as sp3inst.sh and placed it in :

/home/chip_luxury/sonic-pi-master/app/gui/qt

Then opened the qt folder in terminal and run the codes:
chmod +x sp3inst.sh
sudo ./sp3inst.sh

and then got this:

1: from /home/chip_luxury/sonic-pi-master/app/server/ruby/vendor/rugged-0.26.0/lib/rugged.rb:14:in rescue in <top (required)>' /home/chip_luxury/sonic-pi-master/app/server/ruby/vendor/rugged-0.26.0/lib/rugged.rb:14:inrequire_relative’: cannot load such file – /home/chip_luxury/sonic-pi-master/app/server/ruby/rb-native/2.5.0/rugged (LoadError)

@nlb can you be my DJ? please write a step by step of what you did thanks.

ubuntu version:

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 19.04
Release: 19.04
Codename: disco

I tried like 4 times how can i “uninstall” and try again fresh?

The script should never ever have touched rugged-0.26.0, so something must have went wrong replacing the original rugged reference in compile-extensions.rb.
The line responsible for replacing rugged is:
sed -i "s/rugged-0.26.0/rugged-${RUGGED_VERSION}/g" ../../server/ruby/bin/compile-extensions.rb

So, either you don’t have sed on your system (I don’t think so) or the lines has changed in master, so that the string rugged-0.26.0 doesn’t match anymore.

Knowing this, it shouldn’t be too difficult to fix compile-extensions.rb, it should point to rugged-v0.28.2, assuming to kept RUGGED_VERSION at v0.28.2

hi @Chip_luxury_E.W.A

well @robin.newman post is the way to follow and that’s the steps i have done.

I guess you download the zip file. so the name folder you get is different than the one if you use git clone.
So i suggest you to rename your sonic-pi-master into sonic-pi and maybe the paths will be fixed.

hope it helps.

ps : Burn down the disco, Hang the blessed DJ

@nlb thank you but changing the folder name to sonic-pi didn’t help.
@mrvanes what files do I need to edit and how? (linux noob)

@Chip_luxury_E.W.A you really shouldn’t. The script should do all that for you, but it’s hard to tell what went wrong in your case. You might try to start over cloning the sonic-pi repo instead of downloading the zip, that’s what we all did:

$ git clone https://github.com/samaaron/sonic-pi.git
$ cd sonic-pi/app/gui/qt

Get the ubuntu-disco build script, make it executable and start it

$ wget https://raw.githubusercontent.com/samaaron/sonic-pi/5e58c2b44afe535c87fe7246e22b4ec79461c7c9/app/gui/qt/build-ubuntu-disco-app
$ chmod +x build-ubuntu-disco-app
$ ./build-ubuntu-disco-app

Cross your arms and watch it work…

@mrvanes thanks, after fresh install of ubuntu 19.04 it’s look like it install sonic-pi.

I tried to execute (also tried with sonic-pi.sh)
~/home/chip_luxury/sonic-pi/bin/sonic-pi

how do I run sonic-pi now?

cd ~/home/chip_luxury/sonic-pi/bin/
./sonic-pi

@nlb thanks, I manage to execute the commands as you can see at the down-right terminal.
The sonic-pi file run but there is a problem with line 20, I add a list of the folder it trying to get a file from, it does not seems that the file is there, or maybe I have a problem with the folder location?
do I needed to run “sudo apt-get install sonic-pi” after ubuntu installation or something like that?

Well.

First of all do you follow these steps

git clone https://github.com/samaaron/sonic-pi.git
$ cd sonic-pi/app/gui/qt

Get the ubuntu-disco build script, make it executable and start it

Copy Code

$ wget https://raw.githubusercontent.com/samaaron/sonic-pi/5e58c2b44afe535c87fe7246e22b4ec79461c7c9/app/gui/qt/build-ubuntu-disco-app
$ chmod +x build-ubuntu-disco-app
$ ./build-ubuntu-disco-app

?

If yes do you have error messages or not ?

ps : you don’t have to apt get install sonic-pi because the way to install is not via a package but via a script build-ubuntu-disco-app which contains plenty of commands to install pieces of software for sonic-pi to work.

The error you show just tells us the build never completed (there simply is no sonic-pi executable), probably because you’re missing a crucial package that we tinkerers for some reason all have installed. I can’t for the life of me think of what that should be unless you share (pastebin) the complete log of your build process. Would be good to know what’s missing on a vanilla dingo install.

update: You are missing libssl-dev for rugged. Install it like this:

$ sudo apt install libssl-dev

and then rerun the build.

I’ve updated the build script, it’s available from here:
https://raw.githubusercontent.com/samaaron/sonic-pi/8e76a7478dec48debdad1dd0478c8f681d9cf1c9/app/gui/qt/build-ubuntu-disco-app

It now also checks if you have enough memory, because I needed to add 4G to my VM before it succesfully built!

@nlb this is with your code: https://pastebin.com/jM4bxYSJ
@mrvanes this is with copypaste of the script and run it in terminal: https://pastebin.com/YhUh0ER1
thanks!
I can also switch to another version of ubuntu if necessary…

Ok, I have seen that but didn’t know how to solve in the script. It’s ruby and gems and I don’t know what I’m doing there.
It seems for some reason my version of rugged (0.28.2) misses some magic so that the gem doesn’t get installed by the compile-extensions.rb script. You can solve this by hand this way:

$ cd ~/home/chip_luxury/sonic-pi/app/server/ruby/vendor/rugged-v0.28.2/
$ gem build rugged.gemspec
$ sudo gem install rugged

Maybe a ruby guru can look into this and tell me what’s missing after the clone I do to replace rugged?
Maybe the gem build command is all that’s needed, who will tell?

Anyway, after the commands above, the build will finally succeed, I promise :wink: