Qt, xcb, glibc problem?

I’m trying to build a package for a program which uses Qt.
Building succeeds, but starting fails with:

This application failed to start because it could not find or load the Qt platform plugin "xcb"
in "".

Starting it with QT_DEBUG_PLUGINS=1 additionally shows a GLIBC_2.27 not found-message:

Cannot load library /nix/store/10l6xyzr053c1zh30g2j328wyyh6anry-qtbase-5.10.1-bin/lib/qt-5.10/plugins/platforms/libqxcb.so:
(/nix/store/2kcrj1ksd2a14bm5sky182fv2xwfhfap-glibc-2.26-131/lib/libc.so.6:
version `GLIBC_2.27' not found (required by /nix/store/izpra5d6slpacbq8mgx5vanz5axv9fny-systemd-238-lib/lib/libsystemd.so.0))

Although this seems to be a common problem, I have not found any working solution.
So, what do I have to change in the package to solve this?

AFAIK this bug is usually caused by a program being linked against a QT version different than the one the current system is running.

While we seem to lack a canonical solution, I know of two possible workarounds:

You can either build your package with the same version of QT your system is currently using,

or you can rebuild your system to use the same QT version that your package is trying to use, and then garbage-collect.

Do you happen to be running NixOS <= 18.03, but developing with nixpkgs-unstable or master?

Then you should upgrade to unstable, because glibc upgrade opened LOTS of impurities.

I had a glibc-not-found error even on nixos-unstable. Turned out, my package had runtime reference to firefox,

which happened to be a firefox-with-glibc2.26. So old packages installed with nix-env may add problems here.

I’ve now removed all locally installed packages, removed all other channels, and re-built the package.
Looks like this solved the problem, thanks.