error: ‘ class xxx ’ has no member named ‘ xxxx ’ in nix-build

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值