From ee6ad21950181ddc9d00b3e71446ca4dbf44d3c8 Mon Sep 17 00:00:00 2001 From: Thierry Delafontaine Date: Mon, 11 Aug 2025 13:37:30 +0200 Subject: [PATCH] opencode: fix Bash tool command execution error on Linux Previously, prompting the LLM to execute CLI commands using the Bash tool on Linux would fail with the following error: Error [ERR_DLOPEN_FAILED]: libstdc++.so.6: cannot open shared object file: No such file or directory This commit resolves the issue by ensuring libstdc++.so.6 is included in LD_LIBRARY_PATH. Fixes: #432051 --- pkgs/by-name/op/opencode/package.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkgs/by-name/op/opencode/package.nix b/pkgs/by-name/op/opencode/package.nix index ad6412cf8234..deec46072b9a 100644 --- a/pkgs/by-name/op/opencode/package.nix +++ b/pkgs/by-name/op/opencode/package.nix @@ -1,9 +1,11 @@ { lib, + stdenv, stdenvNoCC, buildGoModule, bun, fetchFromGitHub, + makeBinaryWrapper, models-dev, nix-update-script, testers, @@ -109,6 +111,7 @@ stdenvNoCC.mkDerivation (finalAttrs: { nativeBuildInputs = [ bun + makeBinaryWrapper models-dev ]; @@ -152,6 +155,15 @@ stdenvNoCC.mkDerivation (finalAttrs: { runHook postInstall ''; + # Execution of commands using bash-tool fail on linux with + # Error [ERR_DLOPEN_FAILED]: libstdc++.so.6: cannot open shared object file: No such + # file or directory + # Thus, we add libstdc++.so.6 manually to LD_LIBRARY_PATH + postFixup = '' + wrapProgram $out/bin/opencode \ + --set LD_LIBRARY_PATH "${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}" + ''; + passthru = { tests.version = testers.testVersion { package = finalAttrs.finalPackage;