Re: "ocaml_beginners":: ocaml-syck compilation problem
- Thanks, that was very helpful!
On Fri, Nov 16, 2012 at 2:49 PM, Florent Monnier <
> you wrote:[Non-text portions of this message have been removed]
> > I downloaded ocaml-syck from http://ocaml-syck.sourceforge.net/ and it
> > configured and built without any problems, but it only generates the
> > library. How do I get it to generate the bytecode library as well? I've
> > poked about the makefiles for a while but couldn't manage to figure it
> I'm assuming the version is ocaml-syck-0.1.1
> I don't see any compilation problem, it's just that by default the
> build script only build the native lib. It's simple to build the byte
> one without changing the Makefile, but before to learn how to use
> make, I would recomand to learn how to compile ocaml code before.
> Compiling ocaml code is not that difficult, but I would admit that in
> case you are an early beginner it's not that simple to read the
> official manual which assumes the reader is already skilled, and
> already has programming knowledge, so I won't RTFM you.
> if there is an .mli file, it should be compiled first before the .ml
> file, so in ocaml-syck:
> ocamlc -c yamlNode.mli
> ocamlc -c yamlNode.ml
> ocamlc -c yamlParser.mli
> ocamlc -c yamlParser.ml
> we compile yamlNode first becasue yamlParser needs it
> you have already build the .cmxa properly, which was made by this
> command (run by make):
> ocamlmklib -o yaml parser.o yamlNode.cmx yamlParser.cmx -lsyck
> this one creates the .cmxa, to create a .cma, we just replace .cmx by
> the .cmo that we just created, like this:
> ocamlmklib -o yaml parser.o yamlNode.cmo yamlParser.cmo -lsyck
> then we have our .cma lib.
> the -lsyck option is for linking with the syck library, this is the
> same option than when compiling for C.
> if you have build the .cmxa yet, the stub part is there yet, it's the
> same for the byte and native lib.
> now the answer for how to call make:
> make LIB=cma OBJ=cmo OCAMLC=ocamlc
> by default it contains:
> OCAMLC := ocamlopt
> LIB := cmxa
> OBJ := cmx
> any variable in a Makefile can be redefined on the command line like this.
> Feel free to ask other questions.