The tests for the Ocaml bindings (which are automatically installed if you make LLVM with Ocaml already installed) all fail under cygwin, and when I try to create even the most trivial program, I get the same error that all of the built-in tests fail on:
> 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
Googling around indicates that this isn't LLVM specific, and that other people have the same problem, but I couldn't find a solution. I have flexdll installed. Am I just not referencing it correctly?
This works for me on my linux system, so I think it's something particular to what I'm doing on cygwin. Any suggestions?
flexlink is invoked by ocamlopt during linking, run with -verbose option to see how it gets called and what is missing. -cc g++
option looks especially suspicious cause it probably drops flexlink and uses g++ as a linker instead, which of course cannot find flexdll symbols (referenced from ocaml code generated by flexlink-aware ocamlopt).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With