GillesDebunne / libQGLViewer

libQGLViewer is an open source C++ library based on Qt that eases the creation of OpenGL 3D viewers.
Other
245 stars 94 forks source link

Support coexisting Qt4 and Qt5 installs #18

Closed bo0ts closed 8 years ago

bo0ts commented 9 years ago

I have a bunch of projects which require both: a libqglviewer build against Qt4 and one build against Qt5.

Building different version of QGLViewer is easy enough, but installing them on the same system will conflict. A nice feature would be to suffix the library built against Qt5 with qt5 (e.g. libqglviewer-qt5.so) and install include files in include/QGLViewer5/.

GillesDebunne commented 9 years ago

True.

But is there a standard for this ? I would not want to make the standard user process more complex, especially since it can easily be done on your side by editing a couple of lines in the .pro before you build.

Do you use other libraries that do the same? Is it standard?

Gilles

On Wed, Jul 22, 2015 at 12:05 PM, Philipp Moeller notifications@github.com wrote:

I have a bunch of projects which require both: a libqglviewer build against Qt4 and one build against Qt5.

Building different version of QGLViewer is easy enough, but installing them on the same system will conflict. A nice feature would be to suffix the library built against Qt5 with qt5 (e.g. libqglviewer-qt5.so) and install include files in include/QGLViewer5/.

— Reply to this email directly or view it on GitHub https://github.com/GillesDebunne/libQGLViewer/issues/18.

bo0ts commented 9 years ago

I don't think this change would require user interaction. The pro files simply need to detect if they are being used with qt4 or qt5 and change the output name/install location accordingly. I'm not familiar with the Qt build system, but this doesn't sound like something that it should do.

I would leave locations and library names as is for Qt4 and just add the suffix for Qt5 and other Qt versions to come.

Unfortunately I do not know if this is a standard anywhere. Making the changes of the pro files on my side would be quite hacky especially in automated deployment procedures.

lrineau commented 8 years ago

I agree with @bo0ts.

As for the headers, QGLViewer headers have a nice feature: they are the same for the Qt4 and Qt5 version. There is no need for a special treatment of headers.

But as for the library name and SONAME, I have that the two variants (Qt4 and Qt5) should have different names:

There is no standard, but common practice. On my Linux Fedora 23 machine, I can see several libraries using the -qt4 and -qt5 infixes:

renoir ~ $ ls /usr/lib64/lib*qt5*.so*(.) -1
/usr/lib64/libaccounts-qt5.so.1.2.0
/usr/lib64/libdbusmenu-qt5.so.2.6.0
/usr/lib64/libmarblewidget-qt5.so.0.22.20
/usr/lib64/libpackagekitqt5.so.0.9.5
/usr/lib64/libphonon4qt5experimental.so.4.9.0
/usr/lib64/libphonon4qt5.so.4.9.0
/usr/lib64/libpolkit-qt5-agent-1.so.1.112.0
/usr/lib64/libpolkit-qt5-core-1.so.1.112.0
/usr/lib64/libpolkit-qt5-gui-1.so.1.112.0
/usr/lib64/libpoppler-qt5.so.1.3.0
/usr/lib64/libqca-qt5.so.2.1.1
/usr/lib64/libQGLViewer-qt5.so.2.6.3
/usr/lib64/libsignon-qt5.so.1.0.0
/usr/lib64/libtelepathy-qt5.so.0.0.9.6.1
renoir ~ $ ls /usr/lib64/lib*qt4*.so*(.) -1
/usr/lib64/libpackagekitqt4.so.0.9.5
/usr/lib64/libpoppler-qt4.so.4.6.0
/usr/lib64/libqjdns-qt4.so.2.0.3
/usr/lib64/libsource-highlight-qt4.so.3.1.0
/usr/lib64/libtelepathy-qt4-farstream.so.2.0.9.6.1
/usr/lib64/libtelepathy-qt4.so.2.0.9.6.1

You can also see that the libQGLViewer shipped in Fedora has been patch, to add the -qt5 suffix when the library uses Qt5, because Fedora also ships the same version of libQGLViewer but compiled with Qt4.

GillesDebunne commented 8 years ago

If this is standard practice and if it helps the packaging, I'd be more than happy to make these changes in the .pro.

In that list, is there a library that does it especially "right", so that I do the same? (Would it be -qt4 and -qt5 or should I omit one of these, would this be the default or is it triggered by a qmake option).

Thanks Gilles

On Tue, Jul 12, 2016 at 12:05 PM, Laurent Rineau notifications@github.com wrote:

I agree with @bo0ts https://github.com/bo0ts.

As for the headers, QGLViewer headers have a nice feature: they are the same for the Qt4 and Qt5 version. There is no need for a special treatment of headers.

But as for the library name and SONAME, I have that the two variants (Qt4 and Qt5) should have different names:

  • libQGLViewer-qt4.so
  • libQGLViewer-qt5.so because they have different binary interfaces (they cannot be exchanged without inducing a segmentation fault of all programs using them).

There is no standard, but common practice. On my Linux Fedora 23 machine, I can see several libraries using the -qt4 and -qt5 infixes:

renoir ~ $ ls /usr/lib64/libqt5.so_(.) -1 /usr/lib64/libaccounts-qt5.so.1.2.0 /usr/lib64/libdbusmenu-qt5.so.2.6.0 /usr/lib64/libmarblewidget-qt5.so.0.22.20 /usr/lib64/libpackagekitqt5.so.0.9.5 /usr/lib64/libphonon4qt5experimental.so.4.9.0 /usr/lib64/libphonon4qt5.so.4.9.0 /usr/lib64/libpolkit-qt5-agent-1.so.1.112.0 /usr/lib64/libpolkit-qt5-core-1.so.1.112.0 /usr/lib64/libpolkit-qt5-gui-1.so.1.112.0 /usr/lib64/libpoppler-qt5.so.1.3.0 /usr/lib64/libqca-qt5.so.2.1.1 /usr/lib64/libQGLViewer-qt5.so.2.6.3 /usr/lib64/libsignon-qt5.so.1.0.0 /usr/lib64/libtelepathy-qt5.so.0.0.9.6.1 renoir ~ $ ls /usr/lib64/libqt4.so_(.) -1 /usr/lib64/libpackagekitqt4.so.0.9.5 /usr/lib64/libpoppler-qt4.so.4.6.0 /usr/lib64/libqjdns-qt4.so.2.0.3 /usr/lib64/libsource-highlight-qt4.so.3.1.0 /usr/lib64/libtelepathy-qt4-farstream.so.2.0.9.6.1 /usr/lib64/libtelepathy-qt4.so.2.0.9.6.1

You can also see that the libQGLViewer shipped in Fedora has been patch, to add the -qt5 suffix when the library uses Qt5, because Fedora also ships the same version of libQGLViewer but compiled with Qt4.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/GillesDebunne/libQGLViewer/issues/18#issuecomment-231995623, or mute the thread https://github.com/notifications/unsubscribe/ABzymic2XqBEAiDOvR2mjq_X2S5NalAlks5qU2bqgaJpZM4Fdc_f .

lrineau commented 8 years ago

It seems poppler-qt does it right, but it does not use qmake for its build system: their Qt4 version is suffixed by -qt4 and the Qt5 version by -qt5. poppler-qt

Polkit-qt has decided, probably for source compability, that the Qt4 version was suffixed by -qt without version number, and the Qt5 version with -qt5. They use CMake for their build system. polkit-qt

In your case, as your build system uses qmake, that is rather easy, because qmake knows the Qt version. You can change TARGET = QGLViewer to TARGET = QGLViewer-qt4 or TARGET = QGLViewer-qt5 depending on the version of Qt. I wonder if qmake can create symbolic links. That could be nice to have a symbolic link libQGLViewer.so pointed to libQGLViewer-qt4.so, for source compatibility, at least for your Qt4 users.