tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Handling linker arguments in ocamlmklib



I'm working on fixing ocaml on SunOS.  One of the issues I'm now
hitting is that ocamlmklib cannot find any pkgsrc libraries, e.g. when
building archivers/ocaml-bz2 using bzip2 from pkgsrc I see:

  ===> Building for ocaml-bz2-0.6.0nb6
  ocamlc.opt -ccopt "-D BZ_PREFIX -I/opt/local/include -I/usr/include -pipe -pipe -I/opt/local/include -I/usr/include" -c c_bz.c
  ocamlmklib -oc camlbz2 c_bz.o -lbz2
  ld: fatal: library -lbz2: not found

This appears to be because ocamlmklib expects linker arguments (-L and
-Wl,-R) to be passed directly to it rather than via -ccopt.

I've written a patch to handle ocamlmklib in a special way:

  https://gist.github.com/jperkin/1c85056f66ade8f97efc

which fixes my issue:

  ===> Building for ocaml-bz2-0.6.0nb6
  ocamlc.opt -ccopt "-D BZ_PREFIX -I/opt/local/include -I/usr/include -pipe -pipe -I/opt/local/include -I/usr/include" -c c_bz.c
  ocamlmklib -oc camlbz2 c_bz.o -lbz2
  ocamlc.opt -c bz2.mli
  ocamlc.opt -c bz2.ml
  ocamlmklib -oc camlbz2 -o bz2 bz2.cmo -lbz2
  ocamlopt.opt -c bz2.ml
  ocamlmklib -oc camlbz2 -o bz2 bz2.cmx -lbz2

but I'm no ocaml expert so would like it reviewed before committing.

Thanks,

-- 
Jonathan Perkin  -  Joyent, Inc.  -  www.joyent.com


Home | Main Index | Thread Index | Old Index