I have compiled OCaml from source on my mac (the host), and I have no problem. I have also cross-compiled OCaml on my mac for some target (different from the host) and in this case I have the following issues :
1) I can use directly (on the target) ocamlrun
and ocamlyacc
as they are "pure" binaries, without problem, as on the host. If I want to use other binaries from $INSTALL/bin
($INSTALL
is the install directory of ocaml
on the target) like ocamlopt
, I have errors telling my that the path of ocamlrun
is wrong. Indeed, if I open the ocamlopt
binary with and hexadecimal editor, I see that it begins with a #!/not/target/but/host/path/to/ocamlrun
where the path is the path to ocamlrun
on the host (my mac) on which I configure
d the cross-build, not the path to its target version... Of course, if I replace this path by the one on the target, no need anymore to do ocamlrun ocamlopt
, everything is ok. Same for all others binaries from $INSTALL/bin
, ocamlrun
and ocamlyacc
put aside. (The last two do work directly, as I wrote above.) Is there a way to configure
(on host) the ocaml
cross-build so that the right path for ocamlrun
on the target appears directly at beginning of binaries from $INSTALL/bin
?
2) I cannot compile code without needing to specify the $INSTALL/lib/ocaml
dir through the -I
flag. Is there a way to force this standard libraries path at the configure
? Or any ocaml
"internal" environment variable dealing with it that I could edit to be sure that ocaml
will look for libs in $INSTALL/lib/ocaml
? (I am quite pessimistic for an environment variable solution as on the host I only have two environment variables (at printenv
) concerning ocaml
and no one seems to deal with this kind of stuff, so that I don't see why it would go differently/better on the target...)