Mostly the root cause of this failure is the nix lib dependency propagation error, which is a lib is dependent by two different libs, which might introduce two different versions of the lib.
For example
Node A depends on a common lib B, aslo depends on a common lib C, mean while the lib B also depends on lib C:
Nix just load one of these two versions. To fix this issue, we need make sure that these two different libs to use the same version of the lib. As above chart shows, there are two solutions:
Solution1 - fix it from default.nix of A with below code:
{ system ? builtins.currentSystem
, pkgs ? import nix/nix-infra { inherit system; }
, rosDistro ? "noetic"
, rosPkgs ? pkgs.rosPackages.${rosDistro}
, C ? import nix/C { inherit pkgs; }
, B ? (import nix/B { inherit pkgs rosDistro rosPkgs; C=C;}).B
In above script, B lib will use the same C lib as A used.
Solution2 - No suggested, but it works as well. Which is to copy the C2 nix configuration file from A to B. This will change the source of the lib B.