Cannot mix incompatible Qt library

Lately I am constantly getting this error when running some Qt software.

Cannot mix incompatible Qt library (5.15.7) with this library (5.15.9)

There are several issues on github about it but they’ve been closed:

https://github.com/NixOS/nixpkgs/issues/30551
https://github.com/NixOS/nixpkgs/issues/37864
https://github.com/NixOS/nixpkgs/issues/47552
https://github.com/NixOS/nixpkgs/issues/55994

There is also a topic here that has no replies:

The solutions generally involve finding old packages and removing them. This makes me question everything I thought I knew about nix. I thought one of the main features of nix packages was that you could run multiple versions of the same package. I generally don’t even “install” packages but run them using “nix run”. I’ve ran the garbage collector even though I shouldn’t have to and that still doesn’t fix this problem. I don’t have this problem with anything else other than Qt packages. It seems weird and very wrong that adding something to my nix store could break something else that was working fine before. It seems like that these types of packages should be flagged or something. Can someone please help me understand why this happens and if there is a workaround other than going on a wild goose chase trying to find packages to remove? Thanks.

1 Like

Cannot mix incompatible Qt library (5.15.10) with this library (5.15.9)

I’m also getting this with the current “unstable” packages. I haven’t found any way around it yet… :slightly_frowning_face:
I was running Qt Creator and Clion in a nix-shell with the Qt dev packages.

Digging back this, because I had this recently (between 5.15.12 and 5.15.14) with freecad. I’m using home-manager as a nixos module. Turns out an old version of freecad was installed in the only generation listed by nix-env --list-generations (which was from 2 months ago, maybe when I installed the machine) and one was installed by home-manager. The former took precedence.

The way I discovered it is via these commands:

# find the store of freecad
realpath $(which freecad)
# check if it really depends on an outdated qt, put there the path given by the previous command)
nix-store --query --requisites /nix/store/59j0wqnlg3brq2haqq944ddbyk39vcg0-freecad-0.21.2
# then check what makes this store path stays around
nix-store --query --referrers-closure /nix/store/59j0wqnlg3brq2haqq944ddbyk39vcg0-freecad-0.21.2

This gave me some store path like

/nix/store/sdvdp9g1942xjvl903ggjp83bzbhxz2a-env-manifest.nix
/nix/store/19dwzlm5jrd5j3in7imrsyiwyhd4fdpg-user-environment.drv
/nix/store/lplh4wkl9x98l6bk3yiq2dxj0rlz6cry-user-environment

Then I guessed something was wrong with my profile listed by nix-env (but that was just my intuition, I don’t know how to get there in a more formal way). And sure enough, listing the bin folder in the current generation showed that freecad was installed there (it was supposed to be installed by home-manager). Removing it with nix-env fixed the issue.

nix-env is the new /usr/local :wink: But yeah, as choward said, this usually involves finding and upgrading or removing old packages. Some people had luck with nix flake update, other with nix-collect-garbage…

As from “why does it even matter that this package uses an old qt, I thought nixos was supposed to prevent this from happening?”, well I wholeheartedly agree, but apparently for Qt this is not the case. Some (incomplete) explanations: Mixing incompatible Qt library (version 0x50902) with this library (version 0x50901) · Issue #30551 · NixOS/nixpkgs · GitHub

The threads you linked in the first post are also useful. Everything seems to be closed, but the problem is probably not fixed yet

1 Like