Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixing incompatible Qt library (version 0x50902) with this library (version 0x50901) #30551

Closed
yrashk opened this issue Oct 18, 2017 · 35 comments

Comments

@yrashk
Copy link
Contributor

yrashk commented Oct 18, 2017

Issue description

In certain (mixed 17.09/unstable) setups, when both qt-5.9.2 and qt-5.9.1 are present, tools like VirtualBox or wpa_gui can't start and fail with this error:

Qt FATAL: Cannot mix incompatible Qt library (version 0x50902) with this library (version 0x50901)

This might be related to the fact that the recent update to 5.9.2 that still keeps qtwebkit at 5.9.1 (since qtwebkit-5.9.2 is not available):

https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/qt-5/5.9/srcs.nix#L285-L300

Steps to reproduce

On 17.09, install dropbox from the unstable channel. wpa_gui and VirtualBox from stable will exhibit the error.

Technical details

  • System: 17.09.1756.c99239bca0 (Hummingbird)
  • Nix version: nix-env (Nix) 1.11.15
  • Nixpkgs version: "17.09.1756.c99239bca0"
  • Sandboxing enabled: false

cc/ht @woffs

@timokau
Copy link
Member

timokau commented Oct 18, 2017

As I said in #30255, I experience the same problem with qutebrowser.

But, if I install the exact same qutebrowser package in my user environment instead of the global one, it works:

# ls -lah $(which qutebrowser)                                                                                                                                              ~
Permissions Size User Date Modified Name
lrwxrwxrwx    77 root 31 Dec  1969  /run/current-system/sw/bin/qutebrowser -> /nix/store/87dk7zl5cam1rz0j1912188vf9drmadi-qutebrowser-1.0.2/bin/qutebrowser
# qutebrowser                                                                                                                                                               ~
16:40:24 CRITICAL: Cannot mix incompatible Qt library (version 0x50901) with this library (version 0x50902)
Fatal Python error: Aborted

Current thread 0x00007f2ca7b63580 (most recent call first):
  File "/nix/store/87dk7zl5cam1rz0j1912188vf9drmadi-qutebrowser-1.0.2/lib/python3.6/site-packages/qutebrowser/misc/sql.py", line 95 in init
  File "/nix/store/87dk7zl5cam1rz0j1912188vf9drmadi-qutebrowser-1.0.2/lib/python3.6/site-packages/qutebrowser/app.py", line 444 in _init_modules
  File "/nix/store/87dk7zl5cam1rz0j1912188vf9drmadi-qutebrowser-1.0.2/lib/python3.6/site-packages/qutebrowser/app.py", line 163 in init
  File "/nix/store/87dk7zl5cam1rz0j1912188vf9drmadi-qutebrowser-1.0.2/lib/python3.6/site-packages/qutebrowser/app.py", line 137 in run
  File "/nix/store/87dk7zl5cam1rz0j1912188vf9drmadi-qutebrowser-1.0.2/lib/python3.6/site-packages/qutebrowser/qutebrowser.py", line 186 in main
  File "/nix/store/87dk7zl5cam1rz0j1912188vf9drmadi-qutebrowser-1.0.2/bin/..qutebrowser-wrapped-wrapped", line 12 in <module>
[1]    1627 abort      qutebrowser

# nix-env -f /home/timo/nixpkgs -i qutebrowser                                                                                                                        (134) ~
installing ‘qutebrowser-1.0.2’

# ls -lah $(which qutebrowser)                                                                                                                                              ~
Permissions Size User Date Modified Name
lrwxrwxrwx    77 root 31 Dec  1969  /run/current-system/sw/bin/qutebrowser -> /nix/store/87dk7zl5cam1rz0j1912188vf9drmadi-qutebrowser-1.0.2/bin/qutebrowser

# qutebrowser --version                                                                                                                                                     ~
qutebrowser v1.0.2

Regarding @ttuegel's remark about the user environment: I don't have anything installed in my user environment (and why could that even be the problem? Shouldn't the dependencies be independent of the environment?).

@mickours
Copy link
Contributor

FYI there is a thread on Archlinux forum on this issue:
https://bbs.archlinux.org/viewtopic.php?id=227943

It seems that @yrashk is right about the root cause of the problem: the mix of two Qt version.

@ttuegel
Copy link
Member

ttuegel commented Oct 19, 2017

the mix of two Qt version.

Yes, you cannot have anything installed with Qt 5.9.1 and Qt 5.9.2 at the same time. This is mainly a NixOS problem, which I will explain in a moment.

However: QtWebkit is not part of Qt anymore, so the QtWebkit version has nothing whatsoever to do with the Qt version. Our QtWebkit 5.9.1 is built with Qt 5.9.2. As @Eisfreak7 found by installing qutebrowser into a user profile, the problem is not QtWebkit 5.9.1, but something else in your system is pulling in Qt 5.9.1.

Shouldn't the dependencies be independent of the environment?

No, not for Qt programs. Qt loads plugins at runtime for most features. We let it search your environment for plugins so that you can do things like use themes and run Qt applications outside KDE. Unfortunately, Qt freaks out if it even sees an old plugin, so if you have anything old hanging around it will cause problems. This problem can be circumvented by installing something in the user profile because that profile will be searched first (so if Qt finds the plugin it needs in the user environment, it never runs into the bad plugin in the global environment).

I don't have anything installed in my user environment

@Eisfreak7
That is very surprising. Could you please post a log of strace qutebrowser for the failing package?

@mickours
Copy link
Contributor

I tried to nix-env -u but I still had the problem. But, thanks to strace, I find out where the problem comes from and fixed it, at least in my case... (thxs @ttuegel 👍 )

First I ran sudo strace VirtualBox and I found this in the trace:

open("/home/mmercier/.nix-profile/lib/qt-5.9/plugins/xcbglintegrations", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 10
open("/nix/store/pn43bh64fnvdclj4j8gaxq2xxywcwarp-qtbase-5.9.1-bin/lib/qt-5.9/plugins/xcbglintegrations/libqxcb-egl-integration.so", O_RDONLY|O_CLOEXEC) = 10

So it looks like my current profile links to the old Qt plugins as expected.
Then I used the nix-store superpowers to see the reverse dependencies of it:

nix-store --query --referrers /nix/store/nwvydrhhmfvf5g8ybh135rgpl9xyzvvb-qtbase-5.9.1 
/nix/store/pn43bh64fnvdclj4j8gaxq2xxywcwarp-qtbase-5.9.1-bin
/nix/store/nwvydrhhmfvf5g8ybh135rgpl9xyzvvb-qtbase-5.9.1
/nix/store/5rflm7chjb5ddpg11v12d747ij47w7w8-qtsvg-5.9.1
/nix/store/pn43bh64fnvdclj4j8gaxq2xxywcwarp-qtbase-5.9.1-bin
/nix/store/028968dblhg78d6khsp8whs9iv7av4vy-qtsvg-5.9.1-bin
/nix/store/0qzr6cd8ivi7mjfh4v1yyjsva42wmgrd-qtdeclarative-5.9.1
/nix/store/h1ig4qqy65sfrcs7b3v3c0b83n4pkm39-qtwebchannel-5.9.1
/nix/store/zfhjbc6h88fqi4hzbx4fbhrhjhwam878-qtxmlpatterns-5.9.1
/nix/store/qk7fzd4pw5bvynm527rjqvv012h1qcx7-qtdeclarative-5.9.1-bin
/nix/store/2hj9rzcpv113cywydvsfq9ysx6vjkqiv-qtwebchannel-5.9.1-bin
/nix/store/7m1q6kvs45bpviq5ns5qka80a8pj8ggi-qtlocation-5.9.1
/nix/store/3nc44b8zi0nkg6k2yl7dv8vlmdqz5as7-qtwebengine-5.9.1
/nix/store/6aard33vnrycv9fqnj5kxyqyacx8azff-qtx11extras-5.9.1
/nix/store/vira350bp6kklpw0phxfs6s4402jgcf7-qtsensors-5.9.1
/nix/store/88kvlc9vkfqb1cw23jpkwak87jmmgnlb-qtsensors-5.9.1-bin
/nix/store/afy4qncsi225224rnkc5lj61w74hps7r-qtquickcontrols-5.9.1
/nix/store/fahw70iy5y7ig49z3pg5v41vafyyyhpc-virtualbox-5.1.26
/nix/store/c6mv5fr6rkxqhjg3qpyx5q8was6lswmc-references.nix
/nix/store/g6gs0gcq91aqb2433sdirags3w3pnhyl-qtmultimedia-5.9.1
/nix/store/lfnqipvk69mvhbmyy3id4palwzrvcxkg-qtmultimedia-5.9.1-bin
/nix/store/jkyw1xfdgm3gk9v8w5vhdrbjq3c9154h-qtlocation-5.9.1-bin
/nix/store/drqzidxc2554lwwjfs823hyw7qpinlj3-qtwebengine-5.9.1-bin
/nix/store/kr6zrh0rzsxrcfclc3v7skkrw656mfyh-qtwebkit-5.9.1
/nix/store/r57wn48jg20c7vxfa63k96610h996qdz-python3.6-PyQt-5.8.1
/nix/store/xa0icbjagi4520n9cqxhbapa9in8yf39-references.nix

And I found out that the PyQt library, that is installed in my python environment, is linked to the old Qt library.
Removing the python environment nix-env -e python3 do the trick.

Still there is a problem here: python installed environment contains libraries that are not updated by nix-env -u

To be clear I installed the environment using nix-env -if python-env.nix where python-env.nix is

with import <nixpkgs> {};

python36.withPackages (ps: with ps; [ pyqt5 ])

After remove, when I re-install the environment It gets updated correctly.

@ebzzry
Copy link

ebzzry commented Oct 24, 2017

I have this with VirtualBox, too. :-( I can’t find what is causing it.

@oyren
Copy link
Contributor

oyren commented Oct 25, 2017

Same problem here.

@ebzzry
Copy link

ebzzry commented Oct 26, 2017

If I have virtualisation.virtualbox.host.enable = true it provides me with /run/wrappers/bin/VirtualBox. Then, when I run it:

sudo strace VirtualBox

I get https://gist.github.com/ebzzry/3dba05831d2652b37e6065d6899cd232.

When I install VirtualBox via nix-env, then run it:

~/.nix-profile/bin/VirtualBox

I get

this

and

this.

@ttuegel
Copy link
Member

ttuegel commented Oct 26, 2017

Your VirtualBox is loading outdated plugins from your system environment:

https://gist.github.com/ebzzry/3dba05831d2652b37e6065d6899cd232#file-virtualbox-strace-txt-L1514
https://gist.github.com/ebzzry/3dba05831d2652b37e6065d6899cd232#file-virtualbox-strace-txt-L1543
https://gist.github.com/ebzzry/3dba05831d2652b37e6065d6899cd232#file-virtualbox-strace-txt-L1572

and so on...

It works if installed in the user profile because the plugins from the user profile supersede those in the system profile. Something installed in the system profile is pulling in outdated plugins, though I cannot tell what is.

@ebzzry
Copy link

ebzzry commented Oct 27, 2017

Oh. Is that so. I wonder what it is. :-(

@CMCDragonkai
Copy link
Member

CMCDragonkai commented Nov 2, 2017

No, not for Qt programs. Qt loads plugins at runtime for most features. We let it search your environment for plugins so that you can do things like use themes and run Qt applications outside KDE. Unfortunately, Qt freaks out if it even sees an old plugin, so if you have anything old hanging around it will cause problems. This problem can be circumvented by installing something in the user profile because that profile will be searched first (so if Qt finds the plugin it needs in the user environment, it never runs into the bad plugin in the global environment).

I found that if I have an environment based on a different hash such as 8fefa85 and I install a qt package into my nix-env from a nixpkgs repository at a newer hash such as e4913c2, this error occurs too. So it seems you need to have compatible "environments" as well. This happened in #27790

@ebzzry
Copy link

ebzzry commented Nov 3, 2017

This is a show stopper for me. I need VirtualBox. I hope someone has already found a solution.

@LionNatsu
Copy link

There must be a plugin which was built with old Qt version.
Do you have core dump file?

coredumpctl can show you your core dump 'database'. Find the dump, run coredumpctl info /path/to/execfile, you will get a stack trace.

Showing the first few lines of stack trace here will be very helpful to find the broken plugin.

@ebzzry
Copy link

ebzzry commented Nov 6, 2017

I get:

$ coredumpctl info =VirtualBox
No coredumps found.

@LionNatsu
Copy link

ebzzry, Emm... I think Virtual Box disabled coredump. Are there any option to enable it?

Anyway, you may try something like wpa_gui (actually I don't know whether wpa_gui disabled coredump or not)

@ebzzry
Copy link

ebzzry commented Nov 6, 2017

@LionNatsu wpa_gui works

wpa_gui

@mickours
Copy link
Contributor

mickours commented Nov 7, 2017

Even when I managed to make virtualbox works and after I've updated my environment, I still had the same problem with other application like telegram-desktop that is in my user environment.

telegram-desktop
Cannot mix incompatible Qt library (version 0x50902) with this library (version 0x50901)
[1]    4213 abort      telegram-desktop

It seems that the nix-env -u do not upgrade the package even if the Qt lib version has changed.

I found a workaround: uninstall and re-install the package:

nix-env -e telegram-desktop
nix-env -i telegram-desktop

@ebzzry Did you try to uninstall and reinstall virtualbox?

@ebzzry
Copy link

ebzzry commented Nov 9, 2017

@mickours Yes, I have tried that, too. I have even “cleaned” /nix/store/*virtualbox*, then reinstalled it. I have also removed all of /nix/store/*5.9.1*. However, I still get that behavior after re-installing VirtualBox.

@orivej
Copy link
Contributor

orivej commented Nov 11, 2017

@Pneumaticat says that nix-collect-garbage -d has solved the version mismatch: #31483 (comment)

@ebzzry
Copy link

ebzzry commented Nov 12, 2017

I have tried that numerous times, but it didn't work with me.

@orivej
Copy link
Contributor

orivej commented Nov 12, 2017

@ebzzry Looking at your strace, it should help if you remove /run/current-system/sw/bin from your PATH before running an application installed in the user environment when your system Qt and user Qt are out of sync: PATH=$(sed 's#/run/current-system/sw/bin:##' <<<"$PATH") VirtualBox. Vice versa, to run a Qt application installed in the system environment, remove your user environment from the PATH.

You won't have to do this if you could make these two commands output the same (or make the second one output No such file or directory):

realpath /run/current-system/sw/lib/qt-5.9/plugins/platforms/libqminimal.so
realpath /nix/var/nix/profiles/per-user/ebzzry/profile/lib/qt-5.9/plugins/platforms/libqminimal.so

@ebzzry
Copy link

ebzzry commented Nov 12, 2017

strace.txt
When I run

% PATH=$(sed 's#/run/current-system/sw/bin:##' <<<"$PATH") sudo strace VirtualBox

I get the output in the attached file.

I have virtualisation.virtualbox.host.enable = true in /etc/nixos/configuration.nix.

The output of

% which virtualbox

is

/run/wrappers/bin/VirtualBox

@orivej
Copy link
Contributor

orivej commented Nov 12, 2017

Yeah, I've amended my comment, you should remove your user environment from the PATH (probably /home/ebzzry/.nix-profile/bin) to run VirtualBox from the system environment.

@ebzzry
Copy link

ebzzry commented Nov 12, 2017

@orivej Thanks, it fixed it for the meantime!

@orivej
Copy link
Contributor

orivej commented Nov 17, 2017

This bug is caused by this patch: ttuegel/qtbase@efad454 . It works only when there is exactly one copy of Qt 5.9 in PATH (by looking at ../lib/qt-5.9 for each PATH entry). Of course, this breaks when the system and the user environments are in PATH (this is the default) and both contain Qt. We have to find a way to replace that patch.

@ebzzry
Copy link

ebzzry commented Nov 22, 2017

VirtualBox runs fine now. However, I can no longer run Telegram.

% PATH=$HOME/.nix-profile/bin:$HOME/.nix-profile/sbin telegram-desktop
QApplication: invalid style override passed, ignoring it.
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
Cannot mix incompatible Qt library (version 0x50901) with this library (version 0x50902)
zsh: abort      PATH=$HOME/.nix-profile/bin:$HOME/.nix-profile/sbin telegram-desktop

@orivej
Copy link
Contributor

orivej commented Nov 22, 2017

Your $HOME/.nix-profile/lib/qt-5.9/plugins must contain plugins for multiple versions of Qt. Here is a more robust workaround (it creates a new profile just for tdesktop):

nix-env -f '<nixpkgs>' -p $HOME/tdesktop -iA tdesktop
PATH=$HOME/tdesktop/bin telegram-desktop

@ebzzry
Copy link

ebzzry commented Nov 23, 2017

Thanks @orivej!

@matthiasbeyer
Copy link
Contributor

This error can be reproduced with quaternion as well (on 8.03pre125130.3a763b91963 (Impala)):

$ quaternion 
Debug:  false
qrc:///qml/chat.qml:2:1: module "QtQuick.Controls" is not installed
qrc:///qml/chat.qml:3:1: module "QtQuick.Controls.Styles" is not installed
qrc:///qml/chat.qml:2:1: module "QtQuick.Controls" is not installed
qrc:///qml/chat.qml:3:1: module "QtQuick.Controls.Styles" is not installed
Cannot mix incompatible Qt library (version 0x50902) with this library (version 0x50903)
Aborted

Reproduce with nix-shell -p quaternion --run quaternion.

@simendsjo
Copy link

I'm getting these errors when starting KDE, so I'm not even able to start the DE.
The error doesn't refer to anything, so I'm having a hard time locating what might be wrong.

these paths will be fetched (0.06 MiB download, 0.31 MiB unpacked):
/nix/store/a6rf8a474z5y01w4ld2v54d24kyqcxag-stdenv-linux
/nix/store/ial8a56ys2rswfq4j2abm3cl99li5b6p-bash-interactive-4.4-p23-dev
copying path '/nix/store/ial8a56ys2rswfq4j2abm3cl99li5b6p-bash-interactive-4.4-p23-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/a6rf8a474z5y01w4ld2v54d24kyqcxag-stdenv-linux' from 'https://cache.nixos.org'...

  • system: "x86_64-linux"
  • host os: Linux 4.14.101, NixOS, 18.09.2203.9bd45dddf81 (Jellyfish)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.1.3
  • channels(root): "nixos-18.09.2243.63a09881b67"
  • channels(simendsjo): ""
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

@simendsjo
Copy link

Think I found my issue. Started uninstalling every GUI thing I installed using nix-env, and found I had xmonad++ installed there. My guess is this broke my system, but I uninstalled it together with a bunch of other packages.

@cwoelk
Copy link

cwoelk commented Feb 24, 2019

For me it was nomacs-3.10.2 creating the conflicting plugin version $HOME/.nix-profile/lib/qt-5.11. Thanks for the very helpful information in here.

@JorelAli
Copy link

A few days ago, I messed with nix-channel and now qutebrowser and ghostwriter both have this qt issue.

  • system: "x86_64-linux"
  • host os: Linux 4.14.103, NixOS, 18.09.2266.aabc61049c0 (Jellyfish)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.1.3
  • channels(root): "nixos-18.09.2266.aabc61049c0"
  • channels(jorel): "nixpkgs-19.03pre169106.1a88aa9e0cd"
  • nixpkgs: /home/jorel/.nix-defexpr/channels/nixpkgs

The 'fix' for these have been installing it via nix-env instead of having them in my configuration.nix, however after trying to install sqlitebrowser, the issue hasn't fixed itself (using either nix-env -i or having it in my configuration.nix file)

@jtojnar
Copy link
Member

jtojnar commented Mar 14, 2019

Dupe of #37864

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/cannot-mix-incompatible-qt-library/31313/1

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/cannot-mix-incompatible-qt-library/31313/3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.