nixpkgs icon indicating copy to clipboard operation
nixpkgs copied to clipboard

cosmic-comp: crash durring startup

Open me-it-is opened this issue 1 year ago • 26 comments

Nixpkgs version

  • Unstable (25.11)

Describe the bug

when login into a cosmic session it hangs with a blinking cursor

Steps to reproduce

Install cosmic and try to login

Expected behaviour

cosmic starts up normaly

Screenshots

No response

Relevant log output

Nov 23 13:28:30 <hostname> .cosmic-comp-wrapped[2515]: Unable to become drm master, assuming unprivileged mode
Nov 23 13:28:30 <hostname> .cosmic-comp-wrapped[2515]: thread 'main' panicked at 'Failed to load LibEGL: DlOpen { desc: "libEGL.so.1: cannot open >
                                                          0: log_panics::Config::install_panic_hook::{{closure}}
                                                          1: std::panicking::panic_with_hook
                                                          2: std::panicking::panic_handler::{{closure}}
                                                          3: std::sys::backtrace::__rust_end_short_backtrace
                                                          4: __rustc::rust_begin_unwind
                                                          5: core::panicking::panic_fmt
                                                          6: core::result::unwrap_failed
                                                          7: core::ops::function::FnOnce::call_once
                                                          8: std::sync::poison::once::Once::call_once_force::{{closure}}
                                                          9: std::sys::sync::once::futex::Once::call
                                                         10: smithay::backend::egl::ffi::make_sure_egl_is_loaded::{{closure}}::{{closure}}
                                                         11: smithay::backend::egl::ffi::egl::metaloadfn
                                                         12: smithay::backend::egl::ffi::egl::load_with::inner
                                                         13: std::sync::poison::once::Once::call_once::{{closure}}
                                                         14: std::sys::sync::once::futex::Once::call
                                                         15: smithay::backend::egl::ffi::make_sure_egl_is_loaded
                                                         16: smithay::backend::egl::display::EGLDisplay::new
                                                         17: cosmic_comp::backend::kms::device::init_egl
                                                         18: cosmic_comp::backend::kms::device::<impl cosmic_comp::state::State>::device_added
                                                         19: cosmic_comp::backend::kms::init_backend
                                                         20: cosmic_comp::backend::init_backend_auto
                                                         21: cosmic_comp::run
                                                         22: cosmic_comp::main
                                                         23: std::sys::backtrace::__rust_begin_short_backtrace
                                                         24: main
                                                         25: __libc_start_call_main
                                                         26: __libc_start_main_alias_1
                                                         27: _start
Nov 23 13:28:30 <hostname> .cosmic-comp-wrapped[2515]: Failed to restore previous state. Error: Invalid argument (os error 22)
Nov 23 13:28:30 <hostname> cosmic-session[2466]: process ' COSMIC_SESSION_SOCK=12 cosmic-comp ' failed with code 101
Nov 23 13:28:30 <hostname> cosmic-session[2466]: cosmic-comp exited with error code 101
Nov 23 13:28:30 <hostname> cosmic-session[2466]: draining stdin receiver before restarting process
Nov 23 13:28:30 <hostname> cosmic-session[2467]: sleeping for 3ms before restarting process cosmic-comp (restart 0)
Nov 23 13:28:30 <hostname> cosmic-session[2466]: restarted process ' COSMIC_SESSION_SOCK=12 cosmic-comp ', now at 1 restarts
Nov 23 13:28:30 <hostname> cosmic-session[2466]: process 'ProcessKey(1v1)' cancelled
Nov 23 13:28:30 <hostname> cosmic-session[2466]: cosmic-comp exited with error code 137

Additional context

No response

System metadata

fetching path input 'path:/nix/store/rqigshwjn8kaj3g472gv0jk99xw85m40-source' these 6 paths will be fetched (0.77 MiB download, 10.25 MiB unpacked): /nix/store/vm303svk9lm31riwv42q75zbrbwrcypk-file-5.45 /nix/store/a7nvqa7rkfqpa6vspbncal3d6flbnyj8-gnu-config-2024-01-01 /nix/store/n7qxwqwbhxhrhdym3bhprf0lvymli2iv-gnumake-4.4.1 /nix/store/ayfx0nn300ggdkvdvjnhb17fqwdzq4fi-patchelf-0.15.2 /nix/store/k5z8rkvj1fn1nrf05l5a86aflc5s1p6m-stdenv-linux /nix/store/f8w8n1sdi14gkgwnmshgnannjfs5p976-update-autotools-gnu-config-scripts-hook copying path '/nix/store/a7nvqa7rkfqpa6vspbncal3d6flbnyj8-gnu-config-2024-01-01' from 'https://cache.nixos.org'... copying path '/nix/store/n7qxwqwbhxhrhdym3bhprf0lvymli2iv-gnumake-4.4.1' from 'https://cache.nixos.org'... copying path '/nix/store/vm303svk9lm31riwv42q75zbrbwrcypk-file-5.45' from 'https://cache.nixos.org'... copying path '/nix/store/ayfx0nn300ggdkvdvjnhb17fqwdzq4fi-patchelf-0.15.2' from 'https://cache.nixos.org'... copying path '/nix/store/f8w8n1sdi14gkgwnmshgnannjfs5p976-update-autotools-gnu-config-scripts-hook' from 'https://cache.nixos.org'... copying path '/nix/store/k5z8rkvj1fn1nrf05l5a86aflc5s1p6m-stdenv-linux' from 'https://cache.nixos.org'...

  • system: "x86_64-linux"
  • host os: Linux 6.17.8, NixOS, 25.11 (Xantusia), 25.11.20251121.2ac8b8e
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Lix, like Nix) 2.93.3 System type: x86_64-linux Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux, x86_64-v4-linux Features: gc, signed-caches System configuration file: /etc/nix/nix.conf User configuration files: ~/.config/nix/nix.conf:/nix/store/f2v7r2g04j7chwyl15xz1iasfs2kx80k-stylix-kde-config/nix/nix.conf:/etc/xdg/nix/nix.conf:~/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:~/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/<username>/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf Store directory: /nix/store State directory: /nix/var/nix Data directory: /nix/store/i6lm069c9din9v4ry6szspx5zrn0qzhv-lix-2.93.3/share
  • channels(root): "home-manager, nixos"
  • nixpkgs: /nix/store/rqigshwjn8kaj3g472gv0jk99xw85m40-source

Notify maintainers

@alyssais @nyabinary @HeitorAugustoLN @Pandapip1 @a-kenji @ahoneybun @drakon64 @michaelBelsanti @thefossguy


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a :+1: reaction to issues you find important.

me-it-is avatar Nov 23 '25 21:11 me-it-is

Could you provide more information about your hardware? Specifically your GPU, since the crash is related to libegl. Please also specify any NixOS configuration options that you may have "overridden" to be different than the values specified in the cosmic module.

thefossguy avatar Nov 24 '25 05:11 thefossguy

Looked into it from my end, and it looks like an issue with libgl than cosmic-comp.

thefossguy avatar Nov 24 '25 06:11 thefossguy

Same issue here after rebuilding this morning. cosmic-greeter hangs on boot. Works fine on by build from the 17th which was beta6. If it helps I am running a 9070xt GPU. If I drop in to a terminal and try to run cosmic-greeter from command line, I get the following:

The application panicked (crashed).
Message: Create event loop: NotSupported(NotSupportedError { reason: "neither WAYLAND_DISPLAY nor WAYLAND_SOCKET nor DISPLAY is set." })
Location: /build/cosmic-greeter-1.0.0-beta.6-vendor/iced_winit-0.14.0-dev/src/program.rs:185

tomwrw avatar Nov 24 '25 10:11 tomwrw

