Hello i wanted to use sublime . I added it to my config and tried to start it.
I get this error:
sublime: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
I thought nixos fixes such dependencies errors?
How do i fix this?
I don’t think you want sublime 2, you probably want the sublime4 package.
1 Like
You are right. Thanks.
If someone knows the answer to my original question. I would still want to know how that happened.
1 Like
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:
master ← Sigmanificient:sublime-url-failure
opened 08:21PM - 02 Aug 25 UTC
## Things done
- Built on platform:
- [x] x86_64-linux
- [ ] aarch6… 4-linux
- [ ] x86_64-darwin
- [ ] aarch64-darwin
- Tested, as applicable:
- [ ] [NixOS tests] in [nixos/tests].
- [ ] [Package tests] at `passthru.tests`.
- [ ] Tests in [lib/tests] or [pkgs/test] for functions and "core" functionality.
- [ ] Ran `nixpkgs-review` on this PR. See [nixpkgs-review usage].
- [x] Tested basic functionality of all binary files, usually in `./result/bin/`.
- Nixpkgs Release Notes
- [ ] Package update: when the change is major or breaking.
- NixOS Release Notes
- [ ] Module addition: when adding a new NixOS module.
- [ ] Module update: when the change is significant.
- [x] Fits [CONTRIBUTING.md], [pkgs/README.md], [maintainers/README.md] and other READMEs.
[NixOS tests]: https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests
[Package tests]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#package-tests
[nixpkgs-review usage]: https://github.com/Mic92/nixpkgs-review#usage
[CONTRIBUTING.md]: https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md
[lib/tests]: https://github.com/NixOS/nixpkgs/blob/master/lib/tests
[maintainers/README.md]: https://github.com/NixOS/nixpkgs/blob/master/maintainers/README.md
[nixos/tests]: https://github.com/NixOS/nixpkgs/blob/master/nixos/tests
[pkgs/README.md]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md
[pkgs/test]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/test
---
Add a :+1: [reaction] to [pull requests you find important].
[reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
[pull requests you find important]: https://github.com/NixOS/nixpkgs/pulls?q=is%3Aopen+sort%3Areactions-%2B1-desc
master ← gepbird:drop/sublime
opened 08:46AM - 13 Jun 26 UTC
Last non-refactor commit was 8 years ago. The package is currently broken and a … fix was proposed at https://github.com/NixOS/nixpkgs/pull/430463, but since we have 2 newer versions I don't think this should be kept around.
Closes https://github.com/NixOS/nixpkgs/pull/430463
## Things done
- Built on platform:
- [ ] x86_64-linux
- [ ] aarch64-linux
- [ ] x86_64-darwin
- [ ] aarch64-darwin
- Tested, as applicable:
- [ ] [NixOS tests] in [nixos/tests].
- [ ] [Package tests] at `passthru.tests`.
- [ ] Tests in [lib/tests] or [pkgs/test] for functions and "core" functionality.
- [ ] Ran `nixpkgs-review` on this PR. See [nixpkgs-review usage].
- [ ] Tested basic functionality of all binary files, usually in `./result/bin/`.
- Nixpkgs Release Notes
- [ ] Package update: when the change is major or breaking.
- NixOS Release Notes
- [ ] Module addition: when adding a new NixOS module.
- [ ] Module update: when the change is significant.
- [x] Fits [CONTRIBUTING.md], [pkgs/README.md], [maintainers/README.md] and other READMEs.
- [x] Follows the [automation/AI policy].
[NixOS tests]: https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests
[Package tests]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#package-tests
[nixpkgs-review usage]: https://github.com/Mic92/nixpkgs-review#usage
[CONTRIBUTING.md]: https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md
[automation/AI policy]: https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#automationai-policy
[lib/tests]: https://github.com/NixOS/nixpkgs/blob/master/lib/tests
[maintainers/README.md]: https://github.com/NixOS/nixpkgs/blob/master/maintainers/README.md
[nixos/tests]: https://github.com/NixOS/nixpkgs/blob/master/nixos/tests
[pkgs/README.md]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md
[pkgs/test]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/test
For general binary patching related stuff, see:
A small utility to modify the dynamic linker and RPATH of ELF executables
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:
opened 12:14PM - 19 Jan 26 UTC
0.kind: enhancement
1.severity: significant
5.scope: tracking
I'm writing this as "umbrella"/mega/tracking issue in order to address entire ni… xos ecosystem. the content will be modified frequently.
---
As `/nix/store` is fragmented with lots of directories, Finding single resource usually lookup multiple directories fed by huge environment variables[^1].
[^1]: Environment variables like `XDG_DATA_DIRS`, `QT_PLUGIN_PATH`, `LD_LIBRARY_PATH`. also wrapper feed these.
This makes application to perform ton of filesystem calls to locate resources (more than `O(n)`), resulting in spam of `stat`/`openat` related syscalls where 90% return `ENOENT/EINVAL` etc.
While this might be somehow trivial for high-end workstations, on low-power hardware(such like laptop), causing startup delays exceeding 4 seconds even in battery balanced preset.[^2] I believe this is resource-wasting task and more worse when using battery eco preset.
[^2]: Thinkpad T14 Gen1 (Intel), i5-10210U, 16+32GB, samsung nvme ssd(evo), FDE.
---
# Background
I've been personally tracking this issue since KDE Plasma environment was slow[^3], and found out that it has a lot of syscalls to load each resources. I'm using a desktop right now, so i could ignore this, but soon I must use laptop while staying at univ. This didn't happen for me when using Arch which is FHS-compliant distro few years ago before switching to NixOS. Today I became aware of past discussions(2016) and started writing about this because it has not been actively discussed recent.
[^3]: https://www.reddit.com/r/kde/comments/1h7xr5n/how_can_i_speed_up_of_launching_kdeqt_based/ \
#363068
# Link
- This issue (might) covers following nixpkgs issues/PRs: #21345 #21676 #24844 #126590 #207061 #363068 #362353 #367683
- `fzakaria` made some research for addressing this (2022):
- https://github.com/fzakaria/nix-harden-needed, https://github.com/fzakaria/shrinkwrap
- Mapping Out the HPC Dependency Chaos: https://arxiv.org/abs/2211.05118
- RFC may cover some portions about this (2025): https://github.com/NixOS/rfcs/pull/189
# Some scenarios
WIP. This is not a complete list of scenarios, Going to post later when i got time and will update when found new scenarios.
```bash
strace -f dolphin |& tee out
cat out | grep -F .so | wc -l
# results 4954 (loading libraries via ld and also qt's plugin)
cat out | grep -F qt.qm | wc -l
# results 7576
```
## Fontconfig overhead
Adding more fonts makes significantly more loading time. some programs like `coppwr` do not affect from this as it seems to use static font (by embedded?). The log below is running strace and line counts when installed 20 fonts in nixos system(home manager installed but its configured at nixos side).
```bash
strace -f zeditor |& tee out
cat out | grep fontconfig | grep EINVAL | wc -l
# results 318 items
cat out | grep fonts | wc -l
# results 2539 items
rm out
strace -f dolphin |& tee out
cat out | grep share/fonts | grep ENOENT | wc -l
# results 390
```
# Note
I believe there is no oneshot fix to mitigate these but it can satisfy some users which uses potato pc like me.
I use NixOS with home-manager, usually guis are installed in home-manager, just for sure.
Mention `ilsubyeega@catgirl.cloud` on matrix if needed, i might able to chat.
From my knowledge, i can propose this issue by multiple preset (not much ideal):
- energy efficient: aggressive usage of link farming for low cpu and io usage when runtime, but it trades with build time and disk inode usage.
- storage efficient: rely on some custom dynamic linker or fs cache with negative cache support.
- more security: no changes from now, there is dedicated hardening NixOS documentation.
devenv hook-should-activate runs on every shell prompt and takes 70ms doing almost nothing.
That cost isn’t devenv’s, it’s nixpkgs’. Every program pays it: Nix gives each package its own store path and records a DT_RUNPATH with one dir per dependency, so the loader makes hundreds of failing openat() calls hunting for libraries. devenv version does ~486, imagemagick ~1225. It’s the decade old “stat storm.”
We compared five fixes at Tacosprint, each trading off LD_LIBRARY_PATH overrides, duplica…
staging ← domenkozar:glibc-resolution-cache
opened 04:51PM - 26 Jun 26 UTC
Removes the `/nix/store` dynamic linker "stat storm" (#481620): the loader searc… hes every `DT_RUNPATH` directory for every soname, producing thousands of failing `openat`/`stat` syscalls at process startup. This teaches glibc to read a per binary `.note.nixos.ldcache` `PT_NOTE` of pre resolved `DT_NEEDED` paths, written by `patchelf --build-resolution-cache`, and resolve a binary's direct dependencies straight from it. The note is consulted after `LD_LIBRARY_PATH` and before the `DT_RUNPATH` walk, so `LD_LIBRARY_PATH`, `LD_PRELOAD` and `/run/opengl-driver` overrides keep working.
See [Making devenv start fast, and the whole nixpkgs with it](https://devenv.sh/blog/2026/06/26/making-devenv-start-fast-and-the-whole-nixpkgs-with-it/) for in-depth explanation of all approaches considered.
### Measured (default on, patched glibc vs stock, same package versions)
| command | failing `openat` before | after | reduction |
| --- | --- | --- | --- |
| `magick --version` | 1233 | 8 | 99.4% |
| `devenv version` | 483 | 28 | 94% |
Residual opens are the irreducible glibc-hwcaps probes plus a few runtime `dlopen`s not recorded in the note. Full numbers and method in the blog post above.
### Why staging
This rebuilds the world:
* `ldcache.patch` is applied to the default glibc, so every binary runs under a note aware loader.
* A stdenv fixup hook runs `patchelf --build-resolution-cache` over each output's ELF files (registered from `preFixup` so it lands at the end of `postFixup`, after autoPatchelfHook has finalised the interpreter and RPATH; honours `dontPatchELF`; batches via `xargs`).
* The default `patchelf` is bumped 0.15.2 -> 0.19.0, which carries the writer and the relocation fixes that had kept it pinned.
### Commits
1. `patchelf: 0.15.2 -> 0.19.0` (standalone; happy to split into its own PR since the bump benefits everyone)
2. `glibc: read a per-DSO resolution-cache note and generate it by default`
### Disclosure
This pull request description and the changes were prepared with assistance from Claude (Claude Code, Claude Opus 4.8); the commits carry `Assisted-by` trailers per the automation/AI policy.
## Things done
- Built on platform:
- [x] x86_64-linux
- [ ] aarch64-linux
- [ ] x86_64-darwin
- [ ] aarch64-darwin
- Tested, as applicable:
- [ ] [NixOS tests] in [nixos/tests].
- [x] Tests in [lib/tests] or [pkgs/test] for functions and "core" functionality (`tests.glibc-resolution-cache`; patchelf 0.19.0 own suite passes 63/63).
- [ ] Ran `nixpkgs-review` on this PR. See [nixpkgs-review usage].
- [x] Tested basic functionality of all binary files, usually in `./result/bin/`.
- NixOS Release Notes
- [ ] Module update: when the change is significant.
- [x] Fits [CONTRIBUTING.md], [pkgs/README.md], [maintainers/README.md] and other READMEs.
- [x] Follows the [automation/AI policy].
[NixOS tests]: https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests
[nixpkgs-review usage]: https://github.com/Mic92/nixpkgs-review#usage
[CONTRIBUTING.md]: https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md
[automation/AI policy]: https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#automationai-policy
[lib/tests]: https://github.com/NixOS/nixpkgs/blob/master/lib/tests
[maintainers/README.md]: https://github.com/NixOS/nixpkgs/blob/master/maintainers/README.md
[nixos/tests]: https://github.com/NixOS/nixpkgs/blob/master/nixos/tests
[pkgs/README.md]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md
[pkgs/test]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/test
1 Like