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

ocamlPackages.utop: fix environment variables #25122

Merged
merged 4 commits into from May 1, 2017

Conversation

pmahoney
Copy link
Contributor

@pmahoney pmahoney commented Apr 22, 2017

Motivation for this change

Given a nix-shell with ocamlPackages.core on OCAMLPATH, utop is unable to load Core.Std. The error was:

findlib: [WARNING] cannot read directory $OCAMLPATH: No such file or directory

This is because the wrapper script inserts a literal $OCAMLPATH into the $OCAMLPATH environment variable, rather than expanding the existing value.

This has not received extensive testing, but does solve my immediate problem. I'd like to get feedback from @vbgl or @FlorentBecker. Would also like to test on Linux at least, possibly NixOS.

Things done
  • 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 compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • (utop and utop-full only) Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

This adds the shared objects setup hook to prepare
CAML_LD_LIBRARY_PATH.
This adds the shared objects setup hook to prepare
CAML_LD_LIBRARY_PATH.
@mention-bot
Copy link

@pmahoney, thanks for your PR! By analyzing the history of the files in this pull request, we identified @FlorentBecker, @vbgl and @maggesi to be potential reviewers.

@vbgl
Copy link
Contributor

vbgl commented Apr 23, 2017

This reintroduces #24496.

In the wrapper scripts, both OCAMLPATH and CAML_LD_LIBRARY_PATH where
being created with a trailing literal $OCAMLPATH, rather than the
expanded version. Thus if, for example, ocamlPackages.core was present
in OCAMLPATH prior to running utop, the wrapper script would set the
variable to $utop_dependencies:'$OCAMLPATH', and when using utop to
open Core.Std, the following error was reported:

    findlib: [WARNING] cannot read directory $OCAMLPATH: No such file
    or directory

This patch fixes the quoting issue, and further refactors the build to
use standard wrapProgram helper, and uses an "inner derivation" to
re-use the setupHook machinery of buildOCaml and findlib instead of
manually specifying the OCAMLPATH required for utop along with
transitive dependencies.
@pmahoney
Copy link
Contributor Author

@vbgl I've updated with a fix for #24496

Tested on NixOS with OCaml 4.02 and 4.04.

@pmahoney
Copy link
Contributor Author

@vbgl ping. utop is completely broken for me without this patch (at least when using Core).

@7c6f434c 7c6f434c merged commit 6955d02 into NixOS:master May 1, 2017
@7c6f434c
Copy link
Member

7c6f434c commented May 1, 2017

Merged, hopefully correctly…

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