So, earlier this past summer two friends and I used the ICFP contest as an opportunity to try to learn ocaml. For ease of installation, we just used ocaml under linux, but now I’m trying to set up a working environment on my new desktop, running Vista (oh no!)…
First off was installing MinGW/MSYS. This install worked pretty well. Next was downloading the Ocaml distribution for MinGW and installing it.
Then I tried to install findlib and extlib, two libraries/utilities we found valuable during the week of the competition, and consequently two things our makefile depends on…
This was where the problems started. First, findlib’s configure script wouldn’t work because ‘dirname’ kept on erroring out. The problem turned out to be a space in my install location (C:/Languages/Objective Caml). So, I reinstalled it to a more sane place (C:/MinGW/lang/ocaml). After fixing this, the configure script got farther, but died with the following error:
Detecting compiler arguments: FAILED
Upon some googling and inspection, I found that more info on the error got dumped into an ‘ocargs.log’ file in the same directory as the configure script. Inspecting this yielded the following error:
gcc: installation problem, cannot exec `cc1': No such file or directory
This, as it turns out, is a MinGW installation error on Vista. I found the fix courtesy of this message. I added the following line at the end of my /etc/profile:
export PATH=/mingw/libexec/gcc/mingw32/3.4.5:$PATH
This time, the configure script worked, and findlib was installed… On to extlib! A simple make, make opt, then make install seemed to work reasonably well.
Now, our makefile worked most of the way, creating the non-optimized version just fine, but still with an error on the optimized version:
ocamlc -o dna2rna -I `ocamlfind query extlib` -g extLib.cma bigarray.cma unix.cma util.cmo genetic.cmo baseString.cmo matchreplace.cmo dnaLexer.cmo main.cmo dna2rnaprog.ml ocamlopt -o dna2rna-opt -I `ocamlfind query extlib` -p extLib.cmxa bigarray.cmxa unix.cmxa util.cmx genetic.cmx baseString.cmx matchreplace.cmx dnaLexer.cmx main.cmx dna2rnaprog.ml Cannot find file std_exit.p.cmx
So, where was the problem? This message would seem to indicate that it was in trying to compile with profiling info on. So, for now I drop the -p, later, try to find a way to profile under mingw.
Dropping the -p got a little further. Now the error message is this:
ocamlopt -o dna2rna-opt -I `ocamlfind query extlib` extLib.cmxa bigarray.cmxa unix.cmxa util.cmx genetic.cmx baseString.cmx matchreplace.cmx dnaLexer.cmx main.cmx dna2rnaprog.ml gcc: @C:/Users/user/AppData/Local/Temp\camlrespfefe77: Invalid argument Error during linking make: *** [dna2rnap] Error 2
A linker error on the optimized version… first, let’s see whether any optimized program will compile by making a test program. Here’s the code, taken from the Ocaml Tutorial example grtest1:
(* File: grtest1.ml *) open Graphics;; open_graph " 640x480";; for i = 12 downto 1 do let radius = i * 20 in set_color (if (i mod 2) = 0 then red else yellow); fill_circle 320 240 radius done;; read_line ();;
Compiling this with ocamlc and ocamlopt yielded results that were non-deterministic. The code above should make a graphic of concentric yellow and red rings. Example results are shown below:

As is easily seen, there’s clearly nondeterminacy going on here… For those who might have a clue why this is happening, I’m running 32-bit Vista on a Intel Core 2 Duo @ 2.66 GHz.
Well, I’m out for the time being. Still not sure why I’m encountering the linker error when building the optimized version…
Post a Comment