Error loading libstdc++.so.6

Also, it has been dropped in unstable.
Since it’s proprietary, it was packaged as a wrapped binary that has been patched to use nix libs, however libstdcxx was missing from the libraries it was patched with. See:

For general binary patching related stuff, see:

This was manual patchelf as opposed to autoPatchelfHook, which explains why it did not fail with a missing dependency at build-time. See this readelf -d output on sublime:

❯ readelf -d result/bin/sublime2

Dynamic section at offset 0x2a8 contains 32 entries:
  Tag        Type                         Name/Value
 0x000000000000001d (RUNPATH)            Library runpath: [/nix/store/7dl2py4dnp4ffj92r1lq0i54ik1v8kzn-glib-2.88.1/lib:/nix/store/flhvh2a7c578zbca9arvn4n2vc2pcgpc-libx11-1.8.13/lib:/nix/store/nykbzgvd1pzr0waaqxp9srdr5z6lwsbv-gtk+-2.24.33/lib:/nix/store/4zwifnznmqsg3zl8y5yyfafwp4sws6rs-cairo-1.18.4/lib:/nix/store/hngmi01i8wgi25a0byrxcn4ysz5j79mw-gcc-15.2.0-lib/lib64]
 0x0000000000000001 (NEEDED)             Shared library: [libgobject-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [librt.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libglib-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libutil.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libX11.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000c (INIT)               0x4b94e8
 0x000000000000000d (FINI)               0x9a25e8
 0x0000000000000004 (HASH)               0x4a4b20
 0x000000006ffffef5 (GNU_HASH)           0x4982a8
 0x0000000000000005 (STRTAB)             0x3ff4f8
 0x0000000000000006 (SYMTAB)             0x4683c8
 0x000000000000000a (STRSZ)              429774 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0xdc9fe8
 0x0000000000000002 (PLTRELSZ)           13968 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x4b5e58
 0x0000000000000007 (RELA)               0x4b5900
 0x0000000000000008 (RELASZ)             1368 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffe (VERNEED)            0x4b5760
 0x000000006fffffff (VERNEEDNUM)         8
 0x000000006ffffff0 (VERSYM)             0x4b1772
 0x0000000000000000 (NULL)               0x0

The “Shared library” entries are libraries required by sublime, and “Library runpath” is the list of directories that will be searched for them. Nicer formatted runpath:

  • /nix/store/7dl2py4dnp4ffj92r1lq0i54ik1v8kzn-glib-2.88.1/lib
  • /nix/store/flhvh2a7c578zbca9arvn4n2vc2pcgpc-libx11-1.8.13/lib
  • /nix/store/nykbzgvd1pzr0waaqxp9srdr5z6lwsbv-gtk+-2.24.33/lib
  • /nix/store/4zwifnznmqsg3zl8y5yyfafwp4sws6rs-cairo-1.18.4/lib
  • /nix/store/hngmi01i8wgi25a0byrxcn4ysz5j79mw-gcc-15.2.0-lib/lib64

Notice the lack of any libstdcxx library dirs. Then, when the linker goes to open up the libraries, it errors as none of the directories in the RUNPATH are libstdc++.so.6.

If you’re thinking “Wait, it scans ALL of the runpath dirs for libs? Isn’t that expensive with a whole lot of libraries?” it is, but that’s being worked on:

1 Like