Dev branch on ubuntu LTS 20.04.02

Hello les linuxiens !

Back to work to try to install the dev branch on a ubuntu 20.04.02 LTS.
so i gitclone (lovely verb isn’t it :-)) GitHub - sonic-pi-net/sonic-pi at dev
Then follow these instructions sonic-pi/BUILD-LINUX.md at dev · sonic-pi-net/sonic-pi · GitHub
and it fails.
i can copy paste the whole output if you want but here is a part

[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  -lpthread -lasound -ldl -lrtmidi 
[100%] Built target libsp_midi
[ 98%] No install step for 'sp_midi'
[100%] Completed 'sp_midi'
[100%] Built target sp_midi
Compiling native ruby extensions...
Clearing /home/nlb/audio/spi_dev/app/server/ruby/bin/../rb-native/2.7.0
Creating /home/nlb/audio/spi_dev/app/server/ruby/bin/../rb-native/2.7.0
Compiling native extension in /home/nlb/audio/spi_dev/app/server/ruby/vendor/rugged-0.28.4.1/ext/rugged
rugged.c: In function ‘rb_git_minimize_oid’:
rugged.c:292:31: warning: passing argument 3 of ‘rb_iterate’ from incompatible pointer type [-Wincompatible-pointer-types]
  292 |  rb_iterate(rb_each, rb_enum, &minimize_cb, (VALUE)shrt);
      |                               ^~~~~~~~~~~~
      |                               |
      |                               VALUE (*)(VALUE,  git_oid_shorten *) {aka long unsigned int (*)(long unsigned int,  struct git_oid_shorten *)}
In file included from /usr/include/ruby-2.7.0/ruby.h:33,
                 from rugged.h:16,
                 from rugged.c:8:
/usr/include/ruby-2.7.0/ruby/ruby.h:1984:40: note: expected ‘rb_block_call_func_t’ {aka ‘long unsigned int (*)(long unsigned int,  long unsigned int,  int,  const long unsigned int *, long unsigned int)’} but argument is of type ‘VALUE (*)(VALUE,  git_oid_shorten *)’ {aka ‘long unsigned int (*)(long unsigned int,  struct git_oid_shorten *)’}
 1984 | VALUE rb_iterate(VALUE(*)(VALUE),VALUE,rb_block_call_func_t,VALUE);
      |                                        ^~~~~~~~~~~~~~~~~~~~
rugged.c:304:32: warning: passing argument 3 of ‘rb_iterate’ from incompatible pointer type [-Wincompatible-pointer-types]
  304 |   rb_iterate(rb_each, rb_enum, &minimize_yield, (VALUE)yield_data);
      |                                ^~~~~~~~~~~~~~~
      |                                |
      |                                VALUE (*)(VALUE,  VALUE *) {aka long unsigned int (*)(long unsigned int,  long unsigned int *)}
In file included from /usr/include/ruby-2.7.0/ruby.h:33,
                 from rugged.h:16,
                 from rugged.c:8:
/usr/include/ruby-2.7.0/ruby/ruby.h:1984:40: note: expected ‘rb_block_call_func_t’ {aka ‘long unsigned int (*)(long unsigned int,  long unsigned int,  int,  const long unsigned int *, long unsigned int)’} but argument is of type ‘VALUE (*)(VALUE,  VALUE *)’ {aka ‘long unsigned int (*)(long unsigned int,  long unsigned int *)’}
 1984 | VALUE rb_iterate(VALUE(*)(VALUE),VALUE,rb_block_call_func_t,VALUE);
      |                                        ^~~~~~~~~~~~~~~~~~~~
Copying /home/nlb/audio/spi_dev/app/server/ruby/vendor/rugged-0.28.4.1/ext/rugged/rugged.so to /home/nlb/audio/spi_dev/app/server/ruby/bin/../rb-native/2.7.0/
Compiling native extension in /home/nlb/audio/spi_dev/app/server/ruby/vendor/ffi-1.11.3/ext/ffi_c
Function.c: In function ‘callback_prep’:
Function.c:867:5: warning: ‘ffi_prep_closure’ is deprecated: use ffi_prep_closure_loc instead [-Wdeprecated-declarations]
  867 |     ffiStatus = ffi_prep_closure(code, &fnInfo->ffi_cif, callback_invoke, closure);
      |     ^~~~~~~~~

So if you have an idea, you’re welcome !
Cheers

That snippet just shows a few warnings - would probably help to see the whole thing (or starting from the first sign of error at least) :slight_smile:

hi @ethancrawford

thanks for your answer !

Scanning dependencies of target sonic-pi
[ 87%] Building CXX object gui/qt/CMakeFiles/sonic-pi.dir/sonic-pi_autogen/mocs_compilation.cpp.o
[ 88%] Building CXX object gui/qt/CMakeFiles/sonic-pi.dir/widgets/infowidget.cpp.o
[ 88%] Building CXX object gui/qt/CMakeFiles/sonic-pi.dir/widgets/settingswidget.cpp.o
[ 89%] Building CXX object gui/qt/CMakeFiles/sonic-pi.dir/mainwindow.cpp.o
/home/nlb/audio/spi_dev/app/gui/qt/mainwindow.cpp: In member function ‘void MainWindow::createToolBar()’:
/home/nlb/audio/spi_dev/app/gui/qt/mainwindow.cpp:2919:22: error: ‘class QActionGroup’ has no member named ‘setExclusionPolicy’
 2919 |     langActionGroup->setExclusionPolicy(QActionGroup::ExclusionPolicy::Exclusive);
      |                      ^~~~~~~~~~~~~~~~~~
/home/nlb/audio/spi_dev/app/gui/qt/mainwindow.cpp:2919:55: error: ‘QActionGroup::ExclusionPolicy’ has not been declared
 2919 |     langActionGroup->setExclusionPolicy(QActionGroup::ExclusionPolicy::Exclusive);
      |                                                       ^~~~~~~~~~~~~~~
make[2]: *** [gui/qt/CMakeFiles/sonic-pi.dir/build.make:3468 : gui/qt/CMakeFiles/sonic-pi.dir/mainwindow.cpp.o] Erreur 1
make[1]: *** [CMakeFiles/Makefile2:253 : gui/qt/CMakeFiles/sonic-pi.dir/all] Erreur 2
make: *** [Makefile:84 : all] Erreur 2

does it help ?

It looks like the QActionGroup::ExclusionPolicy enum wasn’t added until Qt 5.14 but Ubuntu 20.04 only has Qt 5.12 (Qt 5.14 is available in Ubuntu only since 20.10)

1 Like

QActionGroup::setExclusive seems to do the same thing the code requires on Qt 5.12, so applying this patch would probably allow it to build on older Qt versions. I can PR this if the core dev team would like, but I haven’t tested it:

diff --git a/app/gui/qt/mainwindow.cpp b/app/gui/qt/mainwindow.cpp
index 2f8a09dc5..22583c0a4 100644
--- a/app/gui/qt/mainwindow.cpp
+++ b/app/gui/qt/mainwindow.cpp
@@ -2916,7 +2916,11 @@ void MainWindow::createToolBar()
     QStringList available_languages = sonicPii18n->getAvailableLanguages();
 
     langActionGroup = new QActionGroup(this);
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
     langActionGroup->setExclusionPolicy(QActionGroup::ExclusionPolicy::Exclusive);
+#else
+    langActionGroup->setExclusive(true);
+#endif
 
     QSignalMapper *signalMapper = new QSignalMapper(this);

hi @lilyinstarlight

thanks ! hum how to apply this “patch” ? once i have changed these lines which command lines do i have to execute ? do i have to execute these two commands ?

./linux-prebuild.sh
./linux-config.sh

i’m not confortable with this process of make etc…
Cheers

Yeah! So if you add those three lines where indicated in the patch file, you should just have to run cmake --build . --config Release again from the build directory, no need to reconfigure

i got bad news…

nlb@nlb-ESPRIMO-P2560:~/audio/spi_dev/app/gui/qt$ vim mainwindow.cpp 
nlb@nlb-ESPRIMO-P2560:~/audio/spi_dev/app/gui/qt$ cd ..
nlb@nlb-ESPRIMO-P2560:~/audio/spi_dev/app/gui$ cd ..
nlb@nlb-ESPRIMO-P2560:~/audio/spi_dev/app$ cd build/
nlb@nlb-ESPRIMO-P2560:~/audio/spi_dev/app/build$ cmake --build . --config Release
[  4%] Built target sonic-pi-api
[  5%] Built target api-tests
[  6%] Automatic MOC for target QScintilla
[  6%] Built target QScintilla_autogen
[ 85%] Built target QScintilla
[ 86%] Automatic MOC for target sonic-pi
[ 86%] Built target sonic-pi_autogen
[ 87%] Building CXX object gui/qt/CMakeFiles/sonic-pi.dir/mainwindow.cpp.o
/home/nlb/audio/spi_dev/app/gui/qt/mainwindow.cpp: In member function ‘void MainWindow::createToolBar()’:
/home/nlb/audio/spi_dev/app/gui/qt/mainwindow.cpp:2921:23: error: ‘class QActionGroup’ has no member named ‘setExclusionPolicy’
 2921 |      langActionGroup->setExclusionPolicy(QActionGroup::ExclusionPolicy::Exclusive);
      |                       ^~~~~~~~~~~~~~~~~~
/home/nlb/audio/spi_dev/app/gui/qt/mainwindow.cpp:2921:56: error: ‘QActionGroup::ExclusionPolicy’ has not been declared
 2921 |      langActionGroup->setExclusionPolicy(QActionGroup::ExclusionPolicy::Exclusive);
      |                                                        ^~~~~~~~~~~~~~~
/home/nlb/audio/spi_dev/app/gui/qt/mainwindow.cpp:2924:1: error: ‘endif’ was not declared in this scope
 2924 | endif
      | ^~~~~
make[2]: *** [gui/qt/CMakeFiles/sonic-pi.dir/build.make:3468 : gui/qt/CMakeFiles/sonic-pi.dir/mainwindow.cpp.o] Erreur 1
make[1]: *** [CMakeFiles/Makefile2:253 : gui/qt/CMakeFiles/sonic-pi.dir/all] Erreur 2
make: *** [Makefile:84 : all] Erreur 2

The # is required before the #if, #else, and #endif. If you want to apply the patch automatically, I just uploaded it where it is easy to use the patch tool like this:

cd /home/nlb/audio/spi_dev/app      # go to the app directory
git checkout gui/qt/mainwindow.cpp  # reset the changes you made
# apply the patch file
# (-p2 means ignore two directory levels, an artifact of how I made the patch)
curl -s https://tmp.lily.flowers/spi-qt-512-patch | patch -p2 
cd build
cmake --build . --config Release    # retry the build

Does that help?

ah ok !

i got good news :slight_smile:

So you find the solution ! thanks for your help. And yes it should be add to the dev branch !
Cheers

1 Like

Awesome! I’ll make sure there’s no regression on Qt >=5.14 for me using the patch, and then I will make a PR when I get a chance so it can be added to the repo

5 Likes

Good solution. It would be great get it building on earlier qt version than qt14. Otherwise limited to latest Ubuntu and Debian and next version of RPI is when released.

hi @robin.newman

so which version would you advice to install ? can we go ahead with the latest qt 6 ? or stay on qt5 branch ?

I’ve opened GUI: fix building with Qt5 before 5.14 by lilyinstarlight · Pull Request #2832 · sonic-pi-net/sonic-pi · GitHub to merge the change into the dev branch!

1 Like

Oops I meant qt5.14. Not qt14!! Sp is not built with qt6 at all at present.