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 initial support for opam 2.2 on Windows #794

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kit-ty-kate
Copy link
Member

@kit-ty-kate kit-ty-kate commented May 15, 2024

Fixes #793

Joint work with @hhugo.

The current state of the branch works (as far as i could test) but the commit history will need to be cleaned so I'm opening this as draft for now. The support is also not the cleanest as it would be best to use the opam internal cygwin installation instead of installing one manually, but it will do for now i think.

@smorimoto is there a way to regenerate the .cjs files automatically?

@kit-ty-kate kit-ty-kate changed the title Add support for opam 2.2 on Windows Add initial support for opam 2.2 on Windows May 15, 2024
@smorimoto
Copy link
Member

You can compile by running yarn build.

@smorimoto
Copy link
Member

Could you rebase to the latest master?

@kit-ty-kate
Copy link
Member Author

Could you rebase to the latest master?

done

You can compile by running yarn build.

that does not work. Do you have a list of command to run for javascript beginners? I have yarn installed but (after having to modify package.json to get the right yarn version or something), it's complaining about ncc.

@kit-ty-kate
Copy link
Member Author

Note from @dra27: this should be part of ocaml/setup-ocaml@v3

@kit-ty-kate kit-ty-kate marked this pull request as ready for review May 17, 2024 14:14
hhugo and others added 2 commits May 17, 2024 15:19
@hhugo
Copy link

hhugo commented May 17, 2024

@kit-ty-kate, do you have some CI testing this GH action ?

@kit-ty-kate
Copy link
Member Author

@hhugo I do in kit-ty-kate/mirage-torrent#2 but while the setup-ocaml succeeds, the builds fails while building dune:

#=== ERROR while compiling dune.3.15.2 ========================================#
# context     2.2.0~beta2 | win32/x86_64 | ocaml-base-compiler.4.14.2 | git+https://github.com/dra27/opam-repository.git#windows-initial
# path        D:\a\mirage-torrent\mirage-torrent\_opam\.opam-switch\build\dune.3.15.2
# command     D:\a\mirage-torrent\mirage-torrent\_opam\bin\ocaml.exe boot/bootstrap.ml -j 4
# exit-code   2
# env-file    D:\.opam\log\dune-8180-dff03d.env
# output-file D:\.opam\log\dune-8180-dff03d.out
### output ###
# ocamlc -output-complete-exe -w -24 -g -o .duneboot.exe -I boot unix.cma boot/libs.ml boot/duneboot.ml
# ** Cannot resolve symbols for D:/a/mirage-torrent/mirage-torrent/_opam/lib/ocaml\libcamlrun.a(startup_aux.b.o):
#  swscanf
# ** Cannot resolve symbols for descriptor object:
#  _vscwprintf
# File "boot/duneboot.ml", line 1:
# Error: Error while building custom runtime system

@hhugo
Copy link

hhugo commented May 28, 2024

I'm also testing this PR in hhugo/ocamlbuild#7 and see the same error.

@hhugo
Copy link

hhugo commented May 28, 2024

The following can probably be removed as well

    // Works around the lack of https://github.com/ocaml/opam/pull/3882 when
    // adding ocaml/opam-repository on Windows. Can be removed when the action
    // switches to opam 2.2
    if (PLATFORM === "win32") {
      const autocrlf = await getExecOutput(
        "git",
        ["config", "--global", "core.autocrlf"],
        { ignoreReturnCode: true },
      );
      if (autocrlf.stdout.trim() !== "input") {
        if (autocrlf.exitCode === 0) {
          restore_autocrlf = autocrlf.stdout.trim();
        } else {
          restore_autocrlf = null; // Unset the value at the end
        }
      }
      await exec("git", ["config", "--global", "core.autocrlf", "input"]);
    }

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.

opam 2.2 support on Windows
3 participants