jetify-com / devbox

Instant, easy, and predictable development environments
https://www.jetify.com/devbox/
Apache License 2.0
8.77k stars 203 forks source link

libstdc++.so.6 => not found #2366

Open spockfish opened 4 weeks ago

spockfish commented 4 weeks ago

What happened?

A binary won't run because it can't find libstdc++.so.6.

The FAQ mentions this issue and suggests to run devbox add stdenv.cc.cc.lib But that fails: it can't find that package.

Steps to reproduce

  1. build ccache
  2. try to run ccache
  3. ldd ccache will show the message.

Command

No response

devbox.json

{
  "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.13.0/.schema/devbox.schema.json",
  "packages": [
    "perl@latest",
    "libxcrypt@latest",
    "flex@latest",
    "expat@latest",
    "xxd@latest",
    "rustup@latest",
    "gh@latest",
    "fakeroot@latest",
    "patch@latest",
    "cmake@latest",
    "ncurses5@latest",
    "glibc@latest",
    "stdenv@latest",
    "gcc@latest",
  ],
  "env": {},
  "shell": {
    "init_hook": [
      "echo 'Welcome to devbox!' > /dev/null",
      "export NIX_CFLAGS_COMPILE=\"$NIX_CFLAGS_COMPILE -Wno-error=format-security\"", // disable hardening (which does not work for BR)
    ],
    "scripts": {
      "test": [
        "echo \"Error: no test specified\" && exit 1",
      ],
    },
  },
}

Devbox version

0.13.5

Nix version

nix (Nix) 2.24.7

What system does this bug occur on?

Linux (x86-64)

Debug logs

No response

DerArkeN commented 4 weeks ago

try adding stdenv_32bit

Bee-Mar commented 2 weeks ago

I've encountered this in the past and my resolution was to add 'gccXXStdEnv.cc.cc.lib' as a "package". 'XX' is the gcc version you're using (ie. gcc13StdEnv.cc.cc.lib). Additionally, I augmented the "env" to contain

"LD_LIBRARY_PATH": "$DEVBOX_PROJECT_ROOT/.devbox/nix/profile/default/lib"