Error building OCaml base compiler on Arch linux

Hello!

I am unable to build the ocaml base compiler on my machine using arch linux. I attempted this with versions 4.12.0 and 4.14.0.

I am not sure exactly what the issue is…?

My machine specs include:

 cat /etc/os-release
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues"
PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
LOGO=archlinux-logo
 uname -r
6.12.30-1-lts
 gcc --version
gcc (GCC) 15.1.1 20250425
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 opam switch create tree-borrows-dev ocaml-base-compiler.4.14.0

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

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

#=== ERROR while compiling ocaml-base-compiler.4.14.0 =========================#
# context     2.3.0 | linux/x86_64 |  | https://opam.ocaml.org#dbc9ec7b83bac3673185542221a571372b6abb35
# path        ~/.opam/tree-borrows-dev/.opam-switch/build/ocaml-base-compiler.4.14.0
# command     ~/.opam/opam-init/hooks/sandbox.sh build make -j15
# exit-code   2
# env-file    ~/.opam/log/ocaml-base-compiler-2764-8571fa.env
# output-file ~/.opam/log/ocaml-base-compiler-2764-8571fa.out
### output ###
# [...]
# caml/prims.h:33:23: error: too many arguments to function ‘(value (*)(void))*(caml_prim_table.contents + (sizetype)((long unsigned int)*pc * 8))’; expected 0, have 2
#    33 | #define Primitive(n) ((c_primitive)(caml_prim_table.contents[n]))
#       |                      ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# interp.c:967:14: note: in expansion of macro ‘Primitive’
#   967 |       accu = Primitive(*pc)(sp + 2, nargs);
#       |              ^~~~~~~~~
# make[2]: *** [Makefile:366: interp.b.o] Error 1
# make[2]: *** Waiting for unfinished jobs....
# make[2]: Leaving directory '/home/rudy/.opam/tree-borrows-dev/.opam-switch/build/ocaml-base-compiler.4.14.0/runtime'
# make[1]: *** [Makefile:163: coldstart] Error 2
# make[1]: Leaving directory '/home/rudy/.opam/tree-borrows-dev/.opam-switch/build/ocaml-base-compiler.4.14.0'
# make: *** [Makefile:311: world.opt] Error 2



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build ocaml-base-compiler 4.14.0
└─ 
┌─ 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
└─ 
Switch initialisation failed: clean up? ('n' will leave the switch partially installed) [y/n] y

Thanks!

I suspect this is related to the fact that gcc 15 defaults to C23 standard, which, as mentioned very early in the “porting to GCC 15” means in particular that functions declared without prototype (int f();) are now seen as not taking any argument.

If that’s indeed the case, switching to 4.14.2 should make the problem go away, since according to the Changelog it incorporates PR#12577 intended to fix exactly this point.

1 Like

Thanks, I think that fixed it!