Re: the clang compiler does not support '-march=native'

From: Mark Millard via freebsd-hackers <freebsd-hackers_at_freebsd.org>
Date: Mon, 14 Jun 2021 14:07:33 -0700
On 2021-Jun-14, at 13:18, Dimitry Andric <dim at FreeBSD.org> wrote:

> On 14 Jun 2021, at 22:08, tech-lists <tech-lists_at_zyxst.net> wrote:
>> 
>> There's a program I'd like to compile, but I'm getting an error "the
>> clang compiler does not support '-march=native'"
>> 
>> % clang --version
>> FreeBSD clang version 11.0.1 (git_at_github.com:llvm/llvm-project.git
>> llvmorg-11.0.1-0-g43ff75f2c3fe)
>> Target: aarch64-unknown-freebsd13.0
>> Thread model: posix
>> InstalledDir: /usr/bin
>> 
>> Is this because I have this in /etc/src.conf:
>> 
>> WITHOUT_LLVM_TARGET_ALL=
>> WITH_LLVM_TARGET_AARCH64=
>> WITH_LLVM_TARGET_ARM=
>> 
>> (this is on a rpi4 arm64.aarch64)
> 
> No, this is because whatever you are trying to compile has apparently
> hardcoded "-march=native" in its compile flags. Try removing that. :)

I'll add to that note the comparison/contrast of
aarch64 vs. amd64 as a context for clang:

The aarch64 context rejects the value "native":

# echo | clang -E - -march=native -###
FreeBSD clang version 11.0.1 (git_at_github.com:llvm/llvm-project.git llvmorg-11.0.1-0-g43ff75f2c3fe)
Target: aarch64-unknown-freebsd14.0
Thread model: posix
InstalledDir: /usr/bin
clang: error: the clang compiler does not support '-march=native'
 (in-process)
 "/usr/bin/clang" "-cc1" "-triple" "aarch64-unknown-freebsd14.0" "-E" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "-" "-mrelocation-model" "static" "-mframe-pointer=non-leaf" "-fno-rounding-math" "-mconstructor-aliases" "-munwind-tables" "-target-cpu" "generic" "-target-feature" "+neon" "-target-abi" "aapcs" "-fallow-half-arguments-and-returns" "-fno-split-dwarf-inlining" "-debugger-tuning=gdb" "-resource-dir" "/usr/lib/clang/11.0.1" "-fdebug-compilation-dir" "/usr/home/root" "-ferror-limit" "19" "-fno-signed-char" "-fgnuc-version=4.2.1" "-faddrsig" "-o" "-" "-x" "c" "-"

The amd64 context, by contrast, does not complain:

# echo | clang -E - -march=native -###
FreeBSD clang version 11.0.1 (git_at_github.com:llvm/llvm-project.git llvmorg-11.0.1-0-g43ff75f2c3fe)
Target: x86_64-unknown-freebsd14.0
Thread model: posix
InstalledDir: /usr/bin
 (in-process)
 "/usr/bin/clang" "-cc1" "-triple" "x86_64-unknown-freebsd14.0" "-E" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "-" "-mrelocation-model" "static" "-mframe-pointer=all" "-fno-rounding-math" "-mconstructor-aliases" "-munwind-tables" "-target-cpu" "znver1" "-target-feature" "+sse2" "-target-feature" "-tsxldtrk" "-target-feature" "+cx16" "-target-feature" "+sahf" "-target-feature" "-tbm" "-target-feature" "-avx512ifma" "-target-feature" "+sha" "-target-feature" "-gfni" "-target-feature" "-fma4" "-target-feature" "-vpclmulqdq" "-target-feature" "+prfchw" "-target-feature" "+bmi2" "-target-feature" "-cldemote" "-target-feature" "+fsgsbase" "-target-feature" "-ptwrite" "-target-feature" "-amx-tile" "-target-feature" "-avx512bf16" "-target-feature" "+popcnt" "-target-feature" "+aes" "-target-feature" "-avx512bitalg" "-target-feature" "-movdiri" "-target-feature" "+xsaves" "-target-feature" "-avx512er" "-target-feature" "+xsavec" "-target-feature" "-avx512vnni" "-target-feature" "-amx-bf16" "-target-feature" "-avx512vpopcntdq" "-target-feature" "-pconfig" "-target-feature" "-clwb" "-target-feature" "-avx512f" "-target-feature" "+clzero" "-target-feature" "-pku" "-target-feature" "+mmx" "-target-feature" "-lwp" "-target-feature" "-rdpid" "-target-feature" "-xop" "-target-feature" "+rdseed" "-target-feature" "-waitpkg" "-target-feature" "-movdir64b" "-target-feature" "+sse4a" "-target-feature" "-avx512bw" "-target-feature" "+clflushopt" "-target-feature" "+xsave" "-target-feature" "-avx512vbmi2" "-target-feature" "+64bit" "-target-feature" "-avx512vl" "-target-feature" "-serialize" "-target-feature" "-invpcid" "-target-feature" "-avx512cd" "-target-feature" "+avx" "-target-feature" "-vaes" "-target-feature" "+cx8" "-target-feature" "+fma" "-target-feature" "-rtm" "-target-feature" "+bmi" "-target-feature" "-enqcmd" "-target-feature" "+rdrnd" "-target-feature" "+mwaitx" "-target-feature" "+sse4.1" "-target-feature" "+sse4.2" "-target-feature" "+avx2" "-target-feature" "+fxsr" "-target-feature" "-wbnoinvd" "-target-feature" "+sse" "-target-feature" "+lzcnt" "-target-feature" "+pclmul" "-target-feature" "-prefetchwt1" "-target-feature" "+f16c" "-target-feature" "+ssse3" "-target-feature" "-sgx" "-target-feature" "-shstk" "-target-feature" "+cmov" "-target-feature" "-avx512vbmi" "-target-feature" "-amx-int8" "-target-feature" "+movbe" "-target-feature" "-avx512vp2intersect" "-target-feature" "+xsaveopt" "-target-feature" "-avx512dq" "-target-feature" "+adx" "-target-feature" "-avx512pf" "-target-feature" "+sse3" "-fno-split-dwarf-inlining" "-debugger-tuning=gdb" "-resource-dir" "/usr/lib/clang/11.0.1" "-fdebug-compilation-dir" "/usr/fbsd/main-src" "-ferror-limit" "19" "-fgnuc-version=4.2.1" "-fcolor-diagnostics" "-faddrsig" "-o" "-" "-x" "c" "-"


===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)
Received on Mon Jun 14 2021 - 21:07:33 UTC

Original text of this message