I’m trying to package Av1an a rust project for Nix.
The same commit builds and runs without issue on Archlinux, but on Nixos, with buildRustPackage, the build completes but the resulting binary crashes with a SegFault immediately when run. Normally I’d just report this upstream, but since it works on Archlinux, that leads me to believe this is a build/linker environment issue with Nix.
First, since I’m a Nix newbie, please check the following derivation (I’m probably missing something, but I’ve checked the nixpkgs docs 5 times over and can’t find it).
Running the program without arguments normally should just print the help message and exit.
Running gdb on it shows:
(gdb) run
Starting program: /nix/store/dnwap73wx1c88acah9did14mkmn55vka-av1an-dev/bin/av1an
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/lqz6hmd86viw83f9qll2ip87jhb7p1ah-glibc-2.35-224/lib/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
Did you ever figure out a solution to this? I just spent several hours on this exact same problem lol. Running valgrind on it, it’s clear that it’s a plugin linking issue:
==1011250== Process terminating with default action of signal 11 (SIGSEGV)
==1011250== Bad permissions for mapped region at address 0x0
==1011250== at 0x0: ???
==1011250== by 0x49E2CA2: vsscript_createScript (in /nix/store/hfaaz0gkvk4bs439qkphqrq3n0n3wcy7-vapoursynth-63-with-plugins/lib/libvapoursynth-script.so.0.0.0)
==1011250== by 0x3B8742: vapoursynth::vsscript::environment::Environment::new (in /nix/store/m1h65hs7gs73hsxd583zi0pybfcw257n-Av1an-latest/bin/av1an)
==1011250== by 0x1AC99E: core::ops::function::FnOnce::call_once (in /nix/store/m1h65hs7gs73hsxd583zi0pybfcw257n-Av1an-latest/bin/av1an)
==1011250== by 0x211D69: once_cell::imp::OnceCell<T>::initialize::{{closure}} (in /nix/store/m1h65hs7gs73hsxd583zi0pybfcw257n-Av1an-latest/bin/av1an)
==1011250== by 0x32282E: once_cell::imp::initialize_or_wait (in /nix/store/m1h65hs7gs73hsxd583zi0pybfcw257n-Av1an-latest/bin/av1an)
==1011250== by 0x141FDB: once_cell::imp::OnceCell<T>::initialize (in /nix/store/m1h65hs7gs73hsxd583zi0pybfcw257n-Av1an-latest/bin/av1an)
==1011250== by 0x1AD7AE: core::ops::function::FnOnce::call_once (in /nix/store/m1h65hs7gs73hsxd583zi0pybfcw257n-Av1an-latest/bin/av1an)
==1011250== by 0x211EF7: once_cell::imp::OnceCell<T>::initialize::{{closure}} (in /nix/store/m1h65hs7gs73hsxd583zi0pybfcw257n-Av1an-latest/bin/av1an)
==1011250== by 0x32282E: once_cell::imp::initialize_or_wait (in /nix/store/m1h65hs7gs73hsxd583zi0pybfcw257n-Av1an-latest/bin/av1an)
==1011250== by 0x141DB1: once_cell::imp::OnceCell<T>::initialize (in /nix/store/m1h65hs7gs73hsxd583zi0pybfcw257n-Av1an-latest/bin/av1an)
==1011250== by 0x173E07: once_cell::imp::OnceCell<T>::initialize::{{closure}} (in /nix/store/m1h65hs7gs73hsxd583zi0pybfcw257n-Av1an-latest/bin/av1an)
I tried using vapoursynth.withPlugins to include plugins, but they don’t appear to be linked when I check ldd