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
This commit is contained in:
Thierry Delafontaine
2025-08-12 11:33:23 +02:00
parent 52c09d3c23
commit ee6ad21950
+12
View File
@@ -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;