Skip to content
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

Merged
merged 1 commit into from Jul 30, 2018
Merged

jq: fix darwin build #44200

merged 1 commit into from Jul 30, 2018

Conversation

LnL7
Copy link
Member

@LnL7 LnL7 commented Jul 29, 2018

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
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

The tests depend on libjq which isn't installed in the correct location
yet when the checkPhase runs.
@GrahamcOfBorg GrahamcOfBorg added the 6.topic: darwin Running or building packages on Darwin label Jul 29, 2018
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
sha256="0g29kyz4ykasdcrb0zmbrp2jqs9kv1wz9swx849i2d1ncknbzln4";
};

outputs = [ "bin" "doc" "man" "dev" "lib" "out" ];
outputs = [ "out" "doc" "man" "dev" "lib" ];
Copy link
Contributor

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.

Copy link
Member Author

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" ]

Copy link
Member Author

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

Copy link
Contributor

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.

Copy link
Member

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...

Copy link
Member

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.

Copy link
Member Author

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.

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: jq

Partial log (click to expand)

# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[3]: Leaving directory '/build/jq-1.5'
make[2]: Leaving directory '/build/jq-1.5'
make[1]: Leaving directory '/build/jq-1.5'
/nix/store/lqj8gylg4sajwbxjkf0c6z243nxb8pyj-jq-1.5

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: jq

Partial log (click to expand)

# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[3]: Leaving directory '/build/jq-1.5'
make[2]: Leaving directory '/build/jq-1.5'
make[1]: Leaving directory '/build/jq-1.5'
/nix/store/wx62bn48vc9n65l7k6wcj5apmnyysjjy-jq-1.5

@Mic92 Mic92 mentioned this pull request Jul 30, 2018
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
sha256="0g29kyz4ykasdcrb0zmbrp2jqs9kv1wz9swx849i2d1ncknbzln4";
};

outputs = [ "bin" "doc" "man" "dev" "lib" "out" ];
outputs = [ "out" "doc" "man" "dev" "lib" ];
Copy link
Member

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;
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is postInstallCheck.

Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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.

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: jq

Partial log (click to expand)

# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[3]: Leaving directory '/private/tmp/nix-build-jq-1.5.drv-0/jq-1.5'
make[2]: Leaving directory '/private/tmp/nix-build-jq-1.5.drv-0/jq-1.5'
make[1]: Leaving directory '/private/tmp/nix-build-jq-1.5.drv-0/jq-1.5'
/nix/store/mh9f4wjwq9y6sdlxkqv8db367v1hvnfm-jq-1.5

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: jq

Partial log (click to expand)

# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[3]: Leaving directory '/private/tmp/nix-build-jq-1.5.drv-0/jq-1.5'
make[2]: Leaving directory '/private/tmp/nix-build-jq-1.5.drv-0/jq-1.5'
make[1]: Leaving directory '/private/tmp/nix-build-jq-1.5.drv-0/jq-1.5'
/nix/store/6fcd8i8qkhn92bdjnjzmbs6knwry590z-jq-1.5-bin

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: jq

Partial log (click to expand)

# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[3]: Leaving directory '/build/jq-1.5'
make[2]: Leaving directory '/build/jq-1.5'
make[1]: Leaving directory '/build/jq-1.5'
/nix/store/sxp3lykdfknlxkkp7wr0g4jj2xh5cnlz-jq-1.5-bin

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: jq

Partial log (click to expand)

# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[3]: Leaving directory '/build/jq-1.5'
make[2]: Leaving directory '/build/jq-1.5'
make[1]: Leaving directory '/build/jq-1.5'
/nix/store/z9w7l1zgsd2pijzpz9b7mkm8kps08dsx-jq-1.5-bin

@Profpatsch Profpatsch merged commit aeab0ec into NixOS:master Jul 30, 2018
@LnL7 LnL7 deleted the darwin-jq branch July 30, 2018 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants