Alpha switch and linker errors

When installing the 5.0.0.alpha{0,1} switch. I wind up with linker errors when installing packages via opam.

Specifically it seems that it’s trying to resolve symbols against the system ocaml installation instead of the switch.

# Error: Error while linking /usr/lib/ocaml/unix.cma(Unix):
#        The external function `unix_waitpid' is not available

Is there an environment variable that needs to be exported in addition to the typical eval $(opam env)?

Hard to say without more information, but at the very least it would be useful to know how you invoked the compiler and whether you are using ocamlfind or not…



Steps are as follows.

opam switch create 5.0.0~alpha1 --repo=default,alpha=git+
eval $(opam env --switch=5.0.0~alpha1)

And then following the eio steps

cd eio
opam pin -yn .
opam install eio_main

The packages that fail to compile are ocamlbuild.0.14.1 and ocamlfind.1.9.5.

Do you have ocamlfind already installed in your system (not via OPAM)? You can find out by doing which ocamlfind in a fresh terminal.


No, I do not. Although, it is available via a distribution provided package.

I locally patched my distros PKGBUILD to replace the local 4.X installation with the 5.0 alpha version as a workaround. Everything seems to be working just fine now.

Definitely smells like it was an environment issue.

Does your environment include either OCAMLLIB (or CAMLLIB) set?

(actually, I’m more suspicious that for some reason the build is using the compiler in /usr/local but inspecting the primitives in from your switch via CAML_LD_LIBRARY_PATH, so the question may be more exactly which version of opam is involved and possibly also the shell, as maybe PATH is wrong?)