NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.15k stars 14.18k forks source link

OCaml findlib doesn't install topfind #16085

Open angrygoats opened 8 years ago

angrygoats commented 8 years ago

Issue description

It seems that findlib doesn't install topfind even though the package implies it should here in this patch. This is a problem, utop with Core.Std requires it.

Steps to reproduce

My nix config is available here for my development software.

The relevant packages are installed as follows:

 ocaml                                        
 ocamlPackages.findlib              
 ocamlPackages.ocaml_lwt       
 ocamlPackages.ocaml_oasis     
 ocamlPackages.utop                 

Now create a .ocamlinit in your root directory (~) and place the following in it:

#use "topfind";;
#thread;;
#camlp4o;;
#require "core.top";;
#require "core.syntax";;

Now, type ocaml. You will be greeted by:

Cannot find file topfind.

Technical details

thufschmitt commented 8 years ago

If you use utop, it shouldn't be a problem since it does its own initialization of findlib, so you don't need the #use "topfind";; line.

For the stock toplevel, this error seems normal to me according to the package description -- topfind is installed by default in the same directory as ocaml, but as it isn't possible with nix, the patch makes it installed aside findlib, and the toplevel can't find it. I think the simplest workaround would be to create a wrapper for ocaml which searches for a topfind file in the correct directory.

angrygoats commented 8 years ago

@regnat thank you for your reply. I am still learning nixos so I apologize if this is a dumb question, but wrapper? How do I do that? If you could point me to somewhere in the manual to get me started that'd be great!

thufschmitt commented 8 years ago

I meant creating a derivation (a "package" in nix terminology) containing a script to launch ocaml with the correct include path. this should do it -- the makeWrapper function is described here if you want some more infos about it. To add it to your packages, you can use http://nixos.org/nixpkgs/manual/#sec-modify-via-packageOverrides.

Tell me if anything is unclear

thufschmitt commented 8 years ago

@angrygoats, if everything is OK, can you close the issue ? (I don't have the rights to do it myself)

FlorentBecker commented 7 years ago

I think the suggestion to make ocaml (the top-level) a topfind aware wrapper is still relevant and not yet done.

Mic92 commented 7 years ago

Fix is still incomplete I only addressed utop and not ocaml itself.

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.
kototama commented 3 years ago

See https://discourse.nixos.org/t/ocaml-utop-on-nixos-not-detecting-libraries/1587 for using utop as an alternative.

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info