| 9 Jan 2026 |
Theo Paris | * I am trying to test the cross compilation of the Redox OS libc package (https://gist.github.com/theoparis/bbee869f1647e5c14a614d73ba9e6fd0) and I ran into an infinite recursion error that seems to be coming from inside of buildRustPackage. I guess no one has tried packaging a libc with it before... Is this something that I'm doing wrong or would it need to be fixed inside of the nixpkgs rust handling code? | 07:07:56 |
Theo Paris | * I am trying to test the cross compilation of the Redox OS libc package (https://gist.github.com/theoparis/bbee869f1647e5c14a614d73ba9e6fd0) and I ran into an infinite recursion error that seems to be coming from inside of buildRustPackage. I guess no one has tried packaging a libc with it before... Is this something that I'm doing wrong or would it need to be fixed inside of the nixpkgs rust handling code somehow? | 07:08:21 |
| eveeifyeve joined the room. | 08:16:38 |
magnetophon | I'm trying to package https://github.com/zbanks/radiance
{
lib,
rustPlatform,
fetchFromGitHub,
pkg-config,
# autoPatchelfHook,
libxkbcommon,
mpv-unwrapped,
vulkan-loader,
stdenv,
darwin,
alsa-lib,
wayland,
xorg,
yt-dlp,
}:
rustPlatform.buildRustPackage rec {
pname = "radiance";
version = "0.7.0";
src = fetchFromGitHub {
owner = "zbanks";
repo = "radiance";
rev = version;
hash = "sha256-itBBUKwJAWfLPXZaJ65UbabDoZUUZtZm8bGAU0joVsQ=";
};
cargoLock.lockFile = ./Cargo.lock;
postPatch = ''
ln -s ${./Cargo.lock} Cargo.lock
'';
nativeBuildInputs = [
pkg-config
# autoPatchelfHook
];
buildInputs =
[
mpv-unwrapped
vulkan-loader
libxkbcommon
]
++ lib.optionals stdenv.isLinux [
alsa-lib
wayland
# X11 / XCB stack (required by winit + xkbcommon-dl)
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
xorg.libXinerama
xorg.libXpresent
xorg.libXfixes
xorg.libXext
# xorg.libXss
xorg.libxcb
# xorg.libX11-xcb
]
++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.AppKit
darwin.apple_sdk.frameworks.CoreGraphics
darwin.apple_sdk.frameworks.CoreServices
darwin.apple_sdk.frameworks.Foundation
darwin.apple_sdk.frameworks.Metal
darwin.apple_sdk.frameworks.QuartzCore
];
propagatedUserEnvPkgs = [
yt-dlp
];
# Floating-point exact-equality bugs upstream
doCheck = false;
meta = {
description = "Video art software for VJs";
homepage = "https://github.com/zbanks/radiance";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ magnetophon ];
mainProgram = "radiance";
};
}
When I run it, I get:
❯ radiance
thread 'main' (1930947) panicked at /build/cargo-vendor-dir/xkbcommon-dl-0.4.2/src/x11.rs:59:28:
Library libxkbcommon-x11.so could not be loaded.
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: core::option::expect_failed
3: xkbcommon_dl::x11::xkbcommon_x11_handle
4: std::sync::poison::once::Once::call_once_force::{{closure}}
5: std::sys::sync::once::futex::Once::call
6: std::sync::once_lock::OnceLock<T>::initialize
7: winit::platform_impl::linux::common::xkb::Context::from_x11_xkb
8: winit::platform_impl::linux::EventLoop<T>::new
9: radiance::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Any ideas on how to fix that?
| 15:36:38 |
Epic Eric | I think you need to put libxkbcommon as a nativeBuildInput so it's available as a runtime dep | 15:38:49 |
K900 | That's not what nativeBuildInputs do | 15:39:14 |
K900 | And you probably need to add it to rpath | 15:39:18 |
Epic Eric | Oops | 15:39:22 |
magnetophon | Thanks. Like this?
preFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
patchelf \
--set-rpath "${lib.makeLibraryPath buildInputs}:$out/lib" \
$out/bin/radiance
'';
| 15:43:40 |
K900 | buildInputs is suboptimal | 15:44:01 |
K900 | You probably want only the things it dlopens | 15:44:08 |
magnetophon | ok, thanks.
I'll see if it runs with this (already building), and then minimize it. | 15:44:54 |
magnetophon | I still get:
❯ radiance
thread 'main' (2015441) panicked at /build/cargo-vendor-dir/xkbcommon-dl-0.4.2/src/x11.rs:59:28:
Library libxkbcommon-x11.so could not be loaded.
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: core::option::expect_failed
3: xkbcommon_dl::x11::xkbcommon_x11_handle
4: std::sync::poison::once::Once::call_once_force::{{closure}}
5: std::sys::sync::once::futex::Once::call
6: std::sync::once_lock::OnceLock<T>::initialize
7: winit::platform_impl::linux::common::xkb::Context::from_x11_xkb
8: winit::platform_impl::linux::EventLoop<T>::new
9: radiance::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Any ideas?
| 15:49:40 |
K900 | And libxkbcommon is in your buildInputs? | 15:50:24 |
magnetophon | This is with this snippet, so AFAIK all my buildInputs are in the rpath now. | 15:52:16 |
K900 | But what is in your buildInputs? | 15:53:02 |
magnetophon | buildInputs =
[
mpv-unwrapped
vulkan-loader
libxkbcommon
]
++ lib.optionals stdenv.isLinux [
alsa-lib
wayland
# X11 / XCB stack (required by winit + xkbcommon-dl)
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
xorg.libXinerama
xorg.libXpresent
xorg.libXfixes
xorg.libXext
# xorg.libXss
xorg.libxcb
# xorg.libX11-xcb
]
++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.AppKit
darwin.apple_sdk.frameworks.CoreGraphics
darwin.apple_sdk.frameworks.CoreServices
darwin.apple_sdk.frameworks.Foundation
darwin.apple_sdk.frameworks.Metal
darwin.apple_sdk.frameworks.QuartzCore
];
| 15:53:35 |
K900 | Hmm weird | 15:54:29 |
K900 | What does patchelf --print-rpath $out/bin/radiance say? | 15:54:38 |
magnetophon | patchelf --print-rpath /nix/store/yhg16w5915bbvpadk8ibxj9x8kria7pw-radiance-0.7.0/bin/radiance
/nix/store/5vwc8q3c7hn7s01qbpsicv4zjk3p2nci-mpv-0.41.0/lib:/nix/store/f0mf3rlv29ql40qx36kqd2jzabd1m0s0-alsa-lib-1.2.14/lib:/nix/store/ii3ybky5dqjikcrw7vdnh1j76ssy0ycm-libx11-1.8.12/lib | 15:55:40 |
magnetophon | hmm, so it's missing a lot, right?
| 15:56:02 |
K900 | OK so that's not in there | 15:56:03 |
K900 | That's interesting | 15:56:07 |
K900 | Oh, you probably need to also --add-needed it | 15:56:13 |
magnetophon | I did:
preFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
patchelf \
--set-rpath --add-needed "${lib.makeLibraryPath buildInputs}:$out/lib" \
$out/bin/radiance
'';
And now I get:
radiance> Running phase: fixupPhase
radiance> patchelf: getting info about '/nix/store/5vwc8q3c7hn7s01qbpsicv4zjk3p2nci-mpv-0.41.0/lib:/nix/store/jzng5i2xwsdlf3h60a5s6qzr2808c9zc-vulkan-loader-1.4.335.0/lib:/nix/store/91mg839gbvgz1svzlh1jvz0pqvx7ylwh-libxkbcommon-1.11.0/lib:/nix/store/f0mf3rlv29ql40qx36kqd2jzabd1m0s0-alsa-lib-1.2.14/lib:/nix/store/7m6x6b4ljrkmkbhvbxdcacpraxj49xkj-wayland-1.24.0/lib:/nix/store/ii3ybky5dqjikcrw7vdnh1j76ssy0ycm-libx11-1.8.12/lib:/nix/store/bb5xxw11ndww7iivcmdpxga9n1da24vg-libxcursor-1.2.3/lib:/nix/store/x1f9a0qsj6a1y5nf178naagm2vbxnazc-libxi-1.8.2/lib:/nix/store/dyn0y5clf5b556yqwmj4841h43hz75p6-libxrandr-1.5.4/lib:/nix/store/0r6d7iw0q9wgxxj28zy87n1gjwvk0klp-libxinerama-1.1.5/lib:/nix/store/hlkf0rilmbwi8hvbvc9rswglmsc1mpq5-libxpresent-1.0.2/lib:/nix/store/2dac9gfiim278y2c6mxrklpzzfka7ra1-libxfixes-6.0.2/lib:/nix/store/zshby6nalhw4mvap0rr97hv042808c2k-libxext-1.3.6/lib:/nix/store/m0jzvlr5gl7zvdn0fr7c09mjwx65fx58-libxcb-1.17.0/lib:/nix/store/d3dgbv5q78fdcswpznc20ipnjdna4mcp-radiance-0.7.0/lib': No such file or directory
| 16:03:18 |
K900 | Not like that | 16:03:33 |
K900 | You want --add-rpath <that stuff> --add-needed libxkbcommon-x11.so | 16:03:48 |
magnetophon | ah, thanks | 16:04:09 |
magnetophon | YES! It runs now!
Thank you so much!
Next step: minimize rpath. :) | 16:14:49 |
Ralith | has anyone worked out why rustc started stripping rpath by default some time in the last year or so? | 20:50:31 |