Clang fails to detect CPU features

soralx at cydem.org soralx at cydem.org
Mon Jul 6 09:00:06 UTC 2020


Greetings!

 Just a quick heads-up that clang fails to detect CPU features correctly
 in some cases when compiling with -march=native; this affects at least
 the following ports:
  -- graphics/opencv: when built on a Xeon E3120, fails to execute [0].
     Workaround: add '-mno-popcnt' to CFLAGS, CPPFLAGS, CXXFLAGS in
                /etc/make.conf, mess with the source to make it compile.
     This might be purely a bug in opencv, but I recall that there are
     problems with other ports as well if I don't keep "-mno-popcnt" in
     FLAGS.
  -- devel/cargo-c, multimedia/librav1e: fail to build on Pentium
     G3220 [1]. Workaround: change CPUTYPE to 'westmere' in
                            /etc/make.conf to disable AVX ('-mno-avx'
                            alone does not help).

 Could someone please have a look to see if this is easily fixable,
 and/or forward the bug report upstream?


[0] # opencv_version
******************************************************************
* FATAL ERROR:                                                   *
* This OpenCV build doesn't support current CPU/HW configuration *
*                                                                *
* Use OPENCV_DUMP_CONFIG=1 environment variable for details      *
******************************************************************

Required baseline features:
SSE - OK
SSE - OK
SSE2 - OK
SSE2 - OK
SSE3 - OK
SSE3 - OK
SSSE3 - OK
SSSE3 - OK
SSE4.1 - OK
SSE4.1 - OK
POPCNT - NOT AVAILABLE
POPCNT - NOT AVAILABLE

[1] /usr/ports/devel/cargo-c
   Compiling hex v0.4.2
     Running `/usr/local/bin/rustc --crate-name hex --edition=2018 /usr/ports/devel/cargo-c/work/cargo-c-0.6.7/cargo-crates/hex-0.4.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=2 --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=5d66a3cbee41d9cd -C extra-filename=-5d66a3cbee41d9cd --out-dir /usr/ports/devel/cargo-c/work/target/release/deps -L dependency=/usr/ports/devel/cargo-c/work/target/release/deps --cap-lints allow -C target-cpu=native -C target-feature=-avx -C target-feature=-avx2 -C target-feature=-sse-unaligned-mem -C linker=cc -C link-arg=-fstack-protector-strong`
     Running `/usr/ports/devel/cargo-c/work/target/release/build/libc-ea90492b731ea9bd/build-script-build`
error: failed to run custom build command for `libc v0.2.71`

Caused by:
  process didn't exit successfully: `/usr/ports/devel/cargo-c/work/target/release/build/libc-ea90492b731ea9bd/build-script-build` (signal: 4, SIGILL: illegal instruction)
*** Error code 101


-- 
[SorAlx]  ridin' VN2000 Classic LT


More information about the freebsd-toolchain mailing list