sonic-pi-net / sonic-pi

Code. Music. Live.
https://sonic-pi.net
Other
10.76k stars 921 forks source link

Cmake Error on Ubuntu 20.04 #3124

Closed bjornandersson closed 2 years ago

bjornandersson commented 2 years ago

Trying to install from source on Ubuntu 20.04 and getting this (partial log)...

Creating build directory...
Generating makefiles...
--  CMakeLists: Sonic Pi
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- TARGET_LINUX
-- System: Linux-5.13.0-52-generic
-- Compiler: GNU
-- Compiler Version: 9.4.0
-- Debug Flags: -g -D_DEBUG -DDEBUG
-- Release Flags: -O3 -DNDEBUG
--  Aubio Builder
-- ERLANG_INCLUDE_PATH: /home/bjorn/.asdf/installs/erlang/25.0.2/erts-13.0.2/include
-- USE_SYSTEM_LIBS: OFF
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- ImGui Interface: ON
--  CMakeLists: Sonic Pi
-- App Root: /home/bjorn/dev/sonic-pi/app
-- Configuring done
CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:573 (_add_executable):
  Target "sonic-pi" links to target "Qt::PrintSupport" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  gui/qt/CMakeLists.txt:203 (add_executable)

CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:573 (_add_executable):
  Target "sonic-pi" links to target "Qt::Widgets" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  gui/qt/CMakeLists.txt:203 (add_executable)

CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:573 (_add_executable):
  Target "sonic-pi" links to target "Qt::OpenGL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  gui/qt/CMakeLists.txt:203 (add_executable)

CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:573 (_add_executable):
  Target "sonic-pi" links to target "Qt::Xml" but the target was not found.
  Perhaps a find_package() call is missing for an IMPORTED target, or an
  ALIAS target is missing?
Call Stack (most recent call first):
  gui/qt/CMakeLists.txt:203 (add_executable)

CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:573 (_add_executable):
  Target "sonic-pi" links to target "Qt::Core" but the target was not found.
  Perhaps a find_package() call is missing for an IMPORTED target, or an
  ALIAS target is missing?
Call Stack (most recent call first):
  gui/qt/CMakeLists.txt:203 (add_executable)

CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:573 (_add_executable):
  Target "sonic-pi" links to target "Qt::Gui" but the target was not found.
  Perhaps a find_package() call is missing for an IMPORTED target, or an
  ALIAS target is missing?
Call Stack (most recent call first):
  gui/qt/CMakeLists.txt:203 (add_executable)

CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:573 (_add_executable):
  Target "sonic-pi" links to target "Qt::Widgets" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  gui/qt/CMakeLists.txt:203 (add_executable)

CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:573 (_add_executable):
  Target "sonic-pi" links to target "Qt::OpenGL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  gui/qt/CMakeLists.txt:203 (add_executable)

CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:573 (_add_executable):
  Target "sonic-pi" links to target "Qt::Concurrent" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  gui/qt/CMakeLists.txt:203 (add_executable)

CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:573 (_add_executable):
  Target "sonic-pi" links to target "Qt::Network" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  gui/qt/CMakeLists.txt:203 (add_executable)

CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:613 (_add_library):
  Target "QScintilla" links to target "Qt::PrintSupport" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?
Call Stack (most recent call first):
  gui/qt/QScintilla_src-2.13.3/CMakeLists.txt:283 (add_library)

CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:613 (_add_library):
  Target "QScintilla" links to target "Qt::Widgets" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  gui/qt/QScintilla_src-2.13.3/CMakeLists.txt:283 (add_library)

CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:613 (_add_library):
  Target "QScintilla" links to target "Qt::OpenGL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  gui/qt/QScintilla_src-2.13.3/CMakeLists.txt:283 (add_library)

CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:613 (_add_library):
  Target "QScintilla" links to target "Qt::Xml" but the target was not found.
  Perhaps a find_package() call is missing for an IMPORTED target, or an
  ALIAS target is missing?
Call Stack (most recent call first):
  gui/qt/QScintilla_src-2.13.3/CMakeLists.txt:283 (add_library)

-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.
lilyinstarlight commented 2 years ago

Hi @bjornandersson!

How did you install Qt; did you use the command at https://github.com/sonic-pi-net/sonic-pi/blob/dev/BUILD-LINUX.md#11-debian to install dependencies?

Also, could you paste the output of this command too?

qmake -query "QT_INSTALL_PREFIX"

Thanks!

aodanne commented 2 years ago

I got the same errors. I did install according to the instructions. anders@thisbe:~/bin/sonic-pi/app$ qmake -query "QT_INSTALL_PREFIX" /usr

But after upgrading to latest cmake from 3.18.4 to 3.23.2 I got fewer errors: Generating makefiles... -- CMakeLists: Sonic Pi -- TARGET_LINUX -- System: Linux-5.13.0-51-generic -- Compiler: GNU -- Compiler Version: 9.4.0 -- Debug Flags: -g -D_DEBUG -DDEBUG -- Release Flags: -O3 -DNDEBUG -- Aubio Builder -- ERLANG_INCLUDE_PATH: /usr/lib/erlang/erts-13.0.2/include -- USE_SYSTEM_LIBS: OFF -- ImGui Interface: ON -- CMakeLists: Sonic Pi -- App Root: /home/anders/bin/sonic-pi/app -- Qtapp Root: /home/anders/bin/sonic-pi/app/gui/qt -- Configuring done CMake Error at gui/qt/CMakeLists.txt:288 (target_link_libraries): Target "sonic-pi" links to:

Qt::Core

but the target was not found. Possible reasons include:

* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.

CMake Error at gui/qt/QScintilla_src-2.13.3/CMakeLists.txt:293 (target_link_libraries): Target "QScintilla" links to:

Qt::PrintSupport

but the target was not found. Possible reasons include:

* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.

-- Generating done CMake Generate step failed. Build files cannot be regenerated correctly.

lilyinstarlight commented 2 years ago

Hmmm, something is suspicious here because it doesn't even seem like CMake is looking for the Qt libs or is finding them but calling them something else, because otherwise there would be an error when looking for them rather than later on.

I imagine it's some Ubuntu incompatibility (they may have renamed the targets so Qt5 and Qt6 dev targets could be used simultaneously idk). I'll see if I can investigate later if someone else doesn't find anything else out before then

lilyinstarlight commented 2 years ago

So the forward-compatible CMake target names weren't added until Qt 5.15 (see https://codereview.qt-project.org/c/qt/qtbase/+/283446) and Ubuntu 20.04 is still on 5.12, so we need to be using Qt5::Core and stuff in CMake rather than Qt::Core and can't be sharing those with Qt6 like we were (not until we decide to drop support for Ubuntu 20.04 at least)

I'll see if I can post a patch in the next few days if no one beats me to it

lilyinstarlight commented 2 years ago

@aodanne or @bjornandersson, could one of you try pulling the latest dev branch and building that to confirm the issue was resolved for you by #3131?

aodanne commented 2 years ago

I built a fresh clone and got further. But I got the QRecursiveMutex error. This is mentioned in issue #3028 but not solved in dev branch.

[ 90%] Automatic RCC for info_files.qrc [ 91%] Building CXX object gui/qt/CMakeFiles/sonic-pi.dir/sonic-pi_autogen/mocs_compilation.cpp.o In file included from /home/anders/bin/sonic-pi/app/build/gui/qt/sonic-pi_autogen/IMAN36LHMA/../../../../../gui/qt/widgets/sonicpieditor.h:19, from /home/anders/bin/sonic-pi/app/build/gui/qt/sonic-pi_autogen/IMAN36LHMA/moc_sonicpieditor.cpp:9, from /home/anders/bin/sonic-pi/app/build/gui/qt/sonic-pi_autogen/mocs_compilation.cpp:10: /home/anders/bin/sonic-pi/app/gui/qt/widgets/sonicpiscintilla.h:21:10: fatal error: QRecursiveMutex: No such file or directory 21 | #include | ^~~~~ compilation terminated. make[2]: [gui/qt/CMakeFiles/sonic-pi.dir/build.make:3562: gui/qt/CMakeFiles/sonic-pi.dir/sonic-pi_autogen/mocs_compilation.cpp.o] Error 1 make[1]: [CMakeFiles/Makefile2:510: gui/qt/CMakeFiles/sonic-pi.dir/all] Error 2 make: *** [Makefile:91: all] Error 2

lilyinstarlight commented 2 years ago

Alright, that issue should be fixed now and hopefully it was the last incompatibility. Can you try one more time on latest dev?

aodanne commented 2 years ago

Finally I can build and run. Thank you very much!

lilyinstarlight commented 2 years ago

Awesome, I'm glad to hear it!