public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: David Allsopp <David.Allsopp@cl.cam.ac.uk>
To: William Hu <purplearmadillo77@proton.me>
Cc: Jon Turney <jon.turney@dronecode.org.uk>,
	"cygwin-apps@cygwin.com" <cygwin-apps@cygwin.com>
Subject: RE: [ITA] ocaml 4.14.0
Date: Thu, 14 Jul 2022 14:56:50 +0000	[thread overview]
Message-ID: <bf3b4d528c78450691dd4ac6f48b4790@metastack.com> (raw)
In-Reply-To: <P2c6glg5AaTe9tgo1Mx6qpScT5kXY-6hd03R6-BWCJYo4yZAIqkpoKC4A7czd_7mcA_mi1FbIzpEg40N0XaLAQH_JqsQeadJ2Dxdxj75618=@proton.me>

William Hu wrote:
> Hi David,
> 
> > What were the missing symbols? With the OCaml 4.10 package, I hit
> problems with this:
> >
> > echo 'print_endline "hello, world"' > hello.ml
> >
> > ocamlc -custom -runtime-variant _shared -o hello.exe hello.ml
> >
> > I think that may be an issue upstream (libasmrun_shared.so IIRC is
> broken on all platforms - on Cygwin, you can just about to persuade it to
> get to the same symbol errors because of the extra .dll.a file which gets
> generated).
> 
> It's a very long list of missing symbols (~400) so it's included as an
> attachment in case the mailing list truncates extremely lengthy emails.
> Also, just to note, the .dll.a file doesn't seem to be automatically
> generated by upstream OCaml.

I think this down to neglect - the PIC/shared versions of the runtime were contributed for a specific purpose and aren't properly maintained/tested AFAICT.

I'm not sure that libcamlrun_shared can ever have worked on Cygwin, at least certainly not since OCaml 3.11 (which is a loooong time ago). The patch builds cygcamlrun_shared.dll as a plugin DLL - so the symbols will have been stripped and moved into symtbl (hence the huge number of missing symbols when linking against it when it gets passed to a normal linker).

What normally happens with flexlink is that either an executable or a "main program DLL" (compiled with flexlink -maindll) would receive that symtbl from a DLL it flexdll_dlopen's and the DLL receives static_symtbl from the executable. That then means that the DLL can relocate any symbols it expected from the main executable and any other flexdll_dlopen'd DLLs. However, that's all meant to happen at runtime - I don't think flexlink has ever supported compiling an executable _itself_ which must flexdll_dlopen DLLs _before_ its main function.

I think it's quite feasible to add that to flexlink, but it's not a small piece of work - in the meantime I'd suggest instead deleting the BYTECODE_SHARED_LIBRARIES += and NATIVE_SHARED_LIBRARIES += lines in runtime/Makefile instead of patching them.

> > What's the full configuration command and what gets inferred for the
> build, host and target triplets? fma should work without emulation in
> Cygwin32 and it should be detecting as failing on Cygwin64 but the
> emulation should be enabled by default unless you explicitly passed --
> disable-imprecise-c99-float-ops.
> 
> Configuration command:
> ./configure --prefix=/usr --enable-ocamltest
> 
> If it's relevant, I'm compiling on a 64-bit machine with Cygwin32
> installed to compile the 32-bit version. Inferred build/host/target:
> configure:2779: Configuring OCaml version 4.14.0
> configure:3007: checking build system type
> configure:3021: result: i686-pc-cygwin
> configure:3041: checking host system type
> configure:3054: result: i686-pc-cygwin
> configure:3074: checking target system type
> configure:3087: result: i686-pc-cygwin
> 
> On Cygwin64, the test does fail and emulate by default:
> 
> configure:14872: result: no
> configure:14896: WARNING: fma does not work; emulation enabled
> 
> However, on Cygwin32, I get
> 
> configure:14872: result: no
> configure:14894: error: fma does not work, enable emulation with --enable-
> imprecise-c99-float-ops
> 
> config.log conveniently includes the program that fails, so I copy-pasted
> some very redundant code (attached) and ran it on the different
> architectures:
> 
> Cygwin64:
> t264| ans: 0x0p+0   accept: 0x1.0989687cp-1044 0x1.09df287cp-1044 0x1.0ap-
> 1044
> t264| pass?: 0
> t265| ans: 0x0p+0   accept: 0x1.0988p-1060 0x1.09ep-1060 0x1.0ap-1060
> t265| pass?: 0
> t266| ans: 0x1p-1074   accept: 0x1p-1073
> t266| pass?: 0
> 
> Cygwin32:
> t264| ans: 0x1.0ap-1044   accept: 0x1.0989687cp-1044 0x1.09df287cp-1044
> 0x1.0ap-1044
> t264| pass?: 1
> t265| ans: 0x1.0ap-1060   accept: 0x1.0988p-1060 0x1.09ep-1060 0x1.0ap-
> 1060
> t265| pass?: 1
> t266| ans: 0x1p-1073   accept: 0x1p-1073
> t266| pass?: 1
> 
> The numbers look like they agree but configure doesn't think so for some
> reason.

Would you be able to send the entire config.log file (off-list is fine!). I'm not seeing this at all in Cygwin32 here! 

All best,


David

  reply	other threads:[~2022-07-14 14:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-04  2:03 William Hu
2022-07-04 17:03 ` Jon Turney
2022-07-05  0:42   ` William Hu
2022-07-05 19:44     ` Jon Turney
2022-07-13  2:56       ` William Hu
2022-07-13 15:41         ` David Allsopp
2022-07-14  3:36           ` William Hu
2022-07-14 14:56             ` David Allsopp [this message]
2022-07-15  3:20               ` William Hu
2022-07-16 14:22           ` Jon Turney
2022-07-23 16:38             ` William Hu
2022-07-31 14:52               ` Jon Turney
2022-08-07  2:26                 ` William Hu
2022-08-23 20:00             ` David Allsopp
2022-08-24  9:20               ` Corinna Vinschen
2022-08-24  9:28                 ` David Allsopp
2022-08-24  9:28                   ` David Allsopp
2022-08-24 10:04                   ` Corinna Vinschen
2022-07-16 14:05         ` Jon Turney
2022-07-17 20:56           ` William Hu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bf3b4d528c78450691dd4ac6f48b4790@metastack.com \
    --to=david.allsopp@cl.cam.ac.uk \
    --cc=cygwin-apps@cygwin.com \
    --cc=jon.turney@dronecode.org.uk \
    --cc=purplearmadillo77@proton.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).