thanks4opensource/rosegarden-fork

Cannot build on Manjaro with QT 5.15.8

Closed this issue · 7 comments

I am on Manjaro get an error when doing make building the fork by following the same procedure as in Rosegarden original.
QT version is 5.15.8 - detailed output of qtdiag is here: https://gist.github.com/lorenzosu/63a8b8e30409736f2728f6e44e1e87ef
The latest git version of Rosegarden original builds fine.

The error I get is:
MarkerRuler.cpp:546:30: error: aggregate ‘QPainterPath path’ has incomplete type and cannot be defined 546 | QPainterPath path; | ^~~~

Here is a full asciinema run of the build:
https://asciinema.org/a/lTmyAYI8BgNfVueiLEr7cCpbW

Previously, mark_at_yahoo via Rosegarden-user wrote:

I don't think I've used any Qt/C++ APIs beyond those in
official Rosegarden but maybe something snuck in.

Yep ... something "snuck in". :(

Could you try adding:
#include <QPainterPath>
near the similar includes at the top of MarkerRuler.cpp, and
#include "base/ColourMap.h"
and (just in case)
#include <array>
to RosegardenMainViewWidget.cpp?

The Rosegarden codebase in general plays fast and loose with include file dependencies (including "A.h" and implicitly relying on it to in turn include "B.h") and this is a classic example of why that's a bad idea. My MarkerRuler.cpp uses QPainterPath (official Rosegarden doesn't) and my distro's QPainter must be including QPainterPath while yours doesn't. And then I'm using ColourMap.h in RosegardenMainViewWidget.cpp (again not in official) and somehow some other change I've made "nested-includes" that.

Mea culpa. One of the many semi-minor problems in Rosegarden that I haven't attempted to fix.

Thanks for the quick feedback. The additional includes seem to solve that error.
Unfortunately there are further errors. Please see here for the make session: https://asciinema.org/a/570143

More bad news, but I don't shoot messengers. ;)

One thing that worries me is that you seem to be on a much later g++ compiler (12.2.1) than mine. There have been quite a few clones of this repo without reports of these kinds of errors, but it's easily possible that they're either using compatible compilers, giving up without bothering to report their problems, or not trying to build the code in the first place.

Failing anything else you might try going into CMakeLists.txt in the top-level directory and changing the line:
set(CMAKE_CXX_STANDARD 14) # Enable C++14
to "11" (hey, it worked for Nigel Tufnel) or alternately "17". But these are long shots.

First, try using the code in the attached ChordType.txt file to replace the matching class definition in src/base/AnalysisTypes.cpp. I don't see why the existing code there doesn't work (unless it's the g++/CXX_STANDARD issue) but this is an attempt to address what the error messages are complaining about.

I'll keep working with you on this as long as your patience holds out, but it might be worthwhile to wait until I release the upcoming commit of the code , although I'm not sure it will make any difference with these problems.

One more request: I appreciate the asciinema.org captures but they're hard to follow and the animation is unnecessary. In the future can you, if possible, just cut-and-paste into a text file and attach to your reply here, or even paste the code inline and use the "<>"/"Add code, <Ctrl-e>" formatting button if it's not too many lines. Thanks.

Here's the proposed patched code:
ChordType.txt

Unfortunately still not there, tried compiling with the updated class changed and with both flags for C 11 and C 14 and get the attached errors.

rg-fork-err-20230326.txt

OK. Next steps ...

  1. Add #include <array> to the first set of includes (or really anywhere) at the top of the file. It's a long shot, and I don't see how it would even be getting this far if something else isn't including it, but the error:
    /home/lo/src/rosegarden-fork/src/base/AnalysisTypes.cpp: In member function ‘void Rosegarden::ChordAnalyzerImpl::labelChordsOnePerTimePeriod(const NotesAndKeys&, Rosegarden::Segment&, std::map<long int, int>&, Rosegarden::timeT)’: /home/lo/src/rosegarden-fork/src/base/AnalysisTypes.cpp:1092:37: error: variable ‘std::array<int, 12> pitchClasses’ has initializer but incomplete type 1092 | std::array<int, 12> pitchClasses({0});
    is very suspicious.

  2. Rename the attached main.cpp.txt file lto main.cpp (GitHub won't let me upload it with the correct name) and run c++ main.cpp. It's some of the code that is erroring out extracted into a standalone test case. I've run it at godbolt.org with x86-64 gcc all the way up to 12.2 without any errors, so if it fails on your system something else is going wrong. (Are you on an x86-64 CPU? I forgot to ask. If ARM or something else we'll go down that path.)

  3. If it does compile, go back to your Rosegarden build and run make -n (after modifying some source file to force recompilation). Check what compiler and options are being used and then try main.cpp again with the same.

If no joy from the above (or further errors) I'll try to come up with some more desperate ideas.

main.cpp.txt

This took a while to get to due to lack of time.
It seems that actually suggestion 1. solved the build error.
To be more explicit I added:
#include <array

at line 20 of file ./src/base/AnalysisTypes.cpp just before the line

#include <string>

The executable stars and runs fine (just tested starting rosegarden).

Thanks, Lorenzo. Glad it worked out.

Feel free to try the latest commit of the sources. It has the fix for your problem included so hopefully will compile without error. It's also 3 commits past the one we've been discussing. Two of them were minor, but one contains a large number of significant fixes and improvements.

Also, the README.md now has screenshots! I'd been meaning to add them for a long time, but your request over at rosegarden-user finally shamed me into getting around to making them. :)