OpenGL + GLUT using Ocaml
I have a problem with installing OpenGL (and GLut) and using it with Ocaml.
I have tried many different packages (under both Linux and Windows) and always got problems about not found modules or other.
W开发者_开发技巧hat will be easier : Linux or Windows? What should i exactly do? Which package of bindings is the best? ( are bindings is enough or i need to download some other things?)
Could anyone describe it step by step in a way that can be easy to follow?
Here are the exact steps :
sudo aptitude install liblablgl-ocaml-dev
cp /usr/share/doc/liblablgl-ocaml-dev/examples/simple.ml .
ocamlfind ocamlopt -linkpkg -package lablgl.togl simple.ml -o simple
./simple
I don't have the motivation to walk you through the installation process at the moment, but here are some (hopefully helpful) comments:
You generally want to use OCaml in *NIX because OCaml shows a very clear bias toward it. In particular, its debugger and profiler are not available in Windows.
One issue I randomly run into when installing new libraries in Linux (which may be a sign that I'm doing something dumb, come to think of it; oh, well) is permissions errors causing module loading errors. Try tracking down where the relevant libraries were installed and check that they're accessible (e.g. try ls
ing them as a user; seeing them in a directory is not enough).
For example, I recently installed OCamlMPI but was getting errors about it not being able to find modules even when I gave full paths to them.
It turned out that the directory it was stored in ($(ocamlc -where)/ocamlmpi
) had a modmask of 0744
(i.e. drwxr--r--
) when it should have had 0755
(i.e. drwxr-xr-x
). After the permissions were changed, the modules loaded and worked just fine.
In fact, that's actually a problem I've run into when installing Python modules, too. Maybe I am doing something dumb somewhere.
Anyway, I hope that helps. :)
精彩评论