From df658f7352565aad1514b441003bef85fd6bb9c7 Mon Sep 17 00:00:00 2001 From: Alexandros Liarokapis Date: Tue, 17 Dec 2024 16:17:07 +0200 Subject: [PATCH] remove --as-needed propagated flag from backward-ros in order to avoid stressing the linker --- distros/ros2-overlay.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/distros/ros2-overlay.nix b/distros/ros2-overlay.nix index 79b6dd6e6a..47a7b55829 100644 --- a/distros/ros2-overlay.nix +++ b/distros/ros2-overlay.nix @@ -35,6 +35,22 @@ rosSelf: rosSuper: with rosSelf.lib; { ''; }); + backward-ros = rosSuper.backward-ros.overrideAttrs ({ postPatch ? "", ... }: { + + # The `--as-needed` flag directs the linker to search all libraries specified + # during its invocation to identify which ones contain the symbols required by the binary. + # + # Due to the nixpkgs binutils wrapper and the reliance to `propagatedBuildInputs`, + # the overlay often propagates an excessive number of libraries. + # + # As a result, the `--as-needed` flag can significantly increase the time the linker + # spends searching through these libraries, potentially causing builds to fail to complete. + + postPatch = postPatch + '' + sed '/-Wl,--as-needed/d' -i cmake/BackwardConfigAment.cmake + ''; + }); + cyclonedds = rosSuper.cyclonedds.overrideAttrs ({ cmakeFlags ? [], ... }: {