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

Make gcc5 a nativeBuildInput for OpenCV. #27694

Closed
wants to merge 1 commit into from

Conversation

chpatrick
Copy link
Contributor

Motivation for this change

Previously gcc5 was a runtime dependency of opencv if CUDA was enabled, this fixes that.

Things done

Please check what applies. Note that these are not hard requirements but mereley serve as information for reviewers.

  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • 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/)
  • Fits CONTRIBUTING.md.

@dezgeg
Copy link
Contributor

dezgeg commented Jul 28, 2017

Are you sure this has any effect? nativeBuildInputs should only have a difference when cross compiling.

@chpatrick
Copy link
Contributor Author

chpatrick commented Jul 28, 2017 via email

@joachifm
Copy link
Contributor

@chpatrick the runtime/buildtime distinction has to do with where the code is supposed to be executed. If it is build-time only it must be compatible with the build machine; if it is run-time it must be compatible with the host machine (using gnu terminology). If build=host, then buildInputs=nativeBuildInputs.

@chpatrick
Copy link
Contributor Author

chpatrick commented Jul 28, 2017 via email

@joachifm
Copy link
Contributor

Absent enforcement, it makes no difference except for cross compilation. I agree with putting things in the correct variable, however, I was just elaborating on what I assumed @dezgeg was referring to.

@chpatrick
Copy link
Contributor Author

If build=host, then buildInputs=nativeBuildInputs.

Absent enforcement, it makes no difference except for cross compilation.

If you're building for the exact same architecture but a different physical machine, I don't believe that's considered cross compilation. However, buildInputs end up in your run-time closure and nativeBuildInputs don't, so I don't think it's correct to say that it's the same.

This means that in the the most common case where you aren't cross compiling, buildInputs and nativeBuildInputs are somewhat misleading names because the actual difference is whether they're build-time or run-time dependencies. This is why I think they're confusingly named and lead to unnecessary dependencies.

@joachifm
Copy link
Contributor

If you're building for the exact same architecture but a different physical machine, I don't believe that's considered cross compilation.

That's not what I'm saying ... In that case build=host, i.e. non-cross.

Consider

{ stdenv, bc }:

stdenv.mkDerivation rec {
  name = "native-capture";
  nativeBuildInputs = [ bc ];
  buildCommand = ''
     echo $nativeBuildInputs >$out
  '';
}

The closure of the result will contain bc &c. This is what I mean by absence of enforcement. The builder is free to capture references to "native" build inputs, so there is no distinction between buildInputs and nativeBuildInputs in that regard.

@joachifm
Copy link
Contributor

Anyway, more to the point, cc @mdaiter to review the change itself.

@globin
Copy link
Member

globin commented Jul 29, 2017

This will most probably not change anything as @joachifm and @dezgeg have tried to explain, probably the resulting executable has a reference to gcc itself. That might possibly be needed, possibly only in a string. You might want to look at removeReferencesTo for that. I would oppose merging this, unless you can show us dependency graphs that show that this really changes the runtime dependencies.

@joachifm joachifm closed this Sep 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants