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

How does setup-ocaml chooses opam versions? (ci failure with 4.08.1 on macos) #861

Closed
mbarbin opened this issue Sep 10, 2024 · 4 comments · Fixed by #862
Closed

How does setup-ocaml chooses opam versions? (ci failure with 4.08.1 on macos) #861

mbarbin opened this issue Sep 10, 2024 · 4 comments · Fixed by #862
Labels
documentation Improvements or additions to documentation

Comments

@mbarbin
Copy link

mbarbin commented Sep 10, 2024

Hello!

I am not sure where to best report this issue, I'll start with setup-ocaml and please you can help me determine whether this is rather something for the opam devs.

I am encountering build issues in pp's PR 21 CI, specifically the build for macos-latest, 4.08.x

In the log, I can see that the opam selected is this:

Install opam
  Acquired 2.2.1 from https://github.com/ocaml/opam/releases/download/2.2.1/opam-2.2.1-arm64-macos

And then later:

   Switch invariant: ["ocaml-base-compiler" {= "4.08.1"}]
  [ERROR] Could not determine which packages to install for this switch:
    * Missing dependency:
      - ocaml-base-compiler = 4.08.1
      unmet availability conditions: '!(os = "macos" & arch = "arm64")'

I think this error makes sense, given that in the opam configuration for this package, there is this line:

available: !(os = "macos" & arch = "arm64")

I am wondering if there are other arch available that would make this build succeed, and if so, how to force setup-ocaml to select it. I might very well be confused about the fact that arch = arm64 has anything to do with the fact that opam-2.2.1-arm64-macos is selected (I am out of my depth here).

Thanks for your help!

@smorimoto smorimoto linked a pull request Sep 10, 2024 that will close this issue
@smorimoto smorimoto added the documentation Improvements or additions to documentation label Sep 10, 2024
@smorimoto
Copy link
Member

@mbarbin See this PR #862. There are some pitfalls except for Ubuntu. It's a matter of compiler support, so we can't fix it here.

Here is what I usually do.

  1. Add the lower and upper compiler versions that the package supports, just for Ubuntu.
  2. Add the latest compiler version for macOS and Windows.

So, in YAML, it should look like this:

strategy:
  fail-fast: false
  matrix:
    os:
      - ubuntu-latest
    ocaml-compiler:
      - "4.08"
      - "5"
    include:
      - os: macos-latest
        ocaml-compiler: "5"
      - os: windows-latest
        ocaml-compiler: "5"

@mbarbin
Copy link
Author

mbarbin commented Sep 10, 2024

@smorimoto Thank you very much for the new documentation PR, that is very helpful!

I have two follow up questions:

  • Is there a syntax to select the arch manually given an os? (for example, choosing x86_64 with macOS if you are testing 4.08?)
  • Do you know if something changed recently in the arch chosen by default for "macos-latest"? I am just curious why some PRs have validated successfully in the pp repo less than a year ago, and now failing. I don't know if this makes sense, but if the default changed from x86_64 to arm64 somehow, that would be a plausible explanation for it.

@tmcgilchrist
Copy link

@mbarbin The default macOS architecture has changed from x86_64 to ARM64 in the past. If you need macOS x86_64 I would suggest using an explicit version over using -latest see https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories It will leave you with an older macOS version but that's all GitHub provides.

eg

      matrix:
        include:
          - name: macos-x86_64
            os: macos-13
          - name: macos-arm64
            os: macos-14

@mbarbin
Copy link
Author

mbarbin commented Sep 11, 2024

@tmcgilchrist thanks for jumping in, and very nice to hear from you. This clarifies it for me, thank you both!

I have also found another repo where they made the switch to macos-13 for this reason. Linking in to illustrate : ocaml-sf/learn-ocaml#603

I think this thread covered all of my questions, I'll be closing the issue. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants