ocaml / merlin

Context sensitive completion for OCaml in Vim and Emacs
https://ocaml.github.io/merlin/
MIT License
1.59k stars 233 forks source link

Failed to install merlin with opam with gcc14 #1774

Open MizurenNanako opened 6 months ago

MizurenNanako commented 6 months ago

On Archlinux, with gcc14, trying to install merlin through opam, got this:

seems the problem is due to lto1 and passing -no-lto to gcc might solve it, but how can I pass some LDFLAGS to opam?

The following actions will be performed:
  ∗ install dot-merlin-reader 4.9      [required by merlin]
  ∗ install merlin            4.14-501
===== ∗ 2 =====
Do you want to continue? [Y/n] y

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
⬇ retrieved dot-merlin-reader.4.9  (cached)
⬇ retrieved merlin.4.14-501  (cached)
[ERROR] The compilation of dot-merlin-reader.4.9 failed at "dune build -p dot-merlin-reader -j 7".

#=== ERROR while compiling dot-merlin-reader.4.9 ==============================#
# context     2.1.5 | linux/x86_64 | ocaml.5.1.1 | https://opam.ocaml.org#6ed19e32
# path        ~/.opam/default/.opam-switch/build/dot-merlin-reader.4.9
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p dot-merlin-reader -j 7
# exit-code   1
# env-file    ~/.opam/log/dot-merlin-reader-4609-4dc677.env
# output-file ~/.opam/log/dot-merlin-reader-4609-4dc677.out
### output ###
# [...]
# File "src/dot-merlin/dune", line 3, characters 7-24:
# 3 |  (name dot_merlin_reader)
#            ^^^^^^^^^^^^^^^^^
# (cd _build/default && /usr/bin/ocamlopt.opt -w -40 -g -o src/dot-merlin/dot_merlin_reader.exe /home/***/.opam/default/lib/findlib/findlib.cmxa /usr/lib/ocaml/str/str.cmxa /usr/lib/ocaml/unix/unix.cmxa /home/***/.opam/default/lib/merlin-lib/utils/merlin_utils.cmxa -I /home/***/.opam/default/lib/merlin-lib/utils /home/***/.opam/default/lib/csexp/csexp.cmxa /home/***/.opam/default/lib/merlin-lib[...]
# lto1: fatal error: bytecode stream in file ‘/home/***/.opam/default/lib/merlin-lib/utils/libmerlin_utils_stubs.a’ generated with LTO version 13.1 instead of the expected 14.0
# compilation terminated.
# lto-wrapper: fatal error: gcc returned 1 exit status
# compilation terminated.
# /usr/bin/ld: error: lto-wrapper failed
# collect2: error: ld returned 1 exit status
# File "caml_startup", line 1:
# Error: Error during linking (exit code 1)

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build dot-merlin-reader 4.9
└─ 
╶─ No changes have been performed
sidkshatriya commented 6 months ago

Is it that you were working on an ocaml project with gcc 13 then upgraded your Arch Linux and now you have gcc 14 ?

It's possible that gcc does not like working with gcc 13 and gcc 14 artifacts mixed together. Have you tried creating a fresh opam switch and tried to install merlin in it ?