Error while setting up ocaml project using WSL

hello , I’ve been trying to set up my local environment for the OCaml project with ubuntu 20.04 LTS. I’ve installed all the dependencies required (mentioned in the readme) along with any error that is related to any installation dependency has been resolved. but when I try to run - make.
i get this error :
ocamlfind ocamlc -annot -g -safe-string -package netstring,syndic -c script/ -o script/utils.cmi
make: ocamlfind: Command not found
make: *** [Makefile.common:119: script/utils.cmi] Error 127.
I’m stuck on this for a long time now and wish to move ahead with the contributions. it would be great if I can get some guidance on how to resolve this. (I’m a newbie to LINUX , and just installed it for this project so I’m not much aware of how things work.)

The error above states that make cannot find and run executable ‘ocamlfind’.

According to the guide below:

opam install ocamlfind

should work if opam and ocaml is installed.

@patricoferris posted this guide in a different post for Windows / WSL / Ubuntu

1 Like


Full disclaimer, I’m no windows expert. It looks like you’re working on the site. Thanks @soya :)) As has been mentioned there’s a section in that guide specifically about ocamlfind. There is also a slightly more in-depth contributing guide for that may help.

Can you double check what opam install ocamlfind does?

To clarify, which dependencies have you installed? There’s a list of non-ocaml ones like rsync and curl but this error looks related to not installing opam and then not running make deps which will try to install the OCaml-related dependencies such as ocamlfind? Failing that it could be something wrong with the PATH variable and you need to run eval $(opam env) perhaps to add the place where opam puts binaries (like ocamlfind) into PATH.

Just for future reference, these questions are probably better over on the repo site just so the context is clearer (i.e. you are trying to build and you can get tailored help quicker from people who are working on the site. In addition to that, it makes it easier for us to improve our contributing docs too with your help :))

Hopefully we can get this resolved for you soon.

1 Like

We don’t know how you installed ocaml(1), nor any tools for Ocaml like opam(1), which is like the package manager for Ocaml. Much like apt(1) is the package manager for Debian and Ubuntu.

As stated by the make commande, it can’t find the ocamfind command. You could try to verify that with just write the command name in the command line.

So you probably need to install that command in the same way you installed ocaml(1).

So, if you installed Ocaml from the Ubuntu repository, do: sudo apt intstall ocamlfind
If you used Opam to install Ocaml, see to it thet you have the proper environment for the version of Ocaml you use. The ocamlfind(1) should be installed. Try to run this command to set it up manually just before you enter the make(1) command: env $(opam env)

For fun try opam env to see what happen. That is what environment variables in the shell that are set by Opam.

If it doesn’t help, please give us more information.

I followed the steps mentioned by you. I wrote ocamlfind in command line and got the installing instructions as - sudo apt install ocaml-findlib. this installed ocamlfind.
now when I run make , I get a different error from the previous one

i also did opam init --disable-sandboxing and got -

For fun try opam env to see what happen. That is what environment variables in the shell that are set by Opam.
when I did , opam env : I got

could you please guide me a bit further to get this working :))


It looks like opam is setup (I’m not quite sure why there are two switches in your PATH variable). Installing a system ocamlfind probably wasn’t/isn’t necessary, I think it might just be standard linux-y thing to say when it thinks it can find it using the system package manager (although I’m no 100% sure).

Previously I mentioned running make deps, have you tried this yet? The errors you are getting are related to uninstalled dependencies that opam can install for you (dependencies like ocamlfind). In addition to this there is further guidance in the contributing guide.

If you could give this a go and then try running make to see if that helps that would be great :)) The steps that make deps runs are also listed separately in the CONTRIBUTING guide so if make deps && make fails you can try those commands and then make.

Sorry about how long this is taking for you to get set up, hopefully we’ll converge on the answer soon.

hey @patricoferris , i’m almost at the end of my project setup . with no errors in the initial steps .
make deps is successfully done just when I run make , I get this error -

this is supposedly the last error, it would be great if I can get a little guidance in this too :)).
sorry for sticking around on this one thing for so long, I really want to get it done and move ahead really fast :).

Woohoo :tada: – this is a known problem that was fixed by @mseri ocamlorg.opam: the code is not compatible with omd >= 2 by mseri · Pull Request #1280 · ocaml/ · GitHub

The easiest way to fix this should be by running opam install omd.1.3.1 to install the previous release of omd. I think you might have checked-out the repository before the fix was merged so when installing the dependencies you got this bug. Hopefully after running this command you should be able to run make without error.

No need to be sorry, glad we could get this setup. Any thoughts/additional notes you have from the WSL-experience would be great in the contributing doc :))

EDIT: Just noticed the second error you mentioned, this is the same problem only with a different package that has just been released, cohttp-lwt-unix. We should probably bump this and fix the code, but in the meantime you should be able to build the site by specifying opam install cohttp-lwt-unix.2.5.4.


Or you can look at Port to cohttp 4 by mseri · Pull Request #1309 · ocaml/ · GitHub :slight_smile:

1 Like

@patricoferris I’m back again with a problem in setup only :confused:
my first error is resolved but on running opam install cohttp-lwt-unix 2.5.4
I’m getting the error that
opam: PACKAGES… arguments: Invalid character in package name “2.5.4”
Usage: opam install [OPTION]… [PACKAGES]…

and if I run opam install cohttp-lwt-unix i get -
Package cohttp-lwt-unix is already installed (current version is 4.0.0).

while on running make, the error 2 remains same as mentioned in the thread above. :confused:
I would love to improve the contributing doc based on my experience with WSL .
just wanted this to be resolved before commenting in contributing guide :).


Don’t worry it is just a quick fix I hope. The correct syntax is: opam install cohttp-lwt-unix.2.5.4. As opam said, the syntax wasn’t quite right. This meant the version of cohttp-lwt-unix didn’t downgrade and you were stuck with the latest 4.0.0 version which right now we are not compatible with hence the compiler errors.

Look forward to hearing your suggestions :))

yeaaa this worked !!
although when i did make -j , I got multiple download failures -

but the end result which I believe shows the successful running of make is -
make output
now I just need to ask that how do I run this site so that the changes I make in layout code or similar things, is visible to me in website layout/design locally?
is there any localhost address which i missed out ?
how do i see my code changes working ! :))

also , i would love to add some comments in the contribution guide , so should we discuss it first or i make a PR and then you can review it? :slight_smile:

Fantastic :tada:!

I got multiple download failures

That’s normal don’t worry – the RSS feed/blog section of the build is a little brittle and this is to be expected.

now I just need to ask that how do I run this site so that the changes I make in layout code or similar things, is visible to me in website layout/design locally?

It should all be in the document already. To summarise, make local should allow you just open the ./ file in your browser OR you could run your own server from that directory (the document suggests cohttp-server-lwt ./ because that should already be installed and working).

1 Like