-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
strictDeps breaks libs in checkInputs #161570
Comments
today we only add them to nativeBuildInputs, but this is insufficient when strictDeps is true. also affects installCheckInputs. Fixes NixOS#161570
Related #53440 which added |
Reading this, I'm confused about checkInputs. I thought they were for testing..? In the example given here I'd definitely expect zlib to be in buildInputs, rather than checkInputs |
Yes the example is not credible but minimal. Actual use cases are for ocaml derivations: it is common to require additional deps to like oUnit2 build the executables that test the lib. These are needed to build executables which will not be installed, and thus are not runtime dependencies. Actual affected package: ocamlPackages.batteries https://github.com/NixOS/nixpkgs/pull/161344/files#diff-9b5b534f3d86a94e6b3b2a85dc60f09f76cf592b24850a7f291cc1f700cedba2 |
this could be also done in https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/ocaml/dune.nix |
needing extra libs to run tests is not isolated to ocaml. For example presage fails to find cppunit with strictDeps = true (it does not fail the build, but does not run unit tests). If I add cppunit to buildInputs, ./configure finds cppunit. Also not all ocaml packages are using dune, many of them are still using plain mkDerivation. |
Per 87651b3 this was originally TBH this is why I just don't really like |
Are you afraid that checkInputs might run setupHooks ? Plus the mental model "checkInputs are inputs added when doCheck is true" should be kept simple. The fact that it is added to both native and non native buildinputs comes from the fact that we never cross compile tests, so nativeCheckInputs makes no sense. |
Well consider the "env hooks" setup hooks do. What should those be run against? Also consider splicing, which does still happen in the I think I would either prefer
|
I had not thought of that. However adding checkInputs to both native and non native still looks correct to me in this case, unless you need target libs for checks, which would be weird as you can't run target executables during checks. And even if it really happens this is probably very rare, whereas we are talking about fixing every ocamlPackage and everything using cppunit and similar things.
That would be very impractical. Notably,
Why not. That would require a treewide change from checkInputs to checkNativeBuildInputs to keep current packages working. |
At the time I did not want to separate into a |
Since all current checkInputs are actually checkNativeBuildInputs, a "simple" sed on all files in nixpkgs probably works. |
Sorry for being slow in responding.
Err I mean |
Yay! Very glad to hear this. @symphorien so in conjunction with my previous comment, @FRidh is right. Many things which are #53440 has some more info. The emulators stuff I think at least is a good thought experiment. |
@siraben has recently made a program that uses treesitter to find these |
@Artturin I added that as one of the options in the tool. Here's some of the cases that it detects, correctly accounting for the list being split across multiple lines.
|
So, do we have a plan hear?
|
Actually I am confused again whether the Python libs should be native or not. Thinking about the emulator, the emulator would be native but everything it runs would not be native, right? |
Yeah, so most/all of the python stuff that is not the setup hook should stay |
@Ericson2314 I have a PR for strictDeps in OCaml, what can I change in that to prepare for these changes? |
mkDerivation change in #185406. Now what I need is a script for fixing all Python expressions. Should have fixed this right away since there are over 2000 Python expressions using |
Should I rebase my OCaml PR on yours @FRidh ? |
#206742 proposes a fix. |
When strictDeps is set, only nativeCheckInputs are added to PATH and only checkInputs can be linked against. See NixOS#161570
Describe the bug
checkInputs are added to nativeBuildInputs but not buildInputs when doCheck is set, so libs added to checkInputs cannot be found by compilers when strictDeps is true.
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/make-derivation.nix#L150-L151
Steps To Reproduce
When strictDeps is set, pkg-config fails to find zlib, whereas it finds it without strictDeps.
Note: needing libs in checkInputs is very common in ocamlPackages.
The text was updated successfully, but these errors were encountered: