ocaml / opam-repository

Main public package repository for opam, the source package manager of OCaml.
https://opam.ocaml.org
Creative Commons Zero v1.0 Universal
517 stars 1.14k forks source link

Install on Mac M2 #26896

Closed spike7638 closed 2 hours ago

spike7638 commented 4 hours ago

I'm having trouble installing ocaml on my Mac M2.

Like https://github.com/ocaml/opam/issues/5783, I'm trying to install ocaml on a new Mac; It's an M2, and I'm using Sonoma 14.7.

Copying the approach taken there, I've done the following

Details

``` The following actions will be performed: === install 61 packages ∗ astring 0.8.5 [required by ocaml-lsp-server] ∗ base v0.17.1 [required by ocamlformat-lib] ∗ base-bytes base [required by ocp-indent] ∗ camlp-streams 5.0.1 [required by ocaml-lsp-server] ∗ chrome-trace 3.16.1 [required by ocaml-lsp-server] ∗ cmdliner 1.3.0 [required by ocamlformat] ∗ cppo 1.7.0 [required by utop] ∗ csexp 1.5.2 [required by ocaml-lsp-server] ∗ dune 3.16.1 ∗ dune-build-info 3.16.1 [required by ocaml-lsp-server] ∗ dune-configurator 3.16.1 [required by base] ∗ dune-rpc 3.16.1 [required by ocaml-lsp-server] ∗ dyn 3.16.1 [required by ocaml-lsp-server] ∗ either 1.0.0 [required by ocamlformat-lib] ∗ fiber 3.7.0 [required by ocaml-lsp-server] ∗ fix 20230505 [required by ocamlformat-lib] ∗ fpath 0.7.3 [required by ocamlformat-lib] ∗ lambda-term 3.3.2 [required by utop] ∗ logs 0.7.0 [required by utop] ∗ lwt 5.8.0 [required by utop] ∗ lwt_react 1.2.0 [required by utop] ∗ menhir 20240715 ∗ menhirCST 20240715 [required by menhir] ∗ menhirLib 20240715 [required by menhir] ∗ menhirSdk 20240715 [required by menhir] ∗ merlin-lib 4.13-501 [required by ocaml-lsp-server] ∗ mew 0.1.0 [required by mew_vi] ∗ mew_vi 0.5.0 [required by lambda-term] ∗ num 1.5-1 ∗ ocaml-lsp-server 1.17.0 ∗ ocaml-version 3.7.0 [required by ocamlformat-lib] ∗ ocaml_intrinsics_kernel v0.17.1 [required by base] ∗ ocamlbuild 0.15.0 [required by astring, uutf] ∗ ocamlc-loc 3.16.1 [required by ocaml-lsp-server] ∗ ocamlfind 1.9.6 [required by utop] ∗ ocamlformat 0.26.2 ∗ ocamlformat-lib 0.26.2 [required by ocamlformat] ∗ ocamlformat-rpc-lib 0.26.2 [required by ocaml-lsp-server] ∗ ocp-indent 1.8.1 [required by ocamlformat-lib] ∗ ocplib-endian 1.2 [required by lwt] ∗ ordering 3.16.1 [required by ocaml-lsp-server] ∗ pp 1.2.0 [required by ocaml-lsp-server] ∗ ppx_yojson_conv_lib v0.17.0 [required by ocaml-lsp-server] ∗ re 1.12.0 [required by ocaml-lsp-server, ocamlformat] ∗ react 1.2.2 [required by utop] ∗ result 1.5 [required by ocamlformat-lib] ∗ seq base [required by re] ∗ sexplib0 v0.17.0 [required by base] ∗ spawn v0.15.1 [required by ocaml-lsp-server] ∗ stdio v0.17.0 [required by ocamlformat-lib] ∗ stdune 3.16.1 [required by ocaml-lsp-server] ∗ topkg 1.0.7 [required by astring, uutf] ∗ trie 1.0.0 [required by mew] ∗ uchar 0.0.2 [required by zed] ∗ utop 2.14.0 ∗ uucp 16.0.0 [required by uuseg, zed] ∗ uuseg 16.0.0 [required by ocamlformat-lib] ∗ uutf 1.0.3 [required by ocaml-lsp-server] ∗ xdg 3.16.1 [required by ocaml-lsp-server, utop] ∗ yojson 2.2.2 [required by ocaml-lsp-server] ∗ zed 3.2.3 [required by utop] Proceed with ∗ 61 installations? [y/n] y <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><> 🐫 ⬇ retrieved camlp-streams.5.0.1 (https://opam.ocaml.org/cache) ⬇ retrieved astring.0.8.5 (https://opam.ocaml.org/cache) ⬇ retrieved base.v0.17.1 (https://opam.ocaml.org/cache) ⬇ retrieved cmdliner.1.3.0 (https://opam.ocaml.org/cache) [ERROR] The compilation of cmdliner.1.3.0 failed at "make all PREFIX=/Users/jhughes/.opam/5.1.0". ⬇ retrieved csexp.1.5.2 (https://opam.ocaml.org/cache) ⬇ retrieved cppo.1.7.0 (https://opam.ocaml.org/cache) ⬇ retrieved either.1.0.0 (https://opam.ocaml.org/cache) ⬇ retrieved fiber.3.7.0 (https://opam.ocaml.org/cache) ⬇ retrieved fpath.0.7.3 (https://opam.ocaml.org/cache) ⬇ retrieved fix.20230505 (https://opam.ocaml.org/cache) ⬇ retrieved chrome-trace.3.16.1, dune.3.16.1, dune-build-info.3.16.1, dune-configurator.3.16.1, dune-rpc.3.16.1, dyn.3.16.1, ocamlc-loc.3.16.1, ordering.3.16.1, stdune.3.16.1, xdg.3.16.1 (https://opam.ocaml.org/cache) ⬇ retrieved logs.0.7.0 (https://opam.ocaml.org/cache) [ERROR] The compilation of dune.3.16.1 failed at "ocaml boot/bootstrap.ml -j 11". ⬇ retrieved lambda-term.3.3.2 (https://opam.ocaml.org/cache) ⬇ retrieved lwt.5.8.0 (https://opam.ocaml.org/cache) ⬇ retrieved lwt_react.1.2.0 (https://opam.ocaml.org/cache) ⬇ retrieved mew.0.1.0 (https://opam.ocaml.org/cache) ⬇ retrieved menhir.20240715, menhirCST.20240715, menhirLib.20240715, menhirSdk.20240715 (https://opam.ocaml.org/cache) ⬇ retrieved mew_vi.0.5.0 (https://opam.ocaml.org/cache) ⬇ retrieved merlin-lib.4.13-501 (https://opam.ocaml.org/cache) ⬇ retrieved num.1.5-1 (https://opam.ocaml.org/cache) ⬇ retrieved ocaml-version.3.7.0 (https://opam.ocaml.org/cache) [ERROR] The compilation of num.1.5-1 failed at "make PROFILE=release opam-modern". ⬇ retrieved ocaml-lsp-server.1.17.0 (https://opam.ocaml.org/cache) ⬇ retrieved ocaml_intrinsics_kernel.v0.17.1 (https://opam.ocaml.org/cache) ⬇ retrieved ocamlbuild.0.15.0 (https://opam.ocaml.org/cache) [ERROR] The compilation of ocamlbuild.0.15.0 failed at "make -f configure.make all OCAMLBUILD_PREFIX=/Users/jhughes/.opam/5.1.0 OCAMLBUILD_BINDIR=/Users/jhughes/.opam/5.1.0/bin OCAMLBUILD_LIBDIR=/Users/jhughes/.opam/5.1.0/lib OCAMLBUILD_MANDIR=/Users/jhughes/.opam/5.1.0/man OCAML_NATIVE=true OCAML_NATIVE_TOOLS=true". ⬇ retrieved ocamlformat.0.26.2, ocamlformat-lib.0.26.2, ocamlformat-rpc-lib.0.26.2 (https://opam.ocaml.org/cache) ⬇ retrieved ocamlfind.1.9.6 (https://opam.ocaml.org/cache) ⬇ retrieved ocp-indent.1.8.1 (https://opam.ocaml.org/cache) [ERROR] The compilation of ocamlfind.1.9.6 failed at "./configure -bindir /Users/jhughes/.opam/5.1.0/bin -sitelib /Users/jhughes/.opam/5.1.0/lib -mandir /Users/jhughes/.opam/5.1.0/man -config /Users/jhughes/.opam/5.1.0/lib/findlib.conf -no-custom -no-camlp4". ⬇ retrieved pp.1.2.0 (https://opam.ocaml.org/cache) ⬇ retrieved ppx_yojson_conv_lib.v0.17.0 (https://opam.ocaml.org/cache) ⬇ retrieved ocplib-endian.1.2 (https://opam.ocaml.org/cache) ⬇ retrieved result.1.5 (https://opam.ocaml.org/cache) ⬇ retrieved react.1.2.2 (https://opam.ocaml.org/cache) ⬇ retrieved re.1.12.0 (https://opam.ocaml.org/cache) ⬇ retrieved sexplib0.v0.17.0 (https://opam.ocaml.org/cache) ⬇ retrieved spawn.v0.15.1 (https://opam.ocaml.org/cache) ⬇ retrieved seq.base (2 extra sources) ⬇ retrieved seq.base (2 extra sources) ∗ installed seq.base ⬇ retrieved stdio.v0.17.0 (https://opam.ocaml.org/cache) ⬇ retrieved trie.1.0.0 (https://opam.ocaml.org/cache) ⬇ retrieved uchar.0.0.2 (https://opam.ocaml.org/cache) ⬇ retrieved topkg.1.0.7 (https://opam.ocaml.org/cache) ⬇ retrieved uuseg.16.0.0 (https://opam.ocaml.org/cache) ⬇ retrieved utop.2.14.0 (https://opam.ocaml.org/cache) ⬇ retrieved uutf.1.0.3 (https://opam.ocaml.org/cache) ⬇ retrieved uucp.16.0.0 (https://opam.ocaml.org/cache) ⬇ retrieved yojson.2.2.2 (https://opam.ocaml.org/cache) ⬇ retrieved zed.3.2.3 (https://opam.ocaml.org/cache) #=== ERROR while compiling ocamlfind.1.9.6 ====================================# # context 2.3.0 | macos/arm64 | ocaml-base-compiler.5.1.0 | https://opam.ocaml.org#c31c18de15e89738fc8f0a9a43ea240e9af44337 # path ~/.opam/5.1.0/.opam-switch/build/ocamlfind.1.9.6 # command ~/.opam/opam-init/hooks/sandbox.sh build ./configure -bindir /Users/jhughes/.opam/5.1.0/bin -sitelib /Users/jhughes/.opam/5.1.0/lib -mandir /Users/jhughes/.opam/5.1.0/man -config /Users/jhughes/.opam/5.1.0/lib/findlib.conf -no-custom -no-camlp4 # exit-code 1 # env-file ~/.opam/log/ocamlfind-45295-9b4f8b.env # output-file ~/.opam/log/ocamlfind-45295-9b4f8b.out ### output ### # Welcome to findlib version 1.9.6 # Configuring core... # configure: cannot determine ocaml's standard library directory #=== ERROR while compiling ocamlbuild.0.15.0 ==================================# # context 2.3.0 | macos/arm64 | ocaml-base-compiler.5.1.0 | https://opam.ocaml.org#c31c18de15e89738fc8f0a9a43ea240e9af44337 # path ~/.opam/5.1.0/.opam-switch/build/ocamlbuild.0.15.0 # command ~/.opam/opam-init/hooks/sandbox.sh build make -f configure.make all OCAMLBUILD_PREFIX=/Users/jhughes/.opam/5.1.0 OCAMLBUILD_BINDIR=/Users/jhughes/.opam/5.1.0/bin OCAMLBUILD_LIBDIR=/Users/jhughes/.opam/5.1.0/lib OCAMLBUILD_MANDIR=/Users/jhughes/.opam/5.1.0/man OCAML_NATIVE=true OCAML_NATIVE_TOOLS=true # exit-code 2 # env-file ~/.opam/log/ocamlbuild-45295-7e7302.env # output-file ~/.opam/log/ocamlbuild-45295-7e7302.out ### output ### # dyld[45745]: Library not loaded: /opt/homebrew/opt/zstd/lib/libzstd.1.dylib # Referenced from: /Users/jhughes/.opam/5.1.0/bin/ocamlc.opt # Reason: tried: '/opt/homebrew/opt/zstd/lib/libzstd.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/zstd/lib/libzstd.1.dylib' (no such file), '/opt/homebrew/opt/zstd/lib/libzstd.1.dylib' (no such file) # configure.make:9: /Makefile.config: No such file or directory # make: *** No rule to make target `/Makefile.config'. Stop. #=== ERROR while compiling num.1.5-1 ==========================================# # context 2.3.0 | macos/arm64 | ocaml-base-compiler.5.1.0 | https://opam.ocaml.org#c31c18de15e89738fc8f0a9a43ea240e9af44337 # path ~/.opam/5.1.0/.opam-switch/build/num.1.5-1 # command ~/.opam/opam-init/hooks/sandbox.sh build make PROFILE=release opam-modern # exit-code 2 # env-file ~/.opam/log/num-45295-9f2dfd.env # output-file ~/.opam/log/num-45295-9f2dfd.out ### output ### # /Applications/Xcode.app/Contents/Developer/usr/bin/make -C src all # dyld[45732]: Library not loaded: /opt/homebrew/opt/zstd/lib/libzstd.1.dylib # Referenced from: /Users/jhughes/.opam/5.1.0/bin/ocamlc.opt # Reason: tried: '/opt/homebrew/opt/zstd/lib/libzstd.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/zstd/lib/libzstd.1.dylib' (no such file), '/opt/homebrew/opt/zstd/lib/libzstd.1.dylib' (no such file) # ../Makefile.common:14: /Makefile.config: No such file or directory # make[1]: *** No rule to make target `/Makefile.config'. Stop. # make: *** [all] Error 2 #=== ERROR while compiling dune.3.16.1 ========================================# # context 2.3.0 | macos/arm64 | ocaml-base-compiler.5.1.0 | https://opam.ocaml.org#c31c18de15e89738fc8f0a9a43ea240e9af44337 # path ~/.opam/5.1.0/.opam-switch/build/dune.3.16.1 # command ~/.opam/opam-init/hooks/sandbox.sh build ocaml boot/bootstrap.ml -j 11 # signalled -1 # env-file ~/.opam/log/dune-45295-735a16.env # output-file ~/.opam/log/dune-45295-735a16.out ### output ### # dyld[45659]: Library not loaded: /opt/homebrew/opt/zstd/lib/libzstd.1.dylib # Referenced from: <3DD2FC2E-7CE7-3565-8588-A3EE373B54C3> /Users/jhughes/.opam/5.1.0/bin/ocamlrun # Reason: tried: '/opt/homebrew/opt/zstd/lib/libzstd.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/zstd/lib/libzstd.1.dylib' (no such file), '/opt/homebrew/opt/zstd/lib/libzstd.1.dylib' (no such file) #=== ERROR while compiling cmdliner.1.3.0 =====================================# # context 2.3.0 | macos/arm64 | ocaml-base-compiler.5.1.0 | https://opam.ocaml.org#c31c18de15e89738fc8f0a9a43ea240e9af44337 # path ~/.opam/5.1.0/.opam-switch/build/cmdliner.1.3.0 # command ~/.opam/opam-init/hooks/sandbox.sh build make all PREFIX=/Users/jhughes/.opam/5.1.0 # exit-code 2 # env-file ~/.opam/log/cmdliner-45295-d755b0.env # output-file ~/.opam/log/cmdliner-45295-d755b0.out ### output ### # dyld[45571]: Library not loaded: /opt/homebrew/opt/zstd/lib/libzstd.1.dylib # Referenced from: /Users/jhughes/.opam/5.1.0/bin/ocamlc.opt # Reason: tried: '/opt/homebrew/opt/zstd/lib/libzstd.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/zstd/lib/libzstd.1.dylib' (no such file), '/opt/homebrew/opt/zstd/lib/libzstd.1.dylib' (no such file) # /bin/sh: line 1: 45573 Abort trap: 6 ocamlopt -version > /dev/null 2>&1 # ocaml build.ml cma # dyld[45574]: Library not loaded: /opt/homebrew/opt/zstd/lib/libzstd.1.dylib # Referenced from: <3DD2FC2E-7CE7-3565-8588-A3EE373B54C3> /Users/jhughes/.opam/5.1.0/bin/ocamlrun # Reason: tried: '/opt/homebrew/opt/zstd/lib/libzstd.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/zstd/lib/libzstd.1.dylib' (no such file), '/opt/homebrew/opt/zstd/lib/libzstd.1.dylib' (no such file) # make: *** [build-byte] Abort trap: 6 <><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><> 🐫 ┌─ The following actions failed │ λ build cmdliner 1.3.0 │ λ build dune 3.16.1 │ λ build num 1.5-1 │ λ build ocamlbuild 0.15.0 │ λ build ocamlfind 1.9.6 └─ ┌─ The following changes have been performed (the rest was aborted) │ ∗ install seq base └─ The former state can be restored with: /opt/homebrew/bin/opam switch import "/Users/jhughes/.opam/5.1.0/.opam-switch/backup/state-20241115152353.export" ```