I am experiencing the same issue. Rebuilt this morning and I am login into a blinking terminal cursor instead of the GUI. Checking journalctl -b -1 | grep cosmic I got the following trace:

Nov 24 12:34:19 fractal systemd[1]: Starting cosmic-greeter-daemon.service...
Nov 24 12:34:20 fractal systemd[1]: Started cosmic-greeter-daemon.service.
Nov 24 12:34:25 fractal greetd[1465]: pam_unix(greetd:session): session opened for user cosmic-greeter(uid=991) by (uid=0)
Nov 24 12:34:25 fractal systemd-logind[932]: New session '1' of user 'cosmic-greeter' with class 'greeter' and type 'tty'.
Nov 24 12:34:25 fractal (systemd)[1469]: pam_unix(systemd-user:session): session opened for user cosmi-greeter(uid=991) by (uid=0)
Nov 24 12:34:25 fractal systemd-logind[932]: New session '2' of user 'cosmic-greeter' with class 'manager-early' and type 'unspecified'.
Nov 24 12:34:25 fractal systemd[1]: Started Session 1 of User cosmic-greeter.
Nov 24 12:34:25 fractal .cosmic-comp-wrapped[1497]: shortcuts custom config error: GetKey("custom", Os { code: 2, kind: NotFound, message: "No such file or directory" })
Nov 24 12:34:25 fractal .cosmic-comp-wrapped[1497]: Unable to become drm master, assuming unprivileged mode
Nov 24 12:34:25 fractal .cosmic-comp-wrapped[1497]: thread 'main' panicked at 'Failed to load LibEGL: DlOpen { desc: "libEGL.so.1: cannot open shared object file: No such file or directory" }': /build/cosmic-comp-1.0.0-beta.6-vendor/smithay-0.7.0/src/backend/egl/ffi.rs:148
                                                      17: cosmic_comp::backend::kms::device::init_egl
                                                      18: cosmic_comp::backend::kms::device::<impl cosmic_comp::state::State>::device_added
                                                      19: cosmic_comp::backend::kms::init_backend
                                                      20: cosmic_comp::backend::init_backend_auto
                                                      21: cosmic_comp::run
                                                      22: cosmic_comp::main
Nov 24 12:34:25 fractal .cosmic-comp-wrapped[1497]: Failed to restore previous state. Error: Invalid argument (os error 22)

EDIT: Forgot to mention, I am using an NVIDIA RTX 5070 Ti and not using mesa, if that helps.

rafaelcga avatar Nov 24 '25 11:11 rafaelcga

I am experiencing the same issue. Rebuilt this morning and I am login into a blinking terminal cursor instead of the GUI. Checking journalctl -b -1 | grep cosmic I got the following trace:

Nov 24 12:34:19 fractal systemd[1]: Starting cosmic-greeter-daemon.service...
Nov 24 12:34:20 fractal systemd[1]: Started cosmic-greeter-daemon.service.
Nov 24 12:34:25 fractal greetd[1465]: pam_unix(greetd:session): session opened for user cosmic-greeter(uid=991) by (uid=0)
Nov 24 12:34:25 fractal systemd-logind[932]: New session '1' of user 'cosmic-greeter' with class 'greeter' and type 'tty'.
Nov 24 12:34:25 fractal (systemd)[1469]: pam_unix(systemd-user:session): session opened for user cosmi-greeter(uid=991) by (uid=0)
Nov 24 12:34:25 fractal systemd-logind[932]: New session '2' of user 'cosmic-greeter' with class 'manager-early' and type 'unspecified'.
Nov 24 12:34:25 fractal systemd[1]: Started Session 1 of User cosmic-greeter.
Nov 24 12:34:25 fractal .cosmic-comp-wrapped[1497]: shortcuts custom config error: GetKey("custom", Os { code: 2, kind: NotFound, message: "No such file or directory" })
Nov 24 12:34:25 fractal .cosmic-comp-wrapped[1497]: Unable to become drm master, assuming unprivileged mode
Nov 24 12:34:25 fractal .cosmic-comp-wrapped[1497]: thread 'main' panicked at 'Failed to load LibEGL: DlOpen { desc: "libEGL.so.1: cannot open shared object file: No such file or directory" }': /build/cosmic-comp-1.0.0-beta.6-vendor/smithay-0.7.0/src/backend/egl/ffi.rs:148
                                                      17: cosmic_comp::backend::kms::device::init_egl
                                                      18: cosmic_comp::backend::kms::device::<impl cosmic_comp::state::State>::device_added
                                                      19: cosmic_comp::backend::kms::init_backend
                                                      20: cosmic_comp::backend::init_backend_auto
                                                      21: cosmic_comp::run
                                                      22: cosmic_comp::main
Nov 24 12:34:25 fractal .cosmic-comp-wrapped[1497]: Failed to restore previous state. Error: Invalid argument (os error 22)

Blinking cursor is exactly what I see. Also get the same journalctl output when I run journalctl -b -1 | grep cosmic.

tomwrw avatar Nov 24 '25 12:11 tomwrw

Going to update my nixpkgs and see if I can replicate. Since it looks like it might be libgl-related, if you're encountering this if you could post your GPU specs that could be helpful.

Update: I can reproduce, Intel UHD Graphics 620 @ 1.10 GHz. greetd.service complains that no client is connecting, but cosmic-greeter-daemon.service claims to be running. Will continue to investigate later.

Pandapip1 avatar Nov 24 '25 15:11 Pandapip1

I'm having this issue on an AMD Radeon 860M (the integrated GPU in my Ryzen AI 7 350)

busyboredom avatar Nov 24 '25 15:11 busyboredom

I have the same issue on my laptop after updating today, using AMD integrated graphics, Radeon 780M.

gg-plato avatar Nov 24 '25 15:11 gg-plato

Same issue with integrated Intel HD Graphics 630 + Nvidia GeForce 1050 (proprietary driver)

PaulGrandperrin avatar Nov 24 '25 15:11 PaulGrandperrin

It sure looks like this coincided with a staging-next -> master merge. There are a lot of apparmor updates, I wonder if one of them broke something: https://github.com/NixOS/nixpkgs/pull/461523/files. I'll build f04cb2ce24525ac95426ab0e0be99d785275d9bf and see if it's present there.

Pandapip1 avatar Nov 24 '25 15:11 Pandapip1

I'm using a 3080 with proprietary drivers and open source kernel modules. services.upower.enable is forced to false, and enviroment.cosmic.excludedPackages is set to an empty array.

me-it-is avatar Nov 24 '25 15:11 me-it-is

Does anyone have a Intel CPU and integrated Intel Graphics?

ahoneybun avatar Nov 24 '25 17:11 ahoneybun

Does anyone have a Intel CPU and integrated Intel Graphics?

I can confirm that this also affects Intel Integrated graphics :(

CPU: 12th Gen Intel i5-12600K (16) @ 4.900GHz GPU: Intel AlderLake-S GT1

BerriJ avatar Nov 24 '25 17:11 BerriJ

So far, I can confirm that this affects almost everyone. And as @Pandapip1 mentioned, this is likely with the staging branch that got merged which has the offending change. But, since it is "staging" bisecting it is more time consuming due to having to compile everything. Sorry about the delay everyone.

thefossguy avatar Nov 24 '25 17:11 thefossguy

25.11.20251121.2ac8b8e

~~Can other people here test nixpkgs 3045b8b4acecef460ff3ea647afb881429cba840?~~

~~I guess 2ac8b8ee243d52c2a4b429307c23fb72cac43a5c should be last nixos-unstable. Maybe the update itself it problematic.~~

Sorry, ignore me, it hasn't hit nixos-unstable yet

Aleksanaa avatar Nov 25 '25 12:11 Aleksanaa

This is the library runpath of cosmic-comp (.cosmic-comp-wrapped) on my checkout (last unstable, 25.11.20251117.89c2b23):

/nix/store/swjhi222w4k39v9qnrdpc81cy48xrry3-systemd-minimal-libs-258.1/lib:/nix/store/c63nhm2hpaly5rqszlr7v1n0l59bw96a-libdisplay-info-0.2.0/lib:/nix/store/c6bvfx2ifjh148lgssyz61j14ba0rdms-mesa-libgbm-25.1.0/lib:/nix/store/zwxqzsrwixj7y856aj0zj7nn2h30kzgc-seatd-0.9.1/lib:/nix/store/lgrb82lslvxgcv01dvxxqx6cjc3l3qdy-libglvnd-1.7.0/lib:/nix/store/33aq75hil456jsrm499mk9xs52gvm2hw-libxkbcommon-1.11.0/lib:/nix/store/rg7xk1jnf4i5sqn55s8x846mgp656lg9-libx11-1.8.12/lib:/nix/store/6gmsq848srwpqyngpnj0skg79vvf7dgw-libxcursor-1.2.3/lib:/nix/store/9fq4vmzjnq057mv3qh2khr7453sxmiax-libxi-1.8.2/lib:/nix/store/5cppx2vklr4sdb64ncr5pc560b1l889m-libxcb-1.17.0/lib:/nix/store/8b3xyfagi3cbb78386n33fa3l7w4jys4-wayland-1.24.0/lib:/nix/store/dmqbn2cmgq6b6p514a994dlsibkzbqsn-vulkan-loader-1.4.328.0/lib:/nix/store/c87hq2xwv305wilyrfk9yr7xfr3s6y9f-libinput-1.29.2/lib:/nix/store/6cpm4c516bsh6ya089n41djnlwmdjlw5-pixman-0.46.4/lib:/nix/store/rcp9sdrrq8sfxkm5zdykglx7hd2gzbfy-glibc-2.40-66/lib:/nix/store/fly29nz0gwiww48y76myy0mimv12wz5w-gcc-14.3.0-lib/lib

This is the library runpath on master:

/nix/store/q5fmjr9s9968bkv5bm3al5517x27bm19-systemd-minimal-libs-258.2/lib:/nix/store/8jdx9631lfk6y0k1ahp7v19nl6z80p1z-libdisplay-info-0.2.0/lib:/nix/store/pw8v6hlrg7lz2d3x115x3zy80bbhx1x9-mesa-libgbm-25.1.0/lib:/nix/store/pdg4d4h6pq8kg7s898nnlzm6sxdw42lq-seatd-0.9.1/lib:/nix/store/bhmkfqa9b9sakim9zan85ylsgam03b0x-libxkbcommon-1.11.0/lib:/nix/store/zv7jdwm1mk54q39rmnz65kmkh5fb72f6-libinput-1.29.2/lib:/nix/store/pw03xfrnb6a7nz6ivq6jijsx0n52afnp-pixman-0.46.4/lib:/nix/store/xx7cm72qy2c0643cm1ipngd87aqwkcdp-glibc-2.40-66/lib:/nix/store/xm08aqdd7pxcdhm0ak6aqb1v7hw5q6ri-gcc-14.3.0-lib/lib

/nix/store/lgrb82lslvxgcv01dvxxqx6cjc3l3qdy-libglvnd-1.7.0/lib contains libEGL.so.1, which is missing from the second runpath.

But why?

Aleksanaa avatar Nov 25 '25 14:11 Aleksanaa

This is also reproducible in Hydra with our tests. Last successful test: https://hydra.nixos.org/build/314090393 First failing test: https://hydra.nixos.org/build/314145796

So far, this narrowed the bisect between 117cc7f94e8072499b0a7aa4c52084fa4e11cc9b and 050e09e091117c3d7328c7b2b7b577492c43c134. At the moment, I'm in the middle of building the test for 6672824c7a1399883ec05cebf35acd2ef0192d38.

Again, my main slowdown here is compiling the world. :/

thefossguy avatar Nov 25 '25 14:11 thefossguy

This is also reproducible in Hydra with our tests. Last successful test: https://hydra.nixos.org/build/314090393 First failing test: https://hydra.nixos.org/build/314145796

So far, this narrowed the bisect between 117cc7f94e8072499b0a7aa4c52084fa4e11cc9b and 050e09e091117c3d7328c7b2b7b577492c43c134. At the moment, I'm in the middle of building the test for 6672824c7a1399883ec05cebf35acd2ef0192d38.

Again, my main slowdown here is compiling the world. :/

Is there an easy way to help you with this? I could help bisecting, but I just don't know where to start. Is there a flake that I could use to run the cosmic-tests and see if they fail?

BerriJ avatar Nov 25 '25 15:11 BerriJ

This is also reproducible in Hydra with our tests. Last successful test: https://hydra.nixos.org/build/314090393 First failing test: https://hydra.nixos.org/build/314145796 So far, this narrowed the bisect between 117cc7f94e8072499b0a7aa4c52084fa4e11cc9b and 050e09e091117c3d7328c7b2b7b577492c43c134. At the moment, I'm in the middle of building the test for 6672824c7a1399883ec05cebf35acd2ef0192d38. Again, my main slowdown here is compiling the world. :/

Is there an easy way to help you with this? I could help bisecting, but I just don't know where to start. Is there a flake that I could use to run the cosmic-tests and see if they fail?

Since I can reproduce with our VM tests, I am building the nixosTests.cosmic attribute and its status depends on what git-bisect gets. Following is my bisect log:

$ git bisect log
git bisect start
# status: waiting for both good and bad commits
# bad: [d021d06d5767c3eab8dc1b54cebee355528e18ff] amazon-q-cli: 1.19.6 -> 1.19.7 (#464182)
git bisect bad d021d06d5767c3eab8dc1b54cebee355528e18ff
# status: waiting for good commit(s), bad commit known
# good: [89c2b2330e733d6cdb5eae7b899326930c2c0648] olympus-unwrapped: 25.11.09.03 -> 25.11.15.08 (#462727)
git bisect good 89c2b2330e733d6cdb5eae7b899326930c2c0648
# good: [e0b9313a072cd5828f0a6456d8b738afeab7d3f8] tor-browser: set ffmpeg to version 7 (#463692)
git bisect good e0b9313a072cd5828f0a6456d8b738afeab7d3f8
# bad: [5a2983b62b3767905c05c958204ec3e2c8a6ebee] Merge master into staging-next
git bisect bad 5a2983b62b3767905c05c958204ec3e2c8a6ebee
# good: [3cd2a574e8b848b51b5491b9d0e158cd60b305d4] rsop: 0.8.0 -> 0.9.1 (#463926)
git bisect good 3cd2a574e8b848b51b5491b9d0e158cd60b305d4
# bad: [7f6e1d5d5957ba3221dc34d481a320c021572cd4] protobuf: add version alignment hint
git bisect bad 7f6e1d5d5957ba3221dc34d481a320c021572cd4
# bad: [77d71bdbf6c2d763af49f13cf644342d2930436e] curl: 8.16.0 -> 8.17.0 (#458808)
git bisect bad 77d71bdbf6c2d763af49f13cf644342d2930436e
# bad: [abedfe508203fa23a2b13df7d6918c8d715a8ec8] Merge staging-next into staging
git bisect bad abedfe508203fa23a2b13df7d6918c8d715a8ec8
# bad: [5846f8057b5908d4b4b6bf38814f0a7adea6746d] Merge staging-next into staging
git bisect bad 5846f8057b5908d4b4b6bf38814f0a7adea6746d
# good: [6672824c7a1399883ec05cebf35acd2ef0192d38] dav1d: 1.5.1 -> 1.5.2 (#457539)
git bisect good 6672824c7a1399883ec05cebf35acd2ef0192d38

In my case, I started with 89c2b2330e733d6cdb5eae7b899326930c2c0648 as the good commit since that's the last NixOS generation on my laptop with a working COSMIC session. Though, you can do the same (I don't recommend it because it really is very compute+time intensive) for 117cc7f94e8072499b0a7aa4c52084fa4e11cc9b.

