Build failure with clang: unsupported `-mpopcnt` option
MisterDA opened this issue · 1 comments
MisterDA commented
#=== 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.
fognitro9 commented
Getting the same error on Termux (where gcc
is linked to clang
):
#=== ERROR while compiling base.v0.17.0 =======================================#
# context 2.1.6 | linux/arm64 | ocaml-base-compiler.5.2.0 | https://opam.ocaml.org#6c0498c5
# path ~/.opam/5.2.0/.opam-switch/build/base.v0.17.0
# command ~/.opam/5.2.0/bin/dune build -p base -j 7
# exit-code 1
# env-file ~/.opam/log/base-22295-f950c4.env
# output-file ~/.opam/log/base-22295-f950c4.out
### output ###
# [...]
# (cd _build/default/src && /data/data/com.termux/files/usr/bin/gcc -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -pthread -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -mpopcnt -g -I /data/data/com.termux/files/home/.opam/5.2.0/lib/ocaml -I /data/data/com.termux/files/home/.opam/5.2.0/lib/ocaml_intrinsics_kernel -I /data/data/com.termux/files/home/.opam/5.2.0/lib/sexplib0 -I ../hash_types/src[...]
# gcc: error: unsupported option '-mpopcnt' for target 'aarch64-unknown-linux-android24'
# File "src/dune", line 19, characters 57-66:
# 19 | (names bytes_stubs exn_stubs int_math_stubs hash_stubs obj_stubs am_testing)
# ^^^^^^^^^
# (cd _build/default/src && /data/data/com.termux/files/usr/bin/gcc -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -pthread -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -mpopcnt -g -I /data/data/com.termux/files/home/.opam/5.2.0/lib/ocaml -I /data/data/com.termux/files/home/.opam/5.2.0/lib/ocaml_intrinsics_kernel -I /data/data/com.termux/files/home/.opam/5.2.0/lib/sexplib0 -I ../hash_types/src[...]
# gcc: error: unsupported option '-mpopcnt' for target 'aarch64-unknown-linux-android24'