Here's the results of opam config report

# opam config report
# opam-version         2.3.0
# self-upgrade         no
# system               arch=arm64 os=macos os-distribution=homebrew os-version=14.7
# solver               builtin-mccs+glpk
# install-criteria     -removed,-count[avoid-version,changed],-count[version-lag,request],-count[version-lag,changed],-count[missing-depexts,changed],-changed
# upgrade-criteria     -removed,-count[avoid-version,changed],-count[version-lag,solution],-count[missing-depexts,changed],-new
# jobs                 11
# repositories         1 (http) (default repo at c31c18de15e89738fc8f0a9a43ea240e9af44337)
# pinned               0
# current-switch       5.1.0
# invariant            ["ocaml-base-compiler" {= "5.1.0"} | "ocaml-system" {= "5.1.0"}]
# compiler-packages    ocaml-base-compiler.5.1.0, ocaml-options-vanilla.1
# ocaml:native         true
# ocaml:native-tools   true
# ocaml:native-dynlink true
# ocaml:stubsdir       /Users/jhughes/.opam/5.1.0/lib/ocaml/stublibs:/Users/jhughes/.opam/5.1.0/lib/ocaml
# ocaml:preinstalled   false
# ocaml:compiler       5.1.0
kit-ty-kate commented 3 hours ago

this is not an issue with opam (the tool) but with the packages (opam-repository) so i've moved your ticket where it's more appropriate.

Now for your issue, my guess is that brew remove gcc somehow removed zstd. Could you try to do: brew reinstall zstd

If that doesn't work you could ask people in https://github.com/ocaml/ocaml/issues/12562 to see if someone has a better idea

spike7638 commented 2 hours ago

That seems to have worked; thanks. So the summary of a now-working sequence of installs seems to be

Sadly, this didn't seem to make my project using reprocessing work -- I still get an assembler error! -- but that's a different problem.