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
jq: fix darwin build #44200
jq: fix darwin build #44200
Conversation
The tests depend on libjq which isn't installed in the correct location yet when the checkPhase runs.
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec { | |||
sha256="0g29kyz4ykasdcrb0zmbrp2jqs9kv1wz9swx849i2d1ncknbzln4"; | |||
}; | |||
|
|||
outputs = [ "bin" "doc" "man" "dev" "lib" "out" ]; | |||
outputs = [ "out" "doc" "man" "dev" "lib" ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think:
outputs = [ "bin" "doc" "man" "dev" "out" ];
is more conventional. lib
is quite rare.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree out
is the default output when unspecified, anything with multiple outputs should name the others accordingly. I don't want to look at the package definition to figure out what the default output is.
[ "bin" "lib" ] == [ "out" "lib" ]
[ "lib" "bin" ] == [ "out" "bin" ]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another reason not to do this.
$ nix-build -A jq
/nix/store/sxp3lykdfknlxkkp7wr0g4jj2xh5cnlz-jq-1.5-bin
$ ./result/bin/jq
zsh: no such file or directory: ./result/bin/jq
$ ls
default.nix result-bin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well that's just how all the other multiple-output packages currently work. In retrospect, it would have been good to be able to say e.g. outputs = [ "bin" "doc" "man" "dev" "lib" ];
i.e. no out
anywhere, but this is how things are now.
Typically you don't need to know the name of the default output (except your nix-build
example), because ${jq}/bin/jq
and buildInputs = [ jq ];
both work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No out
anywhere: you typically need to pass some $PREFIX
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see https://nixos.org/nixpkgs/manual/#idm140737317822720, and 4.4.1
especially.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I still disagree but there seems to be consensus so I'll drop this part.
Success on aarch64-linux (full log) Attempted: jq Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: jq Partial log (click to expand)
|
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec { | |||
sha256="0g29kyz4ykasdcrb0zmbrp2jqs9kv1wz9swx849i2d1ncknbzln4"; | |||
}; | |||
|
|||
outputs = [ "bin" "doc" "man" "dev" "lib" "out" ]; | |||
outputs = [ "out" "doc" "man" "dev" "lib" ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see https://nixos.org/nixpkgs/manual/#idm140737317822720, and 4.4.1
especially.
doInstallCheck = true; | ||
doCheck = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’d rather enable these tests and disable them selectively on darwin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what you mean by that, this doesn't disable any tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is postInstallCheck
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what you mean by that, this doesn't disable any tests.
You quite obviously removed doCheck = true
.
Why does it fail with doCheck
(which runs make check
), but succeed with installCheckTarget = "check"
then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this does is run the tests after the libraries are installed installed to $lib instead of before, the tests failed because the libjq wasn't in the expected install location yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why it worked on linux then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way libraries are linked is a bit different on darwin, we link directly against libraries using their absolute path instead of using RPATH. I could have worked around it with DYLD_LIBRARY_PATH, but that's a bit harder and probably more brittle.
Success on x86_64-darwin (full log) Attempted: jq Partial log (click to expand)
|
Success on x86_64-darwin (full log) Attempted: jq Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: jq Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: jq Partial log (click to expand)
|
Motivation for this change
One of the tests failed on my builder but not locally because of some kind of timezone issue, hopefully this isn't also a problem on hydra.
/cc @Mic92
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)