nav2-bringup fails with "Argument list too long" when building using clang
Possibly related: #285
If I attempt to build `nav2-bringup` using clang, then it fails with the message `Argument list too long`
here is the full error:
```
$ nix build -L .#devShells.x86_64-linux.default --show-trace
ros-jazzy-nav2-bringup> Running phase: qtPreHook
ros-jazzy-nav2-bringup> /nix/store/3037naxrk7h2qiadv1s2ah8jvdllxv8p-stdenv-linux/setup: line 1752: /nix/store/8ksax0a2mxglr5hlkj2dzl556jx7xqn5-coreutils-9.7/bin/date: Argument list too long
error: build of '/nix/store/lbhqs2fh32k79wv9s374r6q53pviwsgw-ros-jazzy-nav2-bringup-1.3.11-r1.drv' on 'ssh-ng://remotebuild@inx.moe' failed: builder for '/nix/store/lbhqs2fh32k79wv9s374r6q53pviwsgw-ros-jazzy-nav2-bringup-1.3.11-r1.drv' failed with exit code 126;
last 2 log lines:
> Running phase: qtPreHook
> /nix/store/3037naxrk7h2qiadv1s2ah8jvdllxv8p-stdenv-linux/setup: line 1752: /nix/store/8ksax0a2mxglr5hlkj2dzl556jx7xqn5-coreutils-9.7/bin/date: Argument list too long
For full logs, run:
nix log /nix/store/lbhqs2fh32k79wv9s374r6q53pviwsgw-ros-jazzy-nav2-bringup-1.3.11-r1.drv
error: Cannot build '/nix/store/lbhqs2fh32k79wv9s374r6q53pviwsgw-ros-jazzy-nav2-bringup-1.3.11-r1.drv'.
Reason: builder failed with exit code 1.
Output paths:
/nix/store/2syxr2qby4h68nv61xdhk6snx5bny9rw-ros-jazzy-nav2-bringup-1.3.11-r1-debug
/nix/store/qqk4gdvp936hib9pdd17a3hfma1splnc-ros-jazzy-nav2-bringup-1.3.11-r1
error: Cannot build '/nix/store/9vcm146fvyd7zlf7kcii5hw1qg5g8kba-ros-env.drv'.
Reason: 1 dependency failed.
Output paths:
/nix/store/jbdni5pxpp5g6bqybj8h7camnkjfspy7-ros-env
error: Build failed due to failed dependency
error: Cannot build '/nix/store/7kv0vhay3264bmfnf1qg5m9xh195y8cv-argument-list-too-long.drv'.
Reason: 1 dependency failed.
Output paths:
/nix/store/cfjd5il4ypndymc134z3fbsd0xr091ks-argument-list-too-long
error: Build failed due to failed dependency
```
and here's the full log:
```
Running phase: qtPreHook
@nix {"action":"setPhase","phase":"qtPreHook"}
/nix/store/3037naxrk7h2qiadv1s2ah8jvdllxv8p-stdenv-linux/setup: line 1752: /nix/store/8ksax0a2mxglr5hlkj2dzl556jx7xqn5-coreutils-9.7/bin/date: Argument list too long
```
line `1752` of that `setup` script is:
```bash
startTime=$(date +"%s")
```
so I assume that somewhere under the hood here there's an `execve` happening.
and here's a minimal reproduction case:
```nix
{
inputs = {
nix-ros-overlay.url = "github:lopsided98/nix-ros-overlay/master";
nixpkgs.follows = "nix-ros-overlay/nixpkgs"; # IMPORTANT!!!
};
outputs = { self, nix-ros-overlay, nixpkgs }:
nix-ros-overlay.inputs.flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ nix-ros-overlay.overlays.default ];
};
llvm = pkgs.llvmPackages_latest;
clangStdenv = llvm.stdenv;
jazzy = pkgs.rosPackages.jazzy.overrideScope (rosSelf: rosSuper:
let
buildRosPackageClang = rosSelf.buildRosPackage.override {
stdenv = clangStdenv;
};
in pkgs.lib.mapAttrs (_: package: (package.override {
buildRosPackage = buildRosPackageClang;
}).overrideAttrs ({
propagatedBuildInputs ? [],
...
} : {
propagatedBuildInputs = propagatedBuildInputs ++ [ llvm.openmp ];
})) {
inherit (rosSuper)
nav2-bringup
;
});
in {
devShells.default = pkgs.mkShell.override {
stdenv = clangStdenv;
} {
name = "argument-list-too-long";
packages = with pkgs; [
(with jazzy; buildEnv {
paths = [
nav2-bringup
];
})
];
};
});
nixConfig = {
extra-substituters = [
"https://cache.nixos.org"
"https://ros.cachix.org"
];
extra-trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"ros.cachix.org-1:dSyZxI8geDCJrwgvCOHDoAfOm5sV1wCPjBkKL+38Rvo="
];
};
}
```
here's also the `flake.lock` in case this is sometime after and the repo has since been updated:
<details>
<summary><code>flake.lock</code></summary>
```json
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nix-ros-overlay": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1771881010,
"narHash": "sha256-vYTYv1PoGG/Q6afrKnj7fdT+h2f4b1auOdXmQZTaldU=",
"owner": "lopsided98",
"repo": "nix-ros-overlay",
"rev": "2d52dc94f1eeb1465195d1f909b5a10006c8fafd",
"type": "github"
},
"original": {
"owner": "lopsided98",
"ref": "master",
"repo": "nix-ros-overlay",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1759381078,
"narHash": "sha256-gTrEEp5gEspIcCOx9PD8kMaF1iEmfBcTbO0Jag2QhQs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7df7ff7d8e00218376575f0acdcc5d66741351ee",
"type": "github"
},
"original": {
"owner": "lopsided98",
"ref": "nix-ros",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nix-ros-overlay": "nix-ros-overlay",
"nixpkgs": [
"nix-ros-overlay",
"nixpkgs"
]
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}
```
</details>
this error is new and only started happening once I updated to the latest version of the `master` branch, which I assume was merged with `develop` around 2-ish weeks ago.
if I don't use clang for `nav2-bringup`, the same issue also occurs with the devshell itself.
interestingly, this same error does *not* happen with some of the other nav2 packages. I have no clue why.
2 条评论