Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007268OCamlplatform support (windows, cross-compilation, etc)public2016-05-30 12:312016-11-26 21:33
Assigned Tofrisch 
PlatformOSOS Version
Product Version4.03.0 
Target VersionFixed in Version4.04.0 +dev / +beta1 / +beta2 
Summary0007268: ocamlc.opt on cygwin32/64 can not link to unix library
Descriptionocamlc.opt, can not link to unix.cma on cygwin32/cygwin64

Steps To Reproduce$ uname -rsv
CYGWIN_NT-10.0-WOW 2.5.1(0.297/5/3) 2016-04-21 22:12
$ cat
let () = print_float (Unix.gettimeofday ()); print_newline ()
$ ocamlc.opt -o foo unix.cma
Error: Error on dynamically loaded library: /home/pela/.opam/4.03.0/lib/ocaml/stublibs/ Cannot resolve caml_debugger_cleanup_fork
Additional Informationocamlc works fine

This is a show stopper because ocamlbuild uses ocamlc.opt with the consequence that many opam packages now can't be installed

Have tested this on both cygwin32 and cygwin64 with the same result
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
frisch (developer)
2016-07-13 14:30
edited on: 2016-07-13 14:33

The problem is that ocamlc.opt is linked (of course) with the native runtime, and this runtime does not expose caml_debugger_* symbols.

The DLL is opened in "not for execution" mode, but the DLL itself, in its entry point, will trigger the relocation. I don't think there is a way to prevent the DLL entry point from being executed (or is it?). So I can see two options:

  - Link the DLL without an entry point. Since it is explicitly opened by ocamlrun through flexdll, the relocation will be done explicitly.

    EDIT: I tried passing "-noentry" to flexlink for creating, but it fails with

    ertr000001.o:(.rdata+0x0): référence indéfinie vers « _pei386_runtime_relocator »

  - In "RTLD_NOEXEC" mode, set FLEXDLL_RELOCATE=0 (instead of &flexdll_relocate) to tell the entry point not to trigger the relocation.

frisch (developer)
2016-07-13 14:51

Also, note that this only affects the Cygwin port, not other Windows ports (which go though LoadLibraryEx and pass some flag which disable the execution of the DLL entry point).
frisch (developer)
2016-07-13 17:42

Fixed in flexdll: [^]
persol (reporter)
2016-11-17 11:37

I still get the same error when trying now to use ocaml 4.04 on cygwin64. When can I expect the fixes to flexdll reach the official cygwin distribution? Can I compile flexdll myself and replace the current cygwin flexdll (v.034) in the mean time?
antron (reporter)
2016-11-23 22:47

I can confirm that this is fixed with FlexDLL 0.35. I built FlexDLL from source [1] and replaced the one distributed by Cygwin.

Now, I'm actually not sure if this was broken due to FlexDLL, because there seems to be an issue with Cygwin packaging of OCaml. I tried to package OCaml 4.04, and got the error in this issue. The cygport packaging tool was stripping, presumably removing bytecode. I had to add RESTRICT=strip to the .cygport file to prevent this.

FYI I package OCaml, Camlp4, OPAM, and now FlexDLL, as Cygwin packages for use in Lwt's AppVeyor builds [2]. If interested, I can adapt these packages and release to Cygwin's public repository.

[1]: [^]
[2]: [^]
persol (reporter)
2016-11-24 16:31

Thanks for your help, I will compile flexdll 0.35 and give it a try with ocaml 4.04. Of course it would be great if there will be an official release soon also, I have no knowledge who is the cygwin maintainer for ocaml/flexdll though.
antron (reporter)
2016-11-24 17:11

I will email the Cygwin mailing list later today. If anyone here has info on this, would be interested to know as well.
antron (reporter)
2016-11-26 21:33

FlexDLL 0.35 is now installable via Cygwin setup, both on x86 and x86_64. Package submitted by Yaakov Selkowitz.

- Issue History
Date Modified Username Field Change
2016-05-30 12:31 persol New Issue
2016-06-21 12:52 frisch Category OCaml backend (code generation) => OCaml windows
2016-07-13 14:30 frisch Note Added: 0016070
2016-07-13 14:33 frisch Note Edited: 0016070 View Revisions
2016-07-13 14:51 frisch Note Added: 0016071
2016-07-13 17:39 frisch Assigned To => frisch
2016-07-13 17:39 frisch Status new => assigned
2016-07-13 17:42 frisch Note Added: 0016072
2016-07-13 17:42 frisch Status assigned => resolved
2016-07-13 17:42 frisch Fixed in Version => 4.04.0 +dev / +beta1 / +beta2
2016-07-13 17:42 frisch Resolution open => fixed
2016-11-17 11:37 persol Note Added: 0016585
2016-11-23 22:47 antron Note Added: 0016601
2016-11-24 16:31 persol Note Added: 0016602
2016-11-24 17:11 antron Note Added: 0016603
2016-11-26 21:33 antron Note Added: 0016609
2017-02-23 16:46 doligez Category OCaml windows => platform support (windows, etc)
2017-02-23 17:16 doligez Category platform support (windows, etc) => platform support (windows, cross-compilation, etc)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker