Install from sources on ubuntu 18.04.05 - spi3.3dev . Erlang?

Hi,

On this grey sunday, i give a try to install the latest spi version on ubuntu 18.04.05.

i follow this doc : https://github.com/sonic-pi-net/sonic-pi/blob/main/BUILD-LINUX.md

We need to have a erlang version > 21. So how to get this information ?

nlb@devbox:~/audio/spi3.3dev/app/gui/qt$ erl --version
Erlang/OTP 24 [DEVELOPMENT] [erts-11.1] [source-8ef1bc22b9] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [jit]

Eshell V11.1  (abort with ^G)
1> 

So do i have the necessary version of Erlang ? What is the OTP number ?

When executing ./lnux-prebuild.sh --build, I get this error :

./linux-prebuild.sh --build
Warning: Unix build scripts are still a work in progress!
Building server external dependencies...
--  Aubio Builder
-- Configuring done
-- Generating done
-- Build files have been written to: /home/nlb/audio/spi3.3dev/app/gui/qt/external/build
Building sp_midi...
[ 12%] Performing build step for 'sp_midi'
[ 11%] Building CXX object CMakeFiles/libsp_midi.dir/src/sp_midi.cpp.o
In file included from /home/nlb/audio/spi3.3dev/app/gui/qt/external/sp_midi/src/sp_midi.cpp:27:0:
/home/nlb/audio/spi3.3dev/app/gui/qt/external/sp_midi/src/sp_midi.h:3:10: fatal error: erl_nif.h: Aucun fichier ou dossier de ce type
 #include <erl_nif.h>
          ^~~~~~~~~~~
compilation terminated.
CMakeFiles/libsp_midi.dir/build.make:65: recipe for target 'CMakeFiles/libsp_midi.dir/src/sp_midi.cpp.o' failed
make[6]: *** [CMakeFiles/libsp_midi.dir/src/sp_midi.cpp.o] Error 1
CMakeFiles/Makefile2:78: recipe for target 'CMakeFiles/libsp_midi.dir/all' failed
make[5]: *** [CMakeFiles/libsp_midi.dir/all] Error 2
Makefile:86: recipe for target 'all' failed
make[4]: *** [all] Error 2
CMakeFiles/sp_midi.dir/build.make:111: recipe for target 'sp_midi-prefix/src/sp_midi-stamp/sp_midi-build' failed
make[3]: *** [sp_midi-prefix/src/sp_midi-stamp/sp_midi-build] Error 2
CMakeFiles/Makefile2:170: recipe for target 'CMakeFiles/sp_midi.dir/all' failed
make[2]: *** [CMakeFiles/sp_midi.dir/all] Error 2
CMakeFiles/Makefile2:177: recipe for target 'CMakeFiles/sp_midi.dir/rule' failed
make[1]: *** [CMakeFiles/sp_midi.dir/rule] Error 2
Makefile:157: recipe for target 'sp_midi' failed

So if someone has some tips, he / she is welcome !
Cheers

Well try to install Erlang this way : https://tecadmin.net/install-erlang-on-ubuntu/
adding a repo to my ubuntu and then install erlang.

Edit : so now get this

./linux-prebuild.sh --build
Warning: Unix build scripts are still a work in progress!
Building server external dependencies...
--  Aubio Builder
-- Configuring done
-- Generating done
-- Build files have been written to: /home/nlb/audio/spi3.3dev/app/gui/qt/external/build
Building sp_midi...
[ 12%] Performing build step for 'sp_midi'
[ 11%] Building CXX object CMakeFiles/libsp_midi.dir/src/sp_midi.cpp.o
[ 22%] Building CXX object CMakeFiles/libsp_midi.dir/src/midiin.cpp.o
[ 33%] Building CXX object CMakeFiles/libsp_midi.dir/src/midiout.cpp.o
[ 44%] Building CXX object CMakeFiles/libsp_midi.dir/src/midicommon.cpp.o
[ 55%] Building CXX object CMakeFiles/libsp_midi.dir/src/midisendprocessor.cpp.o
[ 66%] Building CXX object CMakeFiles/libsp_midi.dir/src/utils.cpp.o
[ 77%] Building CXX object CMakeFiles/libsp_midi.dir/JuceLibraryCode/include_juce_core.cpp.o
[ 88%] Building CXX object CMakeFiles/libsp_midi.dir/JuceLibraryCode/include_juce_events.cpp.o
[100%] Linking CXX shared library libsp_midi.so
/usr/bin/c++ -fPIC  -std=c++14  -shared -Wl,-soname,libsp_midi.so -o libsp_midi.so CMakeFiles/libsp_midi.dir/src/sp_midi.cpp.o CMakeFiles/libsp_midi.dir/src/midiin.cpp.o CMakeFiles/libsp_midi.dir/src/midiout.cpp.o CMakeFiles/libsp_midi.dir/src/midicommon.cpp.o CMakeFiles/libsp_midi.dir/src/midisendprocessor.cpp.o CMakeFiles/libsp_midi.dir/src/utils.cpp.o CMakeFiles/libsp_midi.dir/JuceLibraryCode/include_juce_core.cpp.o CMakeFiles/libsp_midi.dir/JuceLibraryCode/include_juce_events.cpp.o  -lpthread -lasound -ldl -lrtmidi 
/usr/bin/ld : ne peut trouver -lrtmidi
collect2: error: ld returned 1 exit status
CMakeFiles/libsp_midi.dir/build.make:192: recipe for target 'libsp_midi.so' failed
make[6]: *** [libsp_midi.so] Error 1
CMakeFiles/Makefile2:78: recipe for target 'CMakeFiles/libsp_midi.dir/all' failed
make[5]: *** [CMakeFiles/libsp_midi.dir/all] Error 2
Makefile:86: recipe for target 'all' failed
make[4]: *** [all] Error 2
CMakeFiles/sp_midi.dir/build.make:111: recipe for target 'sp_midi-prefix/src/sp_midi-stamp/sp_midi-build' failed
make[3]: *** [sp_midi-prefix/src/sp_midi-stamp/sp_midi-build] Error 2
CMakeFiles/Makefile2:170: recipe for target 'CMakeFiles/sp_midi.dir/all' failed
make[2]: *** [CMakeFiles/sp_midi.dir/all] Error 2
CMakeFiles/Makefile2:177: recipe for target 'CMakeFiles/sp_midi.dir/rule' failed
make[1]: *** [CMakeFiles/sp_midi.dir/rule] Error 2
Makefile:157: recipe for target 'sp_midi' failed
make: *** [sp_midi] Error 2

an idea ? a way to go ?
Cheers

At present the CMakeLists.txt file in sp_midi is not consistent for building on linux.
There are two solutions. It can be altered to use the included rt-midi code in Sonic Pi, or it can be altered to use librtmidi-dev which you need to install as a package. using sudo apt install librtmidi-dev
In this latter case, you need to look at the CMakeLists.txt lines 26, and 27 in the latest commit to that file commit b02cae1

include_directories( ${PROJECT_SOURCE_DIR}/external_libs/spdlog-0.11.0/include JuceLibraryCode JuceLibraryCode/modules ${PROJECT_SOURCE_DIR}/external_libs/cxxopts ${PROJECT_SOURCE_DIR}/external_libs)
#include_directories(${PROJECT_SOURCE_DIR}/external_libs/spdlog-0.11.0/include JuceLibraryCode JuceLibraryCode/modules ${PROJECT_SOURCE_DIR}/external_libs/cxxopts)

Simply swap the comment around, ie comment the first line and uncomment the second. Also install the librtmidi-dev package.
That will give a file that will build on linux but NOT on Mac or Windows.
There is a fuller solution that adds extra code and switches to build all versions from internal code within Sonic Pi.
There are pr’s submitted for this, but there are still problems with the operation of sp_midi on linux builds. You will find that midi works, but crashes whenever you add or remove midi sources, after generating a huge number of midi ports. A solution is being investigated.
For the moment you run the line
@mod_sound_studio.reset_erlang
which will restart the system.
I have not built a .deb for 3.3dev on linux yet for this reason.

Oh my god !

image

Thanks a lot @robin.newman for these explanations and so it works !!
what i did including the change on line 26 / 27 as you mentionned.

 cd spi3.3dev/
 2009  cd app/gui/qt/
 2010  sudo apt install librtmidi-dev
 2011  nano external/sp_midi/CMakeLists.txt 
 2012  vim external/sp_midi/CMakeLists.txt 
 2013  chmod u+x linux-prebuild.sh linux-config.sh 
 2014  ./linux-prebuild.sh --build-aubio
 2015  cd ..
 2016  cd bin/
 2017  ./sonic-pi
 2018  cd ..
 2019  cd app/gui/qt/
 2020  ./linux-config.sh 
 2021  cd build/
 2022  cmake --build
 2023  cmake --build .
 2024  cd ..
 2025  ./bin/sonic-pi

Ok so i gonna test midi without removing midi devices.
By the way, i don’t understand your sentence. Where do i have to execute that command if i meet trouble ?

Again thanks !

well the midi path seems to be a bit long…
image

may i open an issue on github or the issue is known ?
I do understand this is a wip version.

the midi in and out are quite weird.

you run it from Sonic Pi in a buffer.

EDIT
yes the midi port-names are a bit weird. I have raised this already, on the core group. One thing that helps is that use_midi_defaults port: autocompletes available ports, so it can save you some typing.

Do try plugging in a midi device and see what happens. then run the
@mod_sound_studio.reset_erlang from a buffer to get it going again. Takes a few seconds.

1 Like