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

OCaml findlib doesn't install topfind #16085

angrygoats opened this Issue Jun 9, 2016 · 6 comments


None yet
4 participants

angrygoats commented Jun 9, 2016

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:


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

#use "topfind";;
#require "";;
#require "core.syntax";;

Now, type ocaml. You will be greeted by:

Cannot find file topfind.

Technical details

  • System: 16.03.898.3111985 (Emu)
  • Nix version: nix-env (Nix) 1.11.2
  • Nixpkgs version: "16.03.898.3111985"

This comment has been minimized.


regnat commented Jun 9, 2016

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.


This comment has been minimized.

angrygoats commented Jun 9, 2016

@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!


This comment has been minimized.


regnat commented Jun 10, 2016

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

Tell me if anything is unclear


This comment has been minimized.


regnat commented Sep 23, 2016

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


This comment has been minimized.


FlorentBecker commented Feb 21, 2017

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

@Mic92 Mic92 referenced this issue Jun 15, 2017


ocamlPackages.utop: allow utop to locate topfile #26599

3 of 7 tasks complete

@Mic92 Mic92 closed this in #26599 Jun 15, 2017

@Mic92 Mic92 reopened this Jun 15, 2017


This comment has been minimized.


Mic92 commented Jun 15, 2017

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

@Mic92 Mic92 closed this in 8ac0e68 Jun 15, 2017

Mic92 added a commit to Mic92/nixpkgs that referenced this issue Jun 19, 2017

@Mic92 Mic92 reopened this Apr 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment