Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not set MCPU on Apple Silicon #45409

Merged
merged 1 commit into from
May 21, 2022
Merged

Conversation

fxcoudert
Copy link
Contributor

@fxcoudert fxcoudert commented May 21, 2022

This fixes build from source on Apple Silicon: #44517

This MCPU:=apple-m1 leads to -mcpu=apple-m1 being passed to CC, CXX, and FC. However, apple-m1 is a valid option name for clang, but not for gcc and gfortran, and this leads to a build failure in OpenBLAS.

In fact, passing -mcpu=apple-m1 to the compilers is actually unnecessary: all macOS ARM compilers know what the baseline for support on this target is, and already compile code accordingly (this is true of clang and gcc/gfortran). So the simplest fix here is to remove this special case entirely. It was introduced in #36624, I think with the intent of allowing better optimisation. poke @Keno

@giordano giordano requested review from Keno and staticfloat May 21, 2022 13:06
@giordano giordano added building Build system, or building Julia or its dependencies system:apple silicon Affects Apple Silicon only (Darwin/ARM64) - e.g. M1 and other M-series chips backport 1.8 Change should be backported to release-1.8 labels May 21, 2022
@giordano giordano linked an issue May 21, 2022 that may be closed by this pull request
@ViralBShah
Copy link
Member

@yuyichao may also be able to chime in, and he noted along similar lines in #36624 (review)

@giordano
Copy link
Contributor

I can confirm that even without specifying -mpcu, clang automatically sets it automatically to apple-m1 (see -target-cpu):

% echo 'int main(){}' | clang -x c - -###
Apple clang version 13.1.6 (clang-1316.0.21.2)
Target: arm64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
 "/Library/Developer/CommandLineTools/usr/bin/clang" "-cc1" "-triple" "arm64-apple-macosx12.0.0" "-Wundef-prefix=TARGET_OS_" "-Wdeprecated-objc-isa-usage" "-Werror=deprecated-objc-isa-usage" "-Werror=implicit-function-declaration" "-emit-obj" "-mrelax-all" "--mrelax-relocations" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "-" "-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=non-leaf" "-fno-strict-return" "-fno-rounding-math" "-munwind-tables" "-target-sdk-version=12.3" "-fvisibility-inlines-hidden-static-local-var" "-target-cpu" "apple-m1" "-target-feature" "+v8.5a" "-target-feature" "+fp-armv8" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto" "-target-feature" "+dotprod" "-target-feature" "+fp16fml" "-target-feature" "+ras" "-target-feature" "+lse" "-target-feature" "+rdm" "-target-feature" "+rcpc" "-target-feature" "+zcm" "-target-feature" "+zcz" "-target-feature" "+fullfp16" "-target-feature" "+sm4" "-target-feature" "+sha3" "-target-feature" "+sha2" "-target-feature" "+aes" "-target-abi" "darwinpcs" "-fallow-half-arguments-and-returns" "-debugger-tuning=lldb" "-target-linker-version" "762" "-resource-dir" "/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6" "-isysroot" "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" "-I/usr/local/include" "-internal-isystem" "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include" "-internal-isystem" "/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include" "-internal-externc-isystem" "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include" "-internal-externc-isystem" "/Library/Developer/CommandLineTools/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" "-Wno-objc-load-method" "-fdebug-compilation-dir=/Users/mose" "-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=+messageToSelfInClassMethodIdReturnType" "-clang-vendor-feature=+disableInferNewAvailabilityFromInit" "-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" "/var/folders/v2/hmy3kzgj4tb3xsy8qkltxd0r0000gn/T/--b864d5.o" "-x" "c" "-"
 "/Library/Developer/CommandLineTools/usr/bin/ld" "-demangle" "-lto_library" "/Library/Developer/CommandLineTools/usr/lib/libLTO.dylib" "-no_deduplicate" "-dynamic" "-arch" "arm64" "-platform_version" "macos" "12.0.0" "12.3" "-syslibroot" "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" "-o" "a.out" "-L/usr/local/lib" "/var/folders/v2/hmy3kzgj4tb3xsy8qkltxd0r0000gn/T/--b864d5.o" "-lSystem" "/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/lib/darwin/libclang_rt.osx.a"

So the manual setting is probably redundant, and actually harmful for the source build.

@ViralBShah ViralBShah merged commit a5438f9 into JuliaLang:master May 21, 2022
@fxcoudert fxcoudert deleted the mcpu branch May 21, 2022 21:31
KristofferC pushed a commit that referenced this pull request May 28, 2022
@KristofferC KristofferC mentioned this pull request May 28, 2022
36 tasks
@KristofferC KristofferC removed the backport 1.8 Change should be backported to release-1.8 label Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
building Build system, or building Julia or its dependencies system:apple silicon Affects Apple Silicon only (Darwin/ARM64) - e.g. M1 and other M-series chips
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build failure in OpenBLAS
4 participants