Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --with-private-runtime for mingw builds #3255

Merged
merged 4 commits into from
Apr 5, 2018

Conversation

dra27
Copy link
Member

@dra27 dra27 commented Mar 14, 2018

This PR includes minor changes to src/jbuild and src/core/jbuild which I noticed as part of this PR, but they're not related.

The addition of the internal solver means that opam when compiled with the mingw version of OCaml needs runtime DLLs which are by default not available. The commit message for 1aeb5e7 expands on the detail of this, so I won't repeat it here.

Convincing Dune to feed a custom object file to ocamlopt requires a slightly bizarre contortion - it's accomplished by adding an empty generated module called OpamManifest to the binary which itself depends on the manifest object. This is added on all platforms, but it's empty and is only part of the binary, not part of the opam-client library. It would be possible to eliminate that if at some point Dune permits arbitrary dependencies for the executable stanza.

The manifest XML fragments look unnecessarily complicated, however they only change if Microsoft introduce a new version of Windows (very unlikely, since Windows 10 has been declared to be the "last" version) or the runtime DLLs for either of the architectures change name (which can happen, but not frequently). The detection logic for them may improve in the future... it's possible to use either cygcheck or dumpbin to determine the exact names required, but this already took enough time 🙂

I also tweaked AppVeyor to demonstrate that the build doesn't work by default (see this AppVeyor log) and then tweak AppVeyor to configure the two mingw builds to use this new flag.

Reasons for choice of the parameter name (FWIW):

  • The mechanism used here is called Private Assemblies, but the mingw runtime is not strictly an assembly (that's a .NET concept)
  • I used with rather than enable because a third party library really is being pulled in here, rather than a switch being turned on (cf. `--enable-developer-mode)

dra27 added a commit to dra27/opam that referenced this pull request Mar 17, 2018
@dra27 dra27 force-pushed the private-runtime branch 2 times, most recently from 809cddc to 15287c3 Compare March 17, 2018 19:50
@dra27 dra27 force-pushed the private-runtime branch from 15287c3 to 84856a8 Compare March 28, 2018 12:55
dra27 added a commit to dra27/opam that referenced this pull request Apr 4, 2018
dra27 added 4 commits April 5, 2018 12:40
At least that tests something!
s-expressions generated from config.status should depend on it
(although, for now, shell/subst_var.ml still reads the source-tree
version, not the captured one).

This causes recompilation if configure is re-run.
If opam is compiled with the mingw-w64 version of Windows OCaml and an
internal solver, then additional DLLs are required at runtime. These can
either:

 1. Be included in a directory in PATH (this is very bad, if done by
    other packages)
 2. Be included in the same directory as opam.exe (this is similarly
    bad, because opam.exe is likely to end up in PATH)
 3. Be manifested in another directory

The --with-private-runtime option sets up the appropriate DLLs in the
directory Opam.Runtime.amd64 (or Opam.Runtime.x86) and adds them and the
manifest to opam.install. It also overrides the manifest automatically
included by gcc to instruct the Windows loader to search for the DLLs in
the runtime directory.
@dra27 dra27 force-pushed the private-runtime branch from 84856a8 to 9f6c065 Compare April 5, 2018 10:42
@AltGr AltGr merged commit abab521 into ocaml:master Apr 5, 2018
@dra27 dra27 deleted the private-runtime branch May 11, 2018 15:10
@dra27 dra27 mentioned this pull request Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants