base
base copied to clipboard
Build failure with clang: unsupported `-mpopcnt` option
#=== ERROR while compiling base.v0.16.3 =======================================#
# context 2.2.0~beta3~dev | linux/arm64 | ocaml.5.1.1 | https://opam.ocaml.org#2b6e600e
# path ~/.opam/default-clang/.opam-switch/build/base.v0.16.3
# command ~/.opam/opam-init/hooks/sandbox.sh build dune build -p base -j 7
# exit-code 1
# env-file ~/.opam/log/base-12454-0cee78.env
# output-file ~/.opam/log/base-12454-0cee78.out
### output ###
# [...]
# (cd _build/default/src && /usr/bin/clang -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -D_FILE_OFFSET_BITS=64 -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -D_LARGEFILE64_SOURCE -mpopcnt -g -I /home/antonin/.opam/default-clang/lib/ocaml -I /home/antonin/.opam/default-clang/lib/sexplib0 -I ../compiler-stdlib/src -I ../hash_types/src -I ../shadow-stdlib/src -o exn_stubs.o -c exn_stubs.c)
# clang: error: unsupported option '-mpopcnt' for target 'aarch64-redhat-linux-gnu'
# File "src/dune", line 14, characters 10-21:
# 14 | (c_names bytes_stubs exn_stubs int_math_stubs hash_stubs am_testing)
# ^^^^^^^^^^^
# (cd _build/default/src && /usr/bin/clang -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -D_FILE_OFFSET_BITS=64 -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -D_LARGEFILE64_SOURCE -mpopcnt -g -I /home/antonin/.opam/default-clang/lib/ocaml -I /home/antonin/.opam/default-clang/lib/sexplib0 -I ../compiler-stdlib/src -I ../hash_types/src -I ../shadow-stdlib/src -o bytes_stubs.o -c bytes_stubs.c)
# clang: error: unsupported option '-mpopcnt' for target 'aarch64-redhat-linux-gnu'
# File "src/dune", line 14, characters 47-57:
# 14 | (c_names bytes_stubs exn_stubs int_math_stubs hash_stubs am_testing)
# ^^^^^^^^^^
# (cd _build/default/src && /usr/bin/clang -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -D_FILE_OFFSET_BITS=64 -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -D_LARGEFILE64_SOURCE -mpopcnt -g -I /home/antonin/.opam/default-clang/lib/ocaml -I /home/antonin/.opam/default-clang/lib/sexplib0 -I ../compiler-stdlib/src -I ../hash_types/src -I ../shadow-stdlib/src -o hash_stubs.o -c hash_stubs.c)
# clang: error: unsupported option '-mpopcnt' for target 'aarch64-redhat-linux-gnu'
It seems that clang doesn't need the flag and that __builtin_popcountg
should be used.