Following is a pointer:

$ git bisect start
status: waiting for both good and bad commits

# taking SHA from the last successful job for `nixosTests.cosmic`
# https://hydra.nixos.org/build/314090393
$ git bisect good 117cc7f94e8072499b0a7aa4c52084fa4e11cc9b
status: waiting for bad commit, 1 good commit known

# taking SHA from the first failed job for `nixosTests.cosmic`
# https://hydra.nixos.org/build/314145796
$ git bisect bad 050e09e091117c3d7328c7b2b7b577492c43c134
Bisecting: 546 revisions left to test after this (roughly 9 steps)
[619ffab529670a2b3530d7f8406c9073f250708b] neocmakelsp: 0.8.26 -> 0.9.0

# repeat until you get to the offending commit and replace `rev=.*#` with whatever hash `git-bisect` gets back with
$ rm -f result*
$ nix build --max-jobs 5 github:nixos/nixpkgs?rev=619ffab529670a2b3530d7f8406c9073f250708b#nixosTests.cosmic 1>/dev/null 2>&1 || true
$ if [[ -L ./result ]]; then git bisect good; else git bisect bad; fi

thefossguy avatar Nov 25 '25 15:11 thefossguy

The exact problem is, rust stopped using CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS (in native compilation?)

Let's pick a victim, rustcat:

