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:
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.
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…
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
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 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…
The relevant parts are the definition of the packages to install (variable installPkgs) which then I use to install the packages and to add them to LD_PATH, not all require to be there, it was just the quickest way to use it for now.
I add this answer because I didn’t found it anywhere, I had a hunch because of how to use cuda inside a shell and it worked the same way.