Problem linking application with Qt5 on OpenSUSE 13.2

Hello

I just shifted to OpenSUSE 13.2 from Ubuntu. My system currently has both Qt4 and Qt5 installed. When I try to build my application against Qt5, somehow the linker is also linking my applications to some unwanted Qt4 libs.

My output for ldd /usr/bin/digikam | grep Qt :

shourya@linux-91be:~/digikam-software-compilation/build> ldd /usr/bin/digikam | grep Qt
libQt5Core.so.5 => /usr/lib64/libQt5Core.so.5 (0x00007fc0ed874000)
libQt5Gui.so.5 => /usr/lib64/libQt5Gui.so.5 (0x00007fc0ed158000)
libQt5Widgets.so.5 => /usr/lib64/libQt5Widgets.so.5 (0x00007fc0ec8e4000)
libQt5DBus.so.5 => /usr/lib64/libQt5DBus.so.5 (0x00007fc0ec663000)
libQt5WebKitWidgets.so.5 => /usr/lib64/libQt5WebKitWidgets.so.5 (0x00007fc0ea4cc000)
libQt5WebKit.so.5 => /usr/lib64/libQt5WebKit.so.5 (0x00007fc0e7f55000)
libQt5Sql.so.5 => /usr/lib64/libQt5Sql.so.5 (0x00007fc0e6ebf000)
libQt5PrintSupport.so.5 => /usr/lib64/libQt5PrintSupport.so.5 (0x00007fc0e3b2d000)
libQt5Network.so.5 => /usr/lib64/libQt5Network.so.5 (0x00007fc0e2eda000)
libQt5Xml.so.5 => /usr/lib64/libQt5Xml.so.5 (0x00007fc0e22c1000)
libQt5X11Extras.so.5 => /usr/lib64/libQt5X11Extras.so.5 (0x00007fc0ddcc3000)
libQt5Svg.so.5 => /usr/lib64/libQt5Svg.so.5 (0x00007fc0dd44b000)
libQt5Sensors.so.5 => /usr/lib64/libQt5Sensors.so.5 (0x00007fc0db51e000)
libQt5OpenGL.so.5 => /usr/lib64/libQt5OpenGL.so.5 (0x00007fc0db2c3000)
libQt5Positioning.so.5 => /usr/lib64/libQt5Positioning.so.5 (0x00007fc0d9128000)
libQt5Quick.so.5 => /usr/lib64/libQt5Quick.so.5 (0x00007fc0d8b4d000)
libQt5Qml.so.5 => /usr/lib64/libQt5Qml.so.5 (0x00007fc0d8534000)
libQt5WebChannel.so.5 => /usr/lib64/libQt5WebChannel.so.5 (0x00007fc0d8317000)
libQtOpenGL.so.4 => /usr/lib64/libQtOpenGL.so.4 (0x00007fc0d6aa4000)
libQtGui.so.4 => /usr/lib64/libQtGui.so.4 (0x00007fc0d5de3000)
libQtTest.so.4 => /usr/lib64/libQtTest.so.4 (0x00007fc0d5bbb000)
libQtCore.so.4 => /usr/lib64/libQtCore.so.4 (0x00007fc0d56d0000)

As can be seen above, here digiKam is getting linked with the following Qt4 libs :

libQtOpenGL.so.4 => /usr/lib64/libQtOpenGL.so.4 (0x00007fc0d6aa4000)
libQtGui.so.4 => /usr/lib64/libQtGui.so.4 (0x00007fc0d5de3000)
libQtTest.so.4 => /usr/lib64/libQtTest.so.4 (0x00007fc0d5bbb000)
libQtCore.so.4 => /usr/lib64/libQtCore.so.4 (0x00007fc0d56d0000)

And this is unwanted. This used to not happen when I was in Ubuntu. When I was previously using Ubuntu, even there I had both Qt4 and Qt5 installed on my system. But the application used to link only to Qt5 libs. Can anyone help me out here as to what is going wrong ?

Thanks in advance !! :slight_smile:

Although I personally probably won’t be able to help much with Qt,
On general principles it might be helpful to post

The Desktop you’re using
The Development app
The compiler being used
If you have any additional repositories installed, particularly that might include their own Qt packages like KDE

If you don’t know about your repos, you can list them all with the following command

zypper lr -d

TSU

Desktop app : GNOME 3
Development app : digiKam 5.0.0 development version(which uses Qt5/Kf5)
Compiler : g++4.4
And yes I have also installed KDE frameworks 5, which requires Qt5. KF5 and Qt5 are required for digiKam 5.0.0.

The list of my repos can be found in this paste.

The Qt4 libraries are probably pulled in by opencv, which is built against Qt4 on openSUSE 13.2.
Make sure you install opencv-qt5-devel, instead of opencv-devel.
http://software.opensuse.org/package/opencv-qt5-devel

If that’s not it, there probably are more clues in the build log.

But why are you not just installing the existing package?
http://software.opensuse.org/package/digikam5
That’s the latest git snapshot, and it is even co-installable with the KDE4 version.
If you use my repo though, you should also add KDE:Qt5 and KDE:Frameworks5:
https://en.opensuse.org/SDB:KDE_repositories#KDE_Frameworks_5_.26_Plasma_5

The list of my repos can be found in this paste.

Please remove the VideoLAN (VLC, #1) repo. This is incompatible with Packman, and anything in it is available from Packman anyway.

you got the digikam sources and are truing to build it your self?
afak the current stable digikam is qt4 you can get the qt5 version from wolfi’s kde5 repo
https://build.opensuse.org/package/show?project=home%3Awolfi323%3Abranches%3AKDE%3AFrameworks5&package=digikam5

if you need to build it your self run ./configure --help in digikam5 source root and see the availoble switches, there should be a switch to chose between qt4 or qt5, do you have the qt5-devel packages installed?
imo it’s better to use the search and get prebuild packages then messing with the source
just search all the repo’s
https://software.opensuse.org/

Yes, you were right. The problem was that I was using opencv-devel, which is built against Qt4. Installling opencv-qt5-devel solved the problem. Thanks for the help !! :):slight_smile:

You’re welcome.

I did stumble over the same problem when first creating my digikam5 package months ago (causing digikam to crash at startup because it loaded Qt4 and Qt5), that’s why I was able to guess correctly… :wink: