我如何 link Cygwin 中的 Thread 模块?
How do I link the Thread module in Cygwin?
我有一个名为 threadtest.ml
的程序:
Thread.join (Thread.create (fun _ -> print_string "Hello, World!\n") ())
我是这样编译的:
$ ocamlc -thread unix.cma threads.cma -o threadtest threadtest.ml
File "threadtest.ml", line 1:
Error: Error on dynamically loaded library: /usr/lib/ocaml/stublibs/dllunix.so: flexdll error: cannot relocate RELOC_REL32, target is too far: 0xfffffffc020c7112 0x20c7112
这是我拥有的 ocamlc
版本。
$ ocamlc -v
The OCaml compiler, version 4.02.3
Standard library directory: /usr/lib/ocaml
我做错了什么?我没有找到关于此错误的任何解释。
更新:
我也尝试按照此处的说明重新设置我的系统:
但似乎没有任何效果。
你应该用ocamlc -thread unix.cma threads.cma threadtest.ml
编译它
[编辑] 正如 camlspotter 在评论中所说,这可能是一个 Cygwin32 问题,这里有一个 copy/paste 给那些像我一样从不阅读评论的人(等待 OP 知道它是否有效):
camlspotter : My Cygwin OCaml has no problem of linking of your code. If I were you, I would clean up cygwin (and flexdll if exists) and start over. If you are using Cygwin32, probably migrating to Cygwin64 might fix your problem: I had too many rebase related problems with Cygwin32 and abandoned it.
我有一个名为 threadtest.ml
的程序:
Thread.join (Thread.create (fun _ -> print_string "Hello, World!\n") ())
我是这样编译的:
$ ocamlc -thread unix.cma threads.cma -o threadtest threadtest.ml
File "threadtest.ml", line 1:
Error: Error on dynamically loaded library: /usr/lib/ocaml/stublibs/dllunix.so: flexdll error: cannot relocate RELOC_REL32, target is too far: 0xfffffffc020c7112 0x20c7112
这是我拥有的 ocamlc
版本。
$ ocamlc -v
The OCaml compiler, version 4.02.3
Standard library directory: /usr/lib/ocaml
我做错了什么?我没有找到关于此错误的任何解释。
更新:
我也尝试按照此处的说明重新设置我的系统:
但似乎没有任何效果。
你应该用ocamlc -thread unix.cma threads.cma threadtest.ml
[编辑] 正如 camlspotter 在评论中所说,这可能是一个 Cygwin32 问题,这里有一个 copy/paste 给那些像我一样从不阅读评论的人(等待 OP 知道它是否有效):
camlspotter : My Cygwin OCaml has no problem of linking of your code. If I were you, I would clean up cygwin (and flexdll if exists) and start over. If you are using Cygwin32, probably migrating to Cygwin64 might fix your problem: I had too many rebase related problems with Cygwin32 and abandoned it.