% uname -a
Darwin jlee-mbair.local 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:59:33 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T8112 arm64
% gcc --version
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: arm64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
% gcc -### -E -march=native -
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: arm64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" "-cc1" "-triple" "arm64-apple-macosx14.0.0" "-Wundef-prefix=TARGET_OS_" "-Wdeprecated-objc-isa-usage" "-Werror=deprecated-objc-isa-usage" "-Werror=implicit-function-declaration" "-E" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "-" "-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=non-leaf" "-fno-strict-return" "-ffp-contract=on" "-fno-rounding-math" "-funwind-tables=1" "-fobjc-msgsend-selector-stubs" "-target-sdk-version=14.2" "-fvisibility-inlines-hidden-static-local-var" "-target-cpu" "apple-m1" "-target-feature" "+neon" "-target-feature" "+v8.5a" "-target-feature" "+zcm" "-target-feature" "+zcz" "-target-abi" "darwinpcs" "-debugger-tuning=lldb" "-target-linker-version" "1022.1" "-fcoverage-compilation-dir=/Users/jeongyun" "-resource-dir" "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" "-I/usr/local/include" "-internal-isystem" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include" "-internal-isystem" "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include" "-internal-externc-isystem" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include" "-internal-externc-isystem" "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include" "-Wno-reorder-init-list" "-Wno-implicit-int-float-conversion" "-Wno-c99-designator" "-Wno-final-dtor-non-final-class" "-Wno-extra-semi-stmt" "-Wno-misleading-indentation" "-Wno-quoted-include-in-framework-header" "-Wno-implicit-fallthrough" "-Wno-enum-enum-conversion" "-Wno-enum-float-conversion" "-Wno-elaborated-enum-base" "-Wno-reserved-identifier" "-Wno-gnu-folding-constant" "-fdebug-compilation-dir=/Users/jeongyun" "-ferror-limit" "19" "-stack-protector" "1" "-fstack-check" "-mdarwin-stkchk-strong-link" "-fblocks" "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" "-fgnuc-version=4.2.1" "-fmax-type-align=16" "-fcommon" "-fcolor-diagnostics" "-clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation" "-fno-odr-hash-protocols" "-clang-vendor-feature=+enableAggressiveVLAFolding" "-clang-vendor-feature=+revert09abecef7bbf" "-clang-vendor-feature=+thisNoAlignAttr" "-clang-vendor-feature=+thisNoNullAttr" "-mllvm" "-disable-aligned-alloc-awareness=1" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o" "-" "-x" "c" "-"
$ resolve-march-native --debug
# gcc -S -fverbose-asm -o /dev/stdout /var/folders/7s/ypkmzhkm8xg2p3001s6lqcqh0000gn/T/tmp_i64nlde.c -march=native
Flags extracted:
# gcc -Q --help=target -march=native
clang: error: unsupported option '--help=target'
clang: error: no input files
# gcc -Q --help=target -mcpu=native
clang: error: unsupported option '--help=target'
clang: error: no input files
Traceback (most recent call last):
File "/Users/jeongyun/Library/Python/3.9/lib/python/site-packages/resolve_march_native/target_help_parser.py", line 96, in get_flags_implied_by_march
gcc_output = subprocess.check_output(cmd, env=env, stderr=stderr).decode('UTF-8')
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 424, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['gcc', '-Q', '--help=target', '-march=native']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/jeongyun/Library/Python/3.9/lib/python/site-packages/resolve_march_native/__main__.py", line 50, in _inner_main
native_unrolled_flag_set = Engine(
File "/Users/jeongyun/Library/Python/3.9/lib/python/site-packages/resolve_march_native/engine.py", line 133, in run
march_native_flag_set = self._get_march_native_flag_set()
File "/Users/jeongyun/Library/Python/3.9/lib/python/site-packages/resolve_march_native/engine.py", line 67, in _get_march_native_flag_set
march_native_flag_set |= set(get_flags_implied_by_march('native', gcc=self._gcc_command,
File "/Users/jeongyun/Library/Python/3.9/lib/python/site-packages/resolve_march_native/target_help_parser.py", line 101, in get_flags_implied_by_march
gcc_output = subprocess.check_output(cmd, env=env, stderr=stderr).decode('UTF-8')
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 424, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['gcc', '-Q', '--help=target', '-mcpu=native']' returned non-zero exit status 1.
ERROR: Command '['gcc', '-Q', '--help=target', '-mcpu=native']' returned non-zero exit status 1.