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

R: Workaround to make which a run-time dependency #58989

Closed
wants to merge 1 commit into from

Conversation

rhokue
Copy link
Contributor

@rhokue rhokue commented Apr 5, 2019

Workaround for issue #58963.

Motivation for this change

See issue #58963.

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 nix-review --run "nix-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)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@veprbl
Copy link
Member

veprbl commented Apr 5, 2019

If you wanted you could set propagatedBuildInputs to do this more conventionally.
But you already found that the WHICH is not set properly #58963 (comment). You could try adding definition like "WHICH=$(type -p which)" into configureFlagsArray. Worst case there is an ugly hack to directly substituteInPlace the @WHICH@ in src/library/base/R/unix/system.unix.R, but that should not be needed, I expect.

Copy link
Member

@peti peti left a comment

Choose a reason for hiding this comment

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

Please try adding WHICH=${which}/bin/which into configureFlagsArray to make R bake the full path into its binary. That would be a much better solution.

@rhokue
Copy link
Contributor Author

rhokue commented Apr 6, 2019

@peti, @veprbl, but stracing R showed that R is indeed trying to access to which under /nix/store.

Also, after configurePhase, the file config.status contained the line S["WHICH"]="/nix/store/ckd1dy6llxr1s17f9x27p9jwzdanl5yx-which-2.21/bin/which" and config.log contained the line ac_cv_path_WHICH=/nix/store/ckd1dy6llxr1s17f9x27p9jwzdanl5yx-which-2.21/bin/which.

@veprbl
Copy link
Member

veprbl commented Apr 6, 2019

@rhokue
In that trace the execve returns ENOENT which stands for

The file filename or a script or ELF interpreter does not exist, or a shared library needed for file or interpreter cannot be found.

So what happens? Does "which" get garbage collected? Or is it sandboxing?

@rhokue
Copy link
Contributor Author

rhokue commented Apr 6, 2019

@veprbl I don't know...

Copy link
Member

@veprbl veprbl left a comment

Choose a reason for hiding this comment

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

It seems like the path to which is correctly picked up by the build, but it doesn't appear in plaintext in any of the installed files. The problem shows up if which gets garbage collected or not downloaded from binary cache.

@rhokue
Copy link
Contributor Author

rhokue commented Apr 7, 2019

Yes, @veprbl, your description matches my experience and the investigations which @cleverca22 and I made while chatting on IRC, during which we used strings command to see if the path to the which binary is readable in any file. But it wasn't. Which is strange but it is how it is, I guess?

So, it would be nice if @peti could approve this PR as well. :)

@peti
Copy link
Member

peti commented Apr 7, 2019

@peti, @veprbl, but stracing R showed that R is indeed trying to access to which under /nix/store.

If that path were baked into the R executable (or any of its libraries), then Nix would recognize the run-time dependency. I don't know where that store path is coming from, but it's clearly not a part of the the R binary package, or else it could not possibly be missing at run-time.

@peti peti closed this in cbade45 Apr 7, 2019
markuskowa pushed a commit to r-ryantm/nixpkgs that referenced this pull request Apr 7, 2019
@eadwu
Copy link
Member

eadwu commented Apr 7, 2019

Breaks my build.

builder for '/nix/store/ghsyv8c8677jyqc9c16vxphgdvh6hrrh-R-3.5.3.drv' failed with exit code 1; last 10 log lines:
  -texlive-combined-2018/share/texmf/fonts/type1/public/amsfonts/cm/cmti10.pfb></
  nix/store/2yfzvjnsgzvv1vr3f00idncsshyzzkxq-texlive-combined-2018/share/texmf/fo
  nts/type1/public/amsfonts/cm/cmtt10.pfb></nix/store/2yfzvjnsgzvv1vr3f00idncsshy
  zzkxq-texlive-combined-2018/share/texmf/fonts/type1/public/amsfonts/cm/cmtt9.pf
  b>
  Output written on R-lang.pdf (60 pages, 374816 bytes).
  Transcript written on R-lang.log.
  installing R manuals in PDF format ...
  make[1]: Leaving directory '/build/R-3.5.3/doc/manual'
  /nix/store/63karsgdg7fm3q0if4zfd7apbd8ac1ci-stdenv-linux/setup: line 99: /nix/store/l29hk8hpz3k8j4kha4p2mjvnhbax0d03-R-3.5.3/nix-support/undetected-runtime-dependencies: No such file or directory
cannot build derivation '/nix/store/hcz4in4mqix7kszjyp81d0cabnfmlsv7-R-3.5.3-wrapper.drv': 1 dependencies couldn't be built

@vcunat
Copy link
Member

vcunat commented Apr 7, 2019

Builds again after f7ddff5.

vcunat added a commit that referenced this pull request Apr 7, 2019
Normally the directory is created in fixup phase.
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

7 participants