-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rust build support doesn't use NIX_LDFLAGS
in link flags
#326944
Comments
I believe this is another case caused by rust-lang/rust#124129 |
I don't think this is a regression, it just looks like it was something that wasn't considered when the rust builder was created. It seems like all other packages that use the same workaround I used for ukmm were merged before rust-lang/rust#124129: |
Cosmic ones use dlopen so they require the no-as-needed flag to have the libraries added even without any symbol reference. What I have observed is that with Rust nightly even referenced symbols will not have rpath set properly. I guess what I see is a different bug with similar symptom. |
FWIW, I use |
@yrns Oh weird, do you have an example? I just tried doing that with ukmm again, and it's still not working, but maybe there's some hook/other dependency that I'm missing? Here's the derivation I tried for ukmm with
{
"/nix/store/509wijbz6njgpwjjy5n5m1frda1hqkrq-ukmm-0.15.0.drv": {
"args": [
"-e",
"/nix/store/v6x3cs394jgqfbi0a42pam708flxaphh-default-builder.sh"
],
"builder": "/nix/store/5mh7kaj2fyv8mk4sfq1brwxgc02884wi-bash-5.2p37/bin/bash",
"env": {
"NIX_LDFLAGS": "-rpath /nix/store/5mb70vg3kdzkyn0zqdgm4f87mdi0yi4i-libglvnd-1.7.0/lib:/nix/store/4fgxx1rc4x9vzzylyd192nkzb2ahva1p-libxkbcommon-1.7.0/lib:/nix/store/h1ydpxkw9qhjdxjpic1pdc2nirggyy6f-openssl-3.3.2/lib",
"PKG_CONFIG_ALLOW_CROSS": "0",
"__structuredAttrs": "",
"buildInputs": "/nix/store/wjpikbgivasi62j96csmdf5w00kkwnf9-libglvnd-1.7.0-dev /nix/store/6dir2ya69y1lr1shf95wh8gr0d1svd90-libxkbcommon-1.7.0-dev /nix/store/pp2zf8bdgyz60ds8vcshk2603gcjgp72-openssl-3.3.2-dev",
"builder": "/nix/store/5mh7kaj2fyv8mk4sfq1brwxgc02884wi-bash-5.2p37/bin/bash",
"cargoBuildFeatures": "",
"cargoBuildNoDefaultFeatures": "",
"cargoBuildType": "release",
"cargoCheckFeatures": "",
"cargoCheckNoDefaultFeatures": "",
"cargoCheckType": "release",
"cargoDeps": "/nix/store/13nv3f5r4r6y1gijjwayc2lglls447wh-cargo-vendor-dir",
"cargoTestFlags": "--all",
"checkFlags": "--skip=gui::tasks::tests::remerge --skip=pack::tests::pack_mod --skip=project::tests::project_from_mod --skip=tests::read_meta --skip=unpack::tests::read_mod --skip=unpack::tests::unpack_mod --skip=unpack::tests::unzip_mod --skip=bnp::test_convert",
"cmakeFlags": "",
"configureFlags": "",
"configurePhase": "runHook preConfigure\nrunHook postConfigure\n",
"depsBuildBuild": "",
"depsBuildBuildPropagated": "",
"depsBuildTarget": "",
"depsBuildTargetPropagated": "",
"depsHostHost": "",
"depsHostHostPropagated": "",
"depsTargetTarget": "",
"depsTargetTargetPropagated": "",
"doCheck": "1",
"doInstallCheck": "",
"mesonFlags": "",
"name": "ukmm-0.15.0",
"nativeBuildInputs": "/nix/store/38cffsqqx823crf1i4bcf6zz1qz1hgpd-cmake-3.30.5 /nix/store/0d4m43yp69lrm8imxbqgl9zxjwwz52jw-pkg-config-wrapper-0.29.2 /nix/store/0nmsi40rfxgv5r2c7673c9lv42rxvpb3-wrap-gapps-hook /nix/store/vyyrhvjd30x2mkmvjy6qc25lrpsx3xh1-auditable-cargo-1.83.0 /nix/store/jaqg4a9kdp2szqnswxizn60zhbg7q22n-cargo-build-hook.sh /nix/store/m8f1hgzp2aa6rgkf82c3r2j03lvmapqc-cargo-check-hook.sh /nix/store/7p2gx5daa4vnqcl4276acl06099n83qg-cargo-install-hook.sh /nix/store/394bbrkpyr7viwp942pkr92cz7k64066-cargo-setup-hook.sh /nix/store/ss0yarz4m14gcskw73makm0glkm5aj9a-rustc-wrapper-1.83.0",
"out": "/nix/store/mcqrl0b4py57a006mp7q2n2wcihigk8q-ukmm-0.15.0",
"outputs": "out",
"patches": "",
"pname": "ukmm",
"postUnpack": "eval \"$cargoDepsHook\"\n\nexport RUST_LOG=\n",
"propagatedBuildInputs": "",
"propagatedNativeBuildInputs": "",
"src": "/nix/store/9icmhij8x8kq04pp2mis4i21098j1k1z-source",
"stdenv": "/nix/store/d0gfdcag8bxzvg7ww4s7px4lf8sxisyx-stdenv-linux",
"strictDeps": "1",
"system": "x86_64-linux",
"version": "0.15.0"
},
"inputDrvs": {
"/nix/store/2qglsdxggm5033zb8nib4q07ng82yckv-cargo-check-hook.sh.drv": {
"dynamicOutputs": {},
"outputs": [
"out"
]
},
"/nix/store/30w5namr5bbg6zs0nfifw752s45ngd2b-auditable-cargo-1.83.0.drv": {
"dynamicOutputs": {},
"outputs": [
"out"
]
},
"/nix/store/5w1gxbwa8ixsvhfrgf9xilh3jg69dsd2-rustc-wrapper-1.83.0.drv": {
"dynamicOutputs": {},
"outputs": [
"out"
]
},
"/nix/store/asnfc1fbhcpnrhnk4kkrs5zrb5gdf5qs-stdenv-linux.drv": {
"dynamicOutputs": {},
"outputs": [
"out"
]
},
"/nix/store/cr5fwgmhs43bb4cn38dxq085k68iklwl-libglvnd-1.7.0.drv": {
"dynamicOutputs": {},
"outputs": [
"dev",
"out"
]
},
"/nix/store/f90qwklsn9pgx3arlmizh60zdwx48c7l-source.drv": {
"dynamicOutputs": {},
"outputs": [
"out"
]
},
"/nix/store/fg5phv5vlsr5yjpzn8kx51r0pipfhh0w-cargo-setup-hook.sh.drv": {
"dynamicOutputs": {},
"outputs": [
"out"
]
},
"/nix/store/gcindcflcp4jway4igjy500yaccm9bxv-cmake-3.30.5.drv": {
"dynamicOutputs": {},
"outputs": [
"out"
]
},
"/nix/store/hgrb9180br5gxj1k3v6cm3w0s2k74yfy-cargo-install-hook.sh.drv": {
"dynamicOutputs": {},
"outputs": [
"out"
]
},
"/nix/store/mwf8p4j7j6zyii3khpvb7hpg0i9pxy3s-cargo-vendor-dir.drv": {
"dynamicOutputs": {},
"outputs": [
"out"
]
},
"/nix/store/nnpgwwk2h5b3j4zg2lafjkb4xra4gb7x-pkg-config-wrapper-0.29.2.drv": {
"dynamicOutputs": {},
"outputs": [
"out"
]
},
"/nix/store/nw8mwm6wb25n9dgq61klw5d3ymfz4gf4-openssl-3.3.2.drv": {
"dynamicOutputs": {},
"outputs": [
"dev",
"out"
]
},
"/nix/store/q68v2ljr3cd4670yhssw7qf7z5nbax4n-wrap-gapps-hook.drv": {
"dynamicOutputs": {},
"outputs": [
"out"
]
},
"/nix/store/vlbyybhm6y33iw43l9swa9y1v13lyjvd-libxkbcommon-1.7.0.drv": {
"dynamicOutputs": {},
"outputs": [
"dev",
"out"
]
},
"/nix/store/vrx8z3fnwbcfggqhjmj1hz4szfw59fwh-bash-5.2p37.drv": {
"dynamicOutputs": {},
"outputs": [
"out"
]
},
"/nix/store/xqpz37816780dr8syh2k40d1ickwn2cc-cargo-build-hook.sh.drv": {
"dynamicOutputs": {},
"outputs": [
"out"
]
}
},
"inputSrcs": [
"/nix/store/v6x3cs394jgqfbi0a42pam708flxaphh-default-builder.sh"
],
"name": "ukmm-0.15.0",
"outputs": {
"out": {
"path": "/nix/store/mcqrl0b4py57a006mp7q2n2wcihigk8q-ukmm-0.15.0"
}
},
"system": "x86_64-linux"
}
} |
You're right, it doesn't work. I was using |
Oh wait... I think it's because the rust build links with NIX_LDFLAGS = [
"--push-state,--no-as-needed"
"-lEGL"
"-lwayland-client"
"-lxkbcommon"
"--pop-state"
]; I think this might be the culprit: nixpkgs/pkgs/development/compilers/rust/rustc.nix Lines 99 to 105 in 5048836
I'm not 100% sure, but I think |
Oh sorry never mind. The |
Rust always add |
Oh thanks @nbdd0121! That clears it up! I'll close this then since it was just a misunderstanding. |
Describe the bug
I was trying to use
NIX_LDFLAGS
instead ofLD_LIBRARY_PATH
in ukmm to link extra runtime libraries, but ukmm would silently fail to start: #325139 (comment). I noticed that a bunch of other packages were definingRUSTFLAGS
to handle this, so I just ended up using that instead, but it was surprising to see thatNIX_LDFLAGS
wouldn't work.Steps To Reproduce
Steps to reproduce the behavior:
NIX_LDFLAGS
setNIX_LDFLAGS
don't actually get linked in resulting binariesExpected behavior
NIX_LDFLAGS
should link extra libraries in rust like it does with packages built with c.Notify maintainers
@zowoq @winterqt @figsoda
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.The text was updated successfully, but these errors were encountered: