Unable to install Merlin merlin.4.7-413 on Ubuntu 25.04
Hi,
I am unable to install merlin 4.7-413 on Ubuntu 25.04 with OCaml compiler 4.13.1.
I was following the setup instructions from Real World OCaml: https://dev.realworldocaml.org/install.html The error is similar to the issue https://github.com/ocaml/merlin/issues/1478.
$ opam install merlin
The following actions will be performed:
=== install 1 package
∗ merlin 4.7-413
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
⬇ retrieved merlin.4.7-413 (cached)
[ERROR] The compilation of merlin.4.7-413 failed at "dune build -p merlin -j 7".
#=== ERROR while compiling merlin.4.7-413 =====================================#
# context 2.4.1 | linux/x86_64 | ocaml-base-compiler.4.13.1 | https://opam.ocaml.org#21f97b2e6d7c617fc0a79cc8e59b2e10690960e1
# path ~/.opam/4.13.1/.opam-switch/build/merlin.4.7-413
# command ~/.opam/opam-init/hooks/sandbox.sh build dune build -p merlin -j 7
# exit-code 1
# env-file ~/.opam/log/merlin-65231-dfbc0e.env
# output-file ~/.opam/log/merlin-65231-dfbc0e.out
### output ###
# [...]
# ocamlmerlin.c:377:41: warning: ‘__builtin___snprintf_chk’ output may be truncated before the last format character [-Wformat-truncation=]
# 377 | snprintf(socket_path, PATHSZ, "%s/%s", path_socketdir(), socketname);
# | ^
# In function ‘snprintf’,
# inlined from ‘start_server.constprop’ at ocamlmerlin.c:377:5:
# /usr/include/x86_64-linux-gnu/bits/stdio2.h:68:10: note: ‘__builtin___snprintf_chk’ output 2 or more bytes (assuming 4098) into a destination of size 4097
# 68 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 69 | __glibc_objsize (__s), __fmt,
# | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 70 | __va_arg_pack ());
# | ~~~~~~~~~~~~~~~~~
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build merlin 4.7-413
└─
╶─ No changes have been performed
Thanks for your report @daimrod
The "output" part of the message doesn't look like the actual error, it is "just" a warning.
Could you share the whole log in ~/.opam/log/merlin-65231-dfbc0e.out ?
The problem is this seq library that should have been removed with OCaml 4.07, I think:
# syntax=docker/dockerfile:1
FROM ocaml/opam:ubuntu-25.04-ocaml-4.13
RUN sudo ln -sf /usr/bin/opam-2.4 /usr/bin/opam && opam init --reinit -ni
RUN --mount=type=cache,target=/home/opam/.opam/download-cache,sharing=locked,uid=1000,gid=1000 \
opam install -y --deps-only merlin
gives
21.47 # File "src/frontend/ocamlmerlin/dune", line 17, characters 37-40:
21.47 # 17 | ocaml_typing ocaml_utils seq))
21.47 # ^^^
21.47 # Error: Library "seq" not found.
21.47 # -> required by _build/default/src/frontend/ocamlmerlin/ocamlmerlin_server.exe
21.47 # -> required by _build/install/default/bin/ocamlmerlin-server
21.47 # -> required by _build/default/merlin.install
21.47 # -> required by alias install
with the patch applied there's the warnings but not the build failure:
# syntax=docker/dockerfile:1
FROM ocaml/opam:ubuntu-25.04-ocaml-4.13
RUN sudo ln -sf /usr/bin/opam-2.4 /usr/bin/opam && opam init --reinit -ni
ADD --keep-git-dir --link --chown=1000:1000 https://github.com/ocaml/merlin.git#v4.7-413 /home/opam/merlin
RUN git config --global --add safe.directory ~/merlin
WORKDIR /home/opam/merlin
RUN --mount=type=cache,target=/home/opam/.opam/download-cache,sharing=locked,uid=1000,gid=1000 \
opam install -y --deps-only --with-dev --formula='"menhir" {<= "20220210"}' merlin.4.7-413
RUN patch -p1 <<'EOF'
diff --git a/src/frontend/ocamlmerlin/dune b/src/frontend/ocamlmerlin/dune
index faa01b93..cc549032 100644
--- a/src/frontend/ocamlmerlin/dune
+++ b/src/frontend/ocamlmerlin/dune
@@ -14,7 +14,7 @@
(modules (:standard \ gen_ccflags))
(libraries config yojson merlin_analysis merlin_kernel
merlin_utils os_ipc ocaml_parsing query_protocol query_commands
- ocaml_typing ocaml_utils seq))
+ ocaml_typing ocaml_utils))
(executable
(name gen_ccflags)
EOF
RUN opam exec -- make -j1
Sorry for the delay.
Here is the content of the ~/.opam/log/merlin-XXX.out file:
File "src/frontend/ocamlmerlin/dune", line 17, characters 37-40:
17 | ocaml_typing ocaml_utils seq))
^^^
Error: Library "seq" not found.
-> required by _build/default/src/frontend/ocamlmerlin/ocamlmerlin_server.exe
-> required by _build/install/default/bin/ocamlmerlin-server
-> required by _build/default/merlin.install
-> required by alias install
(cd _build/default/src/frontend/ocamlmerlin && /usr/bin/gcc -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -oocamlmerlin.exe ocamlmerlin.c)
ocamlmerlin.c: In function ‘connect_socket.constprop’:
ocamlmerlin.c:262:40: warning: ‘%s’ directive output may be truncated writing up to 4096 bytes into a region of size 102 [-Wformat-truncation=]
262 | snprintf(address.sun_path, 104, "./%s", socketname);
| ^~
In file included from /usr/include/stdio.h:970,
from ocamlmerlin.c:2:
In function ‘snprintf’,
inlined from ‘connect_socket.constprop’ at ocamlmerlin.c:262:5:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:68:10: note: ‘__builtin___snprintf_chk’ output between 3 and 4099 bytes into a destination of size 104
68 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69 | __glibc_objsize (__s), __fmt,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
70 | __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~
ocamlmerlin.c: In function ‘start_server.constprop’:
ocamlmerlin.c:353:40: warning: ‘%s’ directive output may be truncated writing up to 4096 bytes into a region of size 102 [-Wformat-truncation=]
353 | snprintf(address.sun_path, 104, "./%s", socketname);
| ^~
In function ‘snprintf’,
inlined from ‘start_server.constprop’ at ocamlmerlin.c:353:5:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:68:10: note: ‘__builtin___snprintf_chk’ output between 3 and 4099 bytes into a destination of size 104
68 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69 | __glibc_objsize (__s), __fmt,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
70 | __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~
ocamlmerlin.c: In function ‘start_server.constprop’:
ocamlmerlin.c:377:41: warning: ‘__builtin___snprintf_chk’ output may be truncated before the last format character [-Wformat-truncation=]
377 | snprintf(socket_path, PATHSZ, "%s/%s", path_socketdir(), socketname);
| ^
In function ‘snprintf’,
inlined from ‘start_server.constprop’ at ocamlmerlin.c:377:5:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:68:10: note: ‘__builtin___snprintf_chk’ output 2 or more bytes (assuming 4098) into a destination of size 4097
68 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69 | __glibc_objsize (__s), __fmt,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
70 | __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~
Thanks for the help.
Is moving the project to OCaml 4.14.X an option for you ? We don't have plans for a 4.13 release soon, but we do support 4.14 more regularly as the LTS version before OCaml 5.