Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building v4.5.0 on Linux #3353

Open
siiky opened this issue Nov 6, 2023 · 7 comments
Open

Building v4.5.0 on Linux #3353

siiky opened this issue Nov 6, 2023 · 7 comments

Comments

@siiky
Copy link

siiky commented Nov 6, 2023

Related to #3344. microsoft/vcpkg#34709 has been fixed but there's no fixed release yet -- I'll keep an eye for it. Will leave this issue open as a reminder.


As a sort of update: I managed to build Sonic Pi in a Debian testing PC with the following: VCPKG_BRANCH=master ./linux-build-all.sh

It's not there yet, however. When I run ./build/gui/qt/sonic-pi the window is not rendered correctly, and I get the following in the terminal:

Starting Sonic Pi...
                                ╘
                         ─       ╛▒╛
                          ▐╫       ▄█├
                   ─╟╛      █▄      ╪▓▀
         ╓┤┤┤┤┤┤┤┤┤  ╩▌      ██      ▀▓▌
          ▐▒   ╬▒     ╟▓╘    ─▓█      ▓▓├
          ▒╫   ▒╪      ▓█     ▓▓─     ▓▓▄
         ╒▒─  │▒       ▓█     ▓▓     ─▓▓─
         ╬▒   ▄▒ ╒    ╪▓═    ╬▓╬     ▌▓▄
         ╥╒   ╦╥     ╕█╒    ╙▓▐     ▄▓╫
                    ▐╩     ▒▒      ▀▀
                         ╒╪      ▐▄

       _____             __        ____  __
      / ___/____  ____  /_/____   / __ \/_/
      \__ \/ __ \/ __ \/ / ___/  / /_/ / /
     ___/ / /_/ / / / / / /__   / ____/ /
    /____/\____/_/ /_/_/\___/  /_/   /_/

   The Live Coding Music Synth for Everyone

            http://sonic-pi.net

sh: 1: pw-jack: not found
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ERROR SuperCollider:in_1 not a valid port
ERROR SuperCollider:in_2 not a valid port
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QOpenGLWidget: Failed to create context
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QOpenGLWidget: Failed to create context
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QOpenGLWidget: Failed to create context
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QOpenGLWidget: Failed to create context
QPainter::begin: Paint device returned engine == 0, type: 1
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
qt.qpa.backingstore: composeAndFlush: QOpenGLContext creation failed
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed

 8< -------------------------------------------------

QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
[API] [INFO ] : API deconstructor initiating shutdown...
[API] [INFO ] : Initiating shutdown...
[API] [INFO ] : Shutdown already initiated...
QXcbIntegration: Cannot create platform offscreen surface, neither GLX nor EGL are enabled

I'll continue investigating this. Hopefully just a few missing dependencies and/or incorrect environment variables.

@siiky
Copy link
Author

siiky commented Nov 6, 2023

Installed pipewire-jack (for pw-jack) and it goes just a little bit further. A window titled "Audio Server Boot Error" appears saying "Sorry, the Audio Server failed to start..." etc.

SuperCollider Log:

Found 0 LADSPA plugins
could not initialize audio.
terminate called without an active exception

Output is:

Starting Sonic Pi...
                                ╘
                         ─       ╛▒╛
                          ▐╫       ▄█├
                   ─╟╛      █▄      ╪▓▀
         ╓┤┤┤┤┤┤┤┤┤  ╩▌      ██      ▀▓▌
          ▐▒   ╬▒     ╟▓╘    ─▓█      ▓▓├
          ▒╫   ▒╪      ▓█     ▓▓─     ▓▓▄
         ╒▒─  │▒       ▓█     ▓▓     ─▓▓─
         ╬▒   ▄▒ ╒    ╪▓═    ╬▓╬     ▌▓▄
         ╥╒   ╦╥     ╕█╒    ╙▓▐     ▄▓╫
                    ▐╩     ▒▒      ▀▀
                         ╒╪      ▐▄

       _____             __        ____  __
      / ___/____  ____  /_/____   / __ \/_/
      \__ \/ __ \/ __ \/ / ___/  / /_/ / /
     ___/ / /_/ / / / / / /__   / ____/ /
    /____/\____/_/ /_/_/\___/  /_/   /_/

   The Live Coding Music Synth for Everyone

            http://sonic-pi.net

Error. Unable to write to log file: closed stream
#<IOError: closed stream>
QLayout: Attempting to add QLayout "" to MainWindow "", which already has a layout

Guess I have to learn how to configure sound stuffs now.

@rbnpi
Copy link
Contributor

rbnpi commented Nov 7, 2023

The latest source code calls the code in pw-jack directly so you don't need to use it explicitly but you do need to have it installed. Have a look at the build instructions for raspberry pi. They include running the pi_setup.sh script which install all the dependencies necessary to build using pipewire and wayland on Raspberry Pi. Linux should be very similar, but I don't think the build instructions have been updated yet. As of version 4.5 all linux 4.5 source code will expect pipewire environment. The biggest changes are in the daemon.rb file which is in sonic-pi/app/server/bin/

It certainly works on Debian bookworm. I had that running before we finalised Raspberry Pi.
There is also an environmental variable QT_INSTALL_LOCATION which is set in pi_build-gui.sh It will be needed on the linux build if using qt6. I think from memory the value was /usr/lib/qt6 for a Pi.

It is worth looking at the full log files in .sonic-pi/log if things go wrong. Expecially the daemon.log the scsynth.log but others also.

@fabianloebel
Copy link

This saved my week!

Be sure to check out the stable branch, and build with environment variable VCPKG_BRANCH=master.

$> VCPKG_BRANCH=master ./linux-build-all.sh

@siiky
Copy link
Author

siiky commented Nov 30, 2023

New version of vcpkg: https://github.com/microsoft/vcpkg/releases/tag/2023.11.20

Can you update again @samaaron ? :)

@petergloor
Copy link

There is a new version of vcpkg: (https://github.com/microsoft/vcpkg/releases/tag/2023.12.12

@samaaron: This resolves an issue where ./linux-build-all.sh on Ubuntu 23.10 fails with an error: building reproc:x64-linux failed with: BUILD_FAILED (details in issue.txt attached).

The issue went away after I changed the VCPKG_BRANCH date from 2023.10.19 to its most current version of 2023.12.12 around line 32 in sonic-pi/app/linux-pre-vcpkg.sh and removed the sonic-pi/app/lvcpkg directore before running the build script again.

issue.txt

@karlsson
Copy link
Contributor

karlsson commented Feb 9, 2024

I was able to compile on Ubuntu 22.0.4 LTS (jammy) after adding some packages.
sudo apt install qt6-l10n-tools gcc-12
qt6-l10n-tools was required to get lconvert etc.
gcc-12 was required to build vendor package in rugged in app/server/ruby/vendor/rugged-1.7.1/vendor/libgit2. (22.0.4 has gcc-11 as default)

Also:
22.0.4 do not have qpwgraph precompiled package, at least not mine.

Install dependency
sudo apt install libpipewire-0.3-dev
Download from github: https://github.com/rncbc/qpwgraph
git clone https://github.com/rncbc/qpwgraph.git
Build with cmake according to instructions in README.md
cmake -B build
cmake --build build

Using qpwgraph I was able to direct sound to HDMI (screen connected speakers) and bluetooth devices on top of default computer audio.

To check what is going on with sonic-pi, actually Supercollider scsynth, and pipewire one can use the command pw-top. One should see "*Supercollider" in the listing when sonic-pi is started.

I also recommend to install wireplumber as it seems to detect and connect to paired bluetooth devices when they are activated:
sudo apt install wireplumber

🙂

@idommason
Copy link

idommason commented Mar 30, 2024

I've written a lengthy article about installing Sonic Pi v4.50 in Linux Mint 21.3 Virginia, which has a few significant differences from the build for Debian 12, a few packages that are required and have different names, and how to get Elixir 1.14 and qpwgraph, and issues with pipewire, and turning off pulseaudio so that pipewire becomes your default audio

Added below, sorry it's a bit long winded, but it is gives all the reasons and how to pre-avoid the pitfalls from the start, rather than fix them as they crop up. So here goes:

Building Sonic Pi v4.50 on Linux Mint

These ideas for building Sonic Pi v4.50 work on Linux Mint 21.3 Virginia

There are a few differences and difficulties you will find if you try to follow the instructions for building on Debian Bookworm

https://github.com/sonic-pi-net/sonic-pi/blob/dev/BUILD-LINUX.md

Firstly there are some packages on that page that do not exist in Linux Mint, namely

qpwgraph
pipewire-jack

You will also need to install a later version of Elixir as v4.50 needs Eixir 1.14, not 1.12. And you need to fix a couple of problems to switch over to using Qt6 and fix a missing Qt6 program that is no longer there by default.

This Qt6 missing package is qt6-l10n-tools which adds lconvert

And the biggest problem I found was swapping my sound input and output to Pipepwire, but more of that later.

So let us fix some of those problems in advance before we even start building Sonic Pi

Lets do the major, modified, apt get first, including that qt6-l10n-tools and also wireplumber - installing this latter program at the start might fix all the issues I had getting sound out of Sonic Pi with Pipewire.

$ sudo apt-get install -y build-essential git libssl-dev ruby-dev erlang-dev erlang-xmerl qt6-tools-dev qt6-tools-dev-tools libqt6svg6-dev libqt6opengl6-dev supercollider-server sc3-plugins-server alsa-utils libasound2-dev cmake ninja-build libspa-0.2-jack qt6-wayland libwayland-dev libxkbcommon-dev libegl1-mesa-dev libx11-dev libxft-dev libxext-dev qt5-qmake compton wireplumber qt6-l10n-tools libspa-0.2-bluetooth

This will ask if you wish to enable Realtime (RT) in your kernel, you should answer yes

This will add /etc/security/limits.d/audio.conf

You need to edit that file and uncomment the final line so that it reads:

@Audio - rtprio 95
@Audio - memlock unlimited
@Audio - nice -19

You also need to add your user to the audio group, although you might already be in that group if you have a more mature system...

sudo usermod -aG audio $USER

At this point, you have to logout to make yourself a member of the group, but a reboot is probably best, as that will also give you all the Realtime benefits - you do at least need to logout / close all sessions so why not reboot?

Now let's use Elixir's own PPA repositories to get Elixir 1.14

See https://elixir-lang.org/install.html

sudo add-apt-repository ppa:rabbitmq/rabbitmq-erlang
sudo apt update
sudo apt install elixir erlang-dev erlang-xmerl

You also need to make sure you are using the Qt6 qmake

This involves using qtchooser

$ sudo qtchooser -install qmake6 /usr/lib/qt6/bin/qmake
$ sudo qtchooser -install qt6 /usr/lib/qt6/bin/qmake

Then use qtchooser to list versions

$ qtchooser --list-versions

and you should see

4
5
default
qmake
qmake6
qt4-x86_64-linux-gnu
qt4
qt5-x86_64-linux-gnu
qt5
qt6

$ qmake6 --version
QMake version 3.1
Using Qt version 6.2.4 in /usr/lib/x86_64-linux-gnu

Lets sort out qpwgraph now. I had to install this via a flatpak, otherwise you run into dependency issues if you search for the various .deb. packages that are available for Debian Bookworm or Ubuntu

$ sudo flatpak install flathub org.rncbc.qpwgraph

This will run it, but you will find it in your Mutimedia menu as qpwgraph

$ flatpak run org.rncbc.qpwgraph

(This runs it from the command line, it will be in your Multimedia menu by now, though)

I don't think qpwgraph is necessary for the actual build, but it is useful if you have sound problems with Pipewire after the successful build.

So that's all the prep and fixes to the issues that will crop up if you just follow the instructions for building on Debian Bookworm on the sonic Pi GitHub site

So lets do the git clone, now

git clone https://github.com/sonic-pi-net/sonic-pi.git ~/Development/sonic-pi

cd ~/Development/sonic-pi/app

and to build, now we've fixed all the potential problems

Run the linux-build-all.sh script

./linux-build-all.sh

This could take a 10 or more minutes, it also downloads extras it requires for the build, so you do need internet access to do the build

It should complete without error, if you follow the guide above

To run Sonic Pi, you can run

~/Development/sonic-pi/bin/sonic-pi

However what I found was that I had no sound output, but I could record and play back

So this is where you run into Pipewire vs Pulseaudio

I found that I had to disable pulseaudio and make sure that pipewire (especially pipewire-media-session.service) was running

pulseaudio runs as a user session, so to disable it:

systemctl --user disable pulseaudio pulseaudio.socket

and then enable the pipewire-media session:

systemctl --user enable pipewire-media-session.service

Then I rebooted

In a VirtualBox VM running LinuxMint I found I had to install the libspa-0.2-bluetooth package as it was not there by default on a "Virtual" VM, so the pipewire-media-session was not running. I've included this in the big apt-get at the start of this guide.

(edited to correct some bad typing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants