graphia-app / graphia

A visualisation tool for the creation and analysis of graphs
https://graphia.app
231 stars 20 forks source link

RPM packaging #3

Open Enchufa2 opened 4 years ago

Enchufa2 commented 4 years ago

The AppImage gave me the same error as #2, so I decided to start an RPM repository to build Graphia for Fedora. It builds nicely on Fedora rawhide, but fails on Fedora 32 (current release) with the following error:

/builddir/build/BUILD/graphia-2.0/source/thirdparty/qcustomplot/qcustomplot.cpp:8926:76: error: 'class QWheelEvent' has no member named 'position'
 8926 |   scaleRange(factor, pixelToCoord(orientation() == Qt::Horizontal ? event->position().x() : event->position().y()));
      |                                                                            ^~~~~~~~
/builddir/build/BUILD/graphia-2.0/source/thirdparty/qcustomplot/qcustomplot.cpp:8926:100: error: 'class QWheelEvent' has no member named 'position'
 8926 |   scaleRange(factor, pixelToCoord(orientation() == Qt::Horizontal ? event->position().x() : event->position().y()));
      |                                                                                                    ^~~~~~~~
/builddir/build/BUILD/graphia-2.0/source/thirdparty/qcustomplot/qcustomplot.cpp: In member function 'virtual void QCustomPlot::wheelEvent(QWheelEvent*)':
/builddir/build/BUILD/graphia-2.0/source/thirdparty/qcustomplot/qcustomplot.cpp:14946:60: error: 'class QWheelEvent' has no member named 'position'
14946 |   QList<QCPLayerable*> candidates = layerableListAt(event->position(), false);
      |                                                            ^~~~~~~~
/builddir/build/BUILD/graphia-2.0/source/thirdparty/qcustomplot/qcustomplot.cpp: In member function 'virtual void QCPAxisRect::wheelEvent(QWheelEvent*)':
/builddir/build/BUILD/graphia-2.0/source/thirdparty/qcustomplot/qcustomplot.cpp:17909:104: error: 'class QWheelEvent' has no member named 'position'
17909 |             mRangeZoomHorzAxis.at(i)->scaleRange(factor, mRangeZoomHorzAxis.at(i)->pixelToCoord(event->position().x()));
      |                                                                                                        ^~~~~~~~
/builddir/build/BUILD/graphia-2.0/source/thirdparty/qcustomplot/qcustomplot.cpp:17918:104: error: 'class QWheelEvent' has no member named 'position'
17918 |             mRangeZoomVertAxis.at(i)->scaleRange(factor, mRangeZoomVertAxis.at(i)->pixelToCoord(event->position().y()));
      |                                                                                                        ^~~~~~~~

Here's the complete log. Any idea about how to fix this?

Also, if you are interested, I'd be happy to try to bring this package to the official Fedora repositories. But unfortunately it wouldn't be accepted in the current state, because it bundles too many things that are readily available in most distros, and particularly in Fedora. I'm talking about blaze, boost, cryptopp, expat, hdf5, matio, qcustomplot, qtlockedfile, qtsingleapplication, utfcpp, valgrind and zlib at least, in a quick glance.

It would be great if you could add support for cmake to search for those libraries and use the versions in the thirdparty folder only if they are not available system-wide. Of course, you could still force linking against everything under the thirdparty folder for the AppImage build.

Finally, another detail that wouldn't be mandatory for the inclusion in the official Fedora repos, but would be certainly very helpful is the inclusion of some form of documentation in the package.

timangus commented 4 years ago

It looks as though QWheelEvent::position() was added in Qt 5.14, so presumably you're building against an older version. The solution is either to upgrade (I appreciate this may be impossible) or alternatively back out some/all of the changes in 9520b71.

As for packaging for Fedora, that would be cool. I'll maybe look into your suggestions if I get a chance...

Enchufa2 commented 4 years ago

Thanks for considering making those changes. If you find time to look into this, let me know if I can help with testing.

About the error above, you're right, it was building against Qt 5.13. But version 5.14 is in testing, so I enabled the updates-testing repository and now it builds fine in Fedora 32 too.

I found some other issues though. This is my SPEC. I don't know if you are familiar with SPEC files, but TL;DR, /usr/lib (or /usr/local/lib) is not a proper place for unversioned libraries that are private to a specific app, so I decided to change the CMAKE_INSTALL_PREFIX to put everything under /usr/libexec/graphia as follows:

/usr/libexec/graphia/bin/Graphia
/usr/libexec/graphia/bin/CrashReporter
/usr/libexec/graphia/bin/MessageBox
/usr/libexec/graphia/bin/Updater
/usr/libexec/graphia/lib/libthirdparty.so
/usr/libexec/graphia/lib/Graphia/plugins/libcorrelation.so
/usr/libexec/graphia/lib/Graphia/plugins/libgeneric.so
/usr/libexec/graphia/lib/Graphia/plugins/libwebsearch.so

then, I just add a link /usr/bin/graphia pointing to the main executable, and that should do it. The first issue is that graphia's configuration uses this prefix also to install the icons, so we end up with

/usr/libexec/graphia/share/applications/Graphia.desktop
/usr/libexec/graphia/share/icons/hicolor/*/Graphia.png

which is not ok. That should be placed under /usr/share regardless of the prefix. Or you could use other cmake variables to enable more flexibility for the packager.

The second issue is that apparently QtWebView is required? The building process is fine and we don't end up with such a dependency, but still I had to install qt5-qtwebview to make it work. Anyway, this is easy to solve in the SPEC by putting that in Requires.

The third issue happens when I try to run the app (with QtWebView installed):

$ graphia
graphia: error while loading shared libraries: libthirdparty.so: cannot open shared object file: No such file or directory

So I changed the CMAKE_INSTALL_PREFIX and the executable is not able to find libthirdparty.so anymore. That doesn't seem right. If we add its location to the path, I still see two minor error messages and a warning, not sure if they are important:

$ LD_LIBRARY_PATH=/usr/libexec/graphia/lib graphia
QML debugging is enabled. Only use this in a safe environment.
Warning: Setting a new default format with a different version or profile after the global shared context is created may cause issues with context sharing.
Loading plugins from /usr/libexec/graphia/lib/Graphia/plugins
  ...libcorrelation.so (Correlation) loaded successfully
  ...libgeneric.so (Generic) loaded successfully
  ...libwebsearch.so (WebSearch) loaded successfully
Icon theme "gnome" not found.
Icon theme "crystalsvg" not found.

And finally, in the app, if I press Help > Show tutorial, nothing happens. Besides these issues, it runs nicely.

Hope it helps.