ocaml / ocaml

The core OCaml system: compilers, runtime system, base libraries
https://ocaml.org
Other
5.52k stars 1.11k forks source link

Error installing 5.1.1: zstd/lib/libzstd.so: undefined reference to `pthread_create@GLIBC_2.34' #13035

Open joakin opened 8 months ago

joakin commented 8 months ago

Hi! I'm coming back to OCaml after a few years and tried to install 5.1.1, and I hit this issue.

I'm on ubuntu using linuxbrew/homebrew, which I used to install opam.

Using opam then to create a switch for 5.1.1 breaks, and I think it is related to this issue https://github.com/ocaml/ocaml/issues/12562.

~ → brew info opam
==> opam: stable 2.1.5 (bottled), HEAD

~ → opam switch create 5.1.1

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Switch invariant: ["ocaml-base-compiler" {= "5.1.1"} | "ocaml-system" {= "5.1.1"}]

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
∗ installed base-bigarray.base
∗ installed base-threads.base
∗ installed base-unix.base
∗ installed ocaml-options-vanilla.1
⬇ retrieved ocaml-base-compiler.5.1.1  (cached)
[ERROR] The compilation of ocaml-base-compiler.5.1.1 failed at "make -j19".

#=== ERROR while compiling ocaml-base-compiler.5.1.1 ==========================#
# context     2.1.5 | linux/x86_64 |  | https://opam.ocaml.org#ac9a846c
# path        ~/.opam/5.1.1/.opam-switch/build/ocaml-base-compiler.5.1.1
# command     ~/.opam/opam-init/hooks/sandbox.sh build make -j19
# exit-code   2
# env-file    ~/.opam/log/ocaml-base-compiler-24965-90efc7.env
# output-file ~/.opam/log/ocaml-base-compiler-24965-90efc7.out
### output ###
# [...]
# /home/linuxbrew/.linuxbrew/bin/ld: /home/linuxbrew/.linuxbrew/opt/zstd/lib/libzstd.so: undefined reference to `pthread_create@GLIBC_2.34'
# collect2: error: ld returned 1 exit status
# make[2]: *** [Makefile:870: runtime/ocamlrund] Error 1
# make[2]: *** Waiting for unfinished jobs....
# /home/linuxbrew/.linuxbrew/bin/ld: /home/linuxbrew/.linuxbrew/opt/zstd/lib/libzstd.so: undefined reference to `pthread_join@GLIBC_2.34'
# /home/linuxbrew/.linuxbrew/bin/ld: /home/linuxbrew/.linuxbrew/opt/zstd/lib/libzstd.so: undefined reference to `pthread_create@GLIBC_2.34'
# collect2: error: ld returned 1 exit status
# make[2]: *** [Makefile:858: runtime/ocamlrun] Error 1
# make[2]: Leaving directory '/home/joakin/.opam/5.1.1/.opam-switch/build/ocaml-base-compiler.5.1.1'
# make[1]: *** [Makefile:209: coldstart] Error 2
# make[1]: Leaving directory '/home/joakin/.opam/5.1.1/.opam-switch/build/ocaml-base-compiler.5.1.1'
# make: *** [Makefile:375: world.opt] Error 2

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build ocaml-base-compiler 5.1.1
└─
┌─ The following changes have been performed (the rest was aborted)
│ ∗ install base-bigarray         base
│ ∗ install base-threads          base
│ ∗ install base-unix             base
│ ∗ install ocaml-options-vanilla 1
└─

<><> ocaml-base-compiler.5.1.1 troubleshooting ><><><><><><><><><><><><><><><><>
=> A failure in the middle of the build may be caused by build parallelism
      (enabled by default).
      Please file a bug report at https://github.com/ocaml/opam-repository/issues
=> You can try installing again including --jobs=1
      to force a sequential build instead.
# Run eval $(opam env --switch=5.1.1) to update the current shell environment
Switch initialisation failed: clean up? ('n' will leave the switch partially installed) [Y/n] y

I've switched back to 4.X which installs without issues as I reacquaint myself with the language.

joakin commented 8 months ago

I got this advice, to avoid compression when installing:

opam switch create 5.1.1 ocaml-variants.5.1.1+options ocaml-option-no-compression

Potential workaround.

Octachron commented 8 months ago

@joakin , did you have the time to try to reinstall zstd ?

joakin commented 8 months ago

I just tried, and I get the same error.

The error seems to mention glibc@2.34, but I have → ldd --version # ldd (GNU libc) 2.35. I'm not sure if that is exactly the issue, from what I see brew's opam does depend on glibc.

