私は ocaml listserv に質問を投稿しましたが、誰も応答しませんでした。ここの誰かが私を馬鹿だと呼ぶか、状況を確認するか、創造的な解決策を提供してくれることを願っています。
動的ライブラリをビルドするときocamlbuild
に、最終的なリンク行で行き詰まり、
/opt/ocaml-3.12.1/bin/ocamlopt.opt -shared -verbose -cc gcc plugins/example.cmx -o plugins/example.cmxs -ccopt -v
+ as -o 'plugins/example.cmxs.startup.o' '/tmp/camlstartupe6993f.s'
+ gcc -o 'plugins/example.cmxs' '-L/opt/ocaml-3.12.1/lib/ocaml' -v 'plugins/example.cmxs.startup.o' 'plugins/example.o'
これにより、hereのようなエラーが発生します。-cc
このエラーは、オプションを削除して-shared
フラグが に渡されると修正されgcc
ます。
/opt/ocaml-3.12.1/bin/ocamlopt.opt -shared -verbose plugins/example.cmx -o plugins/example.cmxs -ccopt -v
+ as -o 'plugins/example.cmxs.startup.o' '/tmp/camlstartup2c31a2.s'
+ gcc -shared -o 'plugins/example.cmxs' '-L/opt/ocaml-3.12.1/lib/ocaml' -v 'plugins/example.cmxs.startup.o' 'plugins/example.o'
OCamlbuild は-cc
オプションをすべてに渡すので、それを削除することはできません。ocamlopt のバグのようです。誰かが同様の状況を経験しましたか?コンパイルで何かまたはオプションが不足していますか?
ありがとう。
編集
私の解決策は、myocamlbuild.ml のフラグを介してオプションを渡すことです。
flag ["shared"; "link"]
(S [A"-ccopt";A"-shared"]);