Linker Ocaml+;cygwin下的LLVM(或者更一般地说,静态链接cygwin下的C对象文件)?

Linker Ocaml+;cygwin下的LLVM(或者更一般地说,静态链接cygwin下的C对象文件)?,linker,cygwin,ocaml,llvm,Linker,Cygwin,Ocaml,Llvm,Ocaml绑定的测试(如果已安装Ocaml,则会自动安装LLVM)在cygwin下都会失败,当我尝试创建即使是最简单的程序时,也会遇到与所有内置测试失败相同的错误: > ocamlopt -I +llvm-2.8 -cc g++ llvm.cmxa llvm_bitwriter.cmxa llvm_trivial.ml -o llvm_trivial /usr/lib/ocaml/libasmrun.a(unix.o):unix.c:(.text+0x14a): undefined ref

Ocaml绑定的测试(如果已安装Ocaml,则会自动安装LLVM)在cygwin下都会失败,当我尝试创建即使是最简单的程序时,也会遇到与所有内置测试失败相同的错误:

> ocamlopt -I +llvm-2.8 -cc g++ llvm.cmxa llvm_bitwriter.cmxa llvm_trivial.ml -o llvm_trivial
/usr/lib/ocaml/libasmrun.a(unix.o):unix.c:(.text+0x14a): undefined reference to `_flexdll_dlerror'
/usr/lib/ocaml/libasmrun.a(unix.o):unix.c:(.text+0x177): undefined reference to `_flexdll_dlopen'
/usr/lib/ocaml/libasmrun.a(unix.o):unix.c:(.text+0x193): undefined reference to `_flexdll_dlopen'
/usr/lib/ocaml/libasmrun.a(unix.o):unix.c:(.text+0x1a2): undefined reference to `_flexdll_dlsym'
/usr/lib/ocaml/libasmrun.a(unix.o):unix.c:(.text+0x1bc): undefined reference to `_flexdll_dlsym'
/usr/lib/ocaml/libasmrun.a(unix.o):unix.c:(.text+0x1cf): undefined reference to `_flexdll_dlclose'
collect2: ld returned 1 exit status
File "caml_startup", line 1, characters 0-1:
Error: Error during linking
谷歌搜索表明,其他人也有同样的问题,但我找不到解决办法。我已经安装了flexdll。我只是没有正确地引用它吗


这在我的linux系统上很有效,所以我认为这是我在cygwin上所做的事情的特殊之处。有什么建议吗?

我不知道ocaml,但看起来您必须使用flexlink。 缺少的定义在
/usr/lib/flexdll/
中的
.o
文件中,还有一个名为
/bin/flexlink
的特殊链接器

提倡这一点:
flexlink-chain cygwin-exe-o dump.exe dump.o


linux会在运行时解析丢失的符号,因此linux不是一个好的度量标准。

flexlink在链接期间由ocamlopt调用,请使用-verbose选项运行以查看它是如何被调用的以及缺少什么
-cc g++
选项看起来特别可疑,因为它可能会删除flexlink,并使用g++作为链接器,而这当然找不到flexdll符号(从flexlink aware ocamlopt生成的ocaml代码中引用)