Logs for `brew reinstall && opam switch create 5.1.1` ``` ~ → brew reinstall zstd ==> Downloading https://ghcr.io/v2/homebrew/core/zstd/manifests/1.5.5-1 Already downloaded: /home/joakin/.cache/Homebrew/downloads/fc13698599720a53800064b40cddd854399651cf8760d9b0e46092f2e8da701a--zstd-1.5.5-1.bottle_manifest.json ==> Fetching zstd ==> Downloading https://ghcr.io/v2/homebrew/core/zstd/blobs/sha256:96afcbd191c9961446161a6fabf09cbbb4c6b3df371cee25b71c2 Already downloaded: /home/joakin/.cache/Homebrew/downloads/0dc9504bd106b159981be080054012bfe6c10732bc65096fe1d39b7114ae1475--zstd--1.5.5.x86_64_linux.bottle.1.tar.gz ==> Reinstalling zstd ==> Pouring zstd--1.5.5.x86_64_linux.bottle.1.tar.gz 🍺 /home/linuxbrew/.linuxbrew/Cellar/zstd/1.5.5: 31 files, 2.8MB ==> Running `brew cleanup zstd`... Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP. Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`). ==> Upgrading 3 dependents of upgraded formula: Disable this behaviour by setting HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK. Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`). composer 2.7.1 -> 2.7.2, fish 3.7.0 -> 3.7.1, fzf 0.46.1 -> 0.48.1 ==> Downloading https://ghcr.io/v2/homebrew/core/composer/manifests/2.7.2 Already downloaded: /home/joakin/.cache/Homebrew/downloads/1fd66ab1f6028925d6ad4403dc09c7c1837105a4963154aee1f4922657ca07c0--composer-2.7.2.bottle_manifest.json ==> Downloading https://ghcr.io/v2/homebrew/core/fish/manifests/3.7.1 Already downloaded: /home/joakin/.cache/Homebrew/downloads/93c23b37274573638ba0c05f53c7e628fd01b8afe03b771edf6ef0179376a38a--fish-3.7.1.bottle_manifest.json ==> Downloading https://ghcr.io/v2/homebrew/core/fzf/manifests/0.48.1 Already downloaded: /home/joakin/.cache/Homebrew/downloads/b52b99782f5e6694f7d558f1ec705160d9ab1c9460cc5442eda0fa5e6406749c--fzf-0.48.1.bottle_manifest.json ==> Checking for dependents of upgraded formulae... ==> No broken dependents found! ~ → opam switch create 5.1.1 <><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><> Switch invariant: ["ocaml-base-compiler" {= "5.1.1"} | "ocaml-system" {= "5.1.1"}] <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> ∗ installed base-bigarray.base ∗ installed base-threads.base ∗ installed base-unix.base ∗ installed ocaml-options-vanilla.1 ⬇ retrieved ocaml-base-compiler.5.1.1 (cached) [ERROR] The compilation of ocaml-base-compiler.5.1.1 failed at "make -j19". #=== ERROR while compiling ocaml-base-compiler.5.1.1 ==========================# # context 2.1.5 | linux/x86_64 | | https://opam.ocaml.org#ac9a846c # path ~/.opam/5.1.1/.opam-switch/build/ocaml-base-compiler.5.1.1 # command ~/.opam/opam-init/hooks/sandbox.sh build make -j19 # exit-code 2 # env-file ~/.opam/log/ocaml-base-compiler-23040-dbb121.env # output-file ~/.opam/log/ocaml-base-compiler-23040-dbb121.out ### output ### # [...] # /home/linuxbrew/.linuxbrew/bin/ld: /home/linuxbrew/.linuxbrew/opt/zstd/lib/libzstd.so: undefined reference to `pthread_create@GLIBC_2.34' # collect2: error: ld returned 1 exit status # make[2]: *** [Makefile:858: runtime/ocamlrun] Error 1 # make[2]: *** Waiting for unfinished jobs.... # /home/linuxbrew/.linuxbrew/bin/ld: /home/linuxbrew/.linuxbrew/opt/zstd/lib/libzstd.so: undefined reference to `pthread_join@GLIBC_2.34' # /home/linuxbrew/.linuxbrew/bin/ld: /home/linuxbrew/.linuxbrew/opt/zstd/lib/libzstd.so: undefined reference to `pthread_create@GLIBC_2.34' # collect2: error: ld returned 1 exit status # make[2]: *** [Makefile:870: runtime/ocamlrund] Error 1 # make[2]: Leaving directory '/home/joakin/.opam/5.1.1/.opam-switch/build/ocaml-base-compiler.5.1.1' # make[1]: *** [Makefile:209: coldstart] Error 2 # make[1]: Leaving directory '/home/joakin/.opam/5.1.1/.opam-switch/build/ocaml-base-compiler.5.1.1' # make: *** [Makefile:375: world.opt] Error 2 <><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ┌─ The following actions failed │ λ build ocaml-base-compiler 5.1.1 └─ ┌─ The following changes have been performed (the rest was aborted) │ ∗ install base-bigarray base │ ∗ install base-threads base │ ∗ install base-unix base │ ∗ install ocaml-options-vanilla 1 └─ <><> ocaml-base-compiler.5.1.1 troubleshooting ><><><><><><><><><><><><><><><><> => A failure in the middle of the build may be caused by build parallelism (enabled by default). Please file a bug report at https://github.com/ocaml/opam-repository/issues => You can try installing again including --jobs=1 to force a sequential build instead. # Run eval $(opam env --switch=5.1.1) to update the current shell environment Switch initialisation failed: clean up? ('n' will leave the switch partially installed) [Y/n] ```