diff --git a/pkgs/by-name/ru/rustcat/package.nix b/pkgs/by-name/ru/rustcat/package.nix
index 65a241e99bc2..285452eaf751 100644
--- a/pkgs/by-name/ru/rustcat/package.nix
+++ b/pkgs/by-name/ru/rustcat/package.nix
@@ -3,6 +3,7 @@
   fetchFromGitHub,
   rustPlatform,
   versionCheckHook,
+  libglvnd,
 }:

 rustPlatform.buildRustPackage rec {
@@ -24,6 +25,18 @@ rustPlatform.buildRustPackage rec {

   versionCheckProgram = [ "${placeholder "out"}/bin/rcat" ];

+  buildInputs = [ libglvnd ];
+
+  env = {
+    CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS = toString (
+      map (arg: "-C link-arg=" + arg) [
+        "-Wl,--push-state,--no-as-needed"
+        "-lEGL"
+        "-Wl,--pop-state"
+      ]
+    );
+  };
+
   meta = {
     description = "Port listener and reverse shell";
     homepage = "https://github.com/robiot/rustcat";

Before staging-next:

 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [ld-linux-x86-64.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libEGL.so.1]
 0x000000000000001d (RUNPATH)            Library runpath: [/nix/store/lgrb82lslvxgcv01dvxxqx6cjc3l3qdy-libglvnd-1.7.0/lib:/nix/store/rcp9sdrrq8sfxkm5zdykglx7hd2gzbfy-glibc-2.40-66/lib:/nix/store/fly29nz0gwiww48y76myy0mimv12wz5w-gcc-14.3.0-lib/lib]

After:

 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [ld-linux-x86-64.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x000000000000001d (RUNPATH)            Library runpath: [/nix/store/xx7cm72qy2c0643cm1ipngd87aqwkcdp-glibc-2.40-66/lib:/nix/store/xm08aqdd7pxcdhm0ak6aqb1v7hw5q6ri-gcc-14.3.0-lib/lib]

While RUSTFLAGS is still effective. This is why niri doesn't break.

Aleksanaa avatar Nov 25 '25 16:11 Aleksanaa