Xcode 12 Universal Beta default architecture selection
When I use the below CMakeLists.txt and get the output below it. This only happens using the Xcode generator (Makefiles are fine) and with the CMAKE_OSX_ARCHITECTURES
unset. It seems to be defaulting to building an arm64 target for some reason (which fails to run on my Intel machine).
cmake_minimum_required(VERSION 3.17)
project(Test)
try_run(RUN_RES COMPILE_RES
${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/std_regex.cpp
COMPILE_OUTPUT_VARIABLE COMPILE_OUT
RUN_OUTPUT_VARIABLE RUN_OUT)
if (NOT RUN_RES EQUAL 0 OR NOT COMPILE_RES)
message(STATUS "COMPILE: ${COMPILE_RES}")
message(STATUS "${COMPILE_OUT}")
message("")
message(STATUS "RUN: ${RUN_RES}")
message(STATUS "${RUN_OUT}")
message(FATAL_ERROR "Can't try_run")
else()
message(STATUS "try_run was fine")
endif()
% cmake -GXcode ../
-- The C compiler identification is AppleClang 12.0.0.12000022
-- The CXX compiler identification is AppleClang 12.0.0.12000022
-- Check for working C compiler: /Users/X/Downloads/Xcode-beta-universal.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Check for working C compiler: /Users/X/Downloads/Xcode-beta-universal.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Users/X/Downloads/Xcode-beta-universal.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-- Check for working CXX compiler: /Users/X/Downloads/Xcode-beta-universal.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- COMPILE: TRUE
-- Change Dir: /Users/X/Development/test/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/xcodebuild -project CMAKE_TRY_COMPILE.xcodeproj build -target cmTC_8fbe7 -configuration Debug -hideShellScriptEnvironment && Command line invocation:
/Users/X/Downloads/Xcode-beta-universal.app/Contents/Developer/usr/bin/xcodebuild -project CMAKE_TRY_COMPILE.xcodeproj build -target cmTC_8fbe7 -configuration Debug -hideShellScriptEnvironment
User defaults from command line:
HideShellScriptEnvironment = YES
Prepare build
warning: The Legacy Build System will be removed in a future release. You can configure the selected build system and this deprecation message in File > (null) Settings.
=== BUILD TARGET cmTC_8fbe7 OF PROJECT CMAKE_TRY_COMPILE WITH CONFIGURATION Debug ===
Check dependencies
Write auxiliary files
/bin/mkdir -p /Users/X/Development/test/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_8fbe7.build/Objects-normal/arm64
write-file /Users/X/Development/test/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_8fbe7.build/Objects-normal/arm64/cmTC_8fbe7.LinkFileList
CompileC CMAKE_TRY_COMPILE.build/Debug/cmTC_8fbe7.build/Objects-normal/arm64/std_regex.o /Users/X/Development/test/std_regex.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/X/Development/test/build/CMakeFiles/CMakeTmp
/Users/X/Downloads/Xcode-beta-universal.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -target arm64-apple-macos10.15 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -DCMAKE_INTDIR=\"Debug\" -isysroot /Users/X/Downloads/Xcode-beta-universal.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -g -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-range-loop-analysis -Wno-semicolon-before-method-body -I/Users/X/Development/test/build/CMakeFiles/CMakeTmp/Debug/include -I/Users/X/Development/test/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_8fbe7.build/DerivedSources-normal/arm64 -I/Users/X/Development/test/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_8fbe7.build/DerivedSources/arm64 -I/Users/X/Development/test/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_8fbe7.build/DerivedSources -F/Users/X/Development/test/build/CMakeFiles/CMakeTmp/Debug -MMD -MT dependencies -MF /Users/X/Development/test/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_8fbe7.build/Objects-normal/arm64/std_regex.d --serialize-diagnostics /Users/X/Development/test/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_8fbe7.build/Objects-normal/arm64/std_regex.dia -c /Users/X/Development/test/std_regex.cpp -o /Users/X/Development/test/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_8fbe7.build/Objects-normal/arm64/std_regex.o
Ld Debug/cmTC_8fbe7 normal arm64
cd /Users/X/Development/test/build/CMakeFiles/CMakeTmp
/Users/X/Downloads/Xcode-beta-universal.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target arm64-apple-macos10.15 -isysroot /Users/X/Downloads/Xcode-beta-universal.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk -L/Users/X/Development/test/build/CMakeFiles/CMakeTmp/Debug -F/Users/X/Development/test/build/CMakeFiles/CMakeTmp/Debug -filelist /Users/X/Development/test/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_8fbe7.build/Objects-normal/arm64/cmTC_8fbe7.LinkFileList -Xlinker -object_path_lto -Xlinker /Users/X/Development/test/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_8fbe7.build/Objects-normal/arm64/cmTC_8fbe7_lto.o -Xlinker -no_deduplicate -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Xlinker -dependency_info -Xlinker /Users/X/Development/test/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_8fbe7.build/Objects-normal/arm64/cmTC_8fbe7_dependency_info.dat -o /Users/X/Development/test/build/CMakeFiles/CMakeTmp/Debug/cmTC_8fbe7
ProcessProductPackaging "" CMAKE_TRY_COMPILE.build/Debug/cmTC_8fbe7.build/cmTC_8fbe7.xcent
cd /Users/X/Development/test/build/CMakeFiles/CMakeTmp
Entitlements:
{
"com.apple.security.get-task-allow" = 1;
}
builtin-productPackagingUtility -entitlements -format xml -o /Users/X/Development/test/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_8fbe7.build/cmTC_8fbe7.xcent
CodeSign Debug/cmTC_8fbe7
cd /Users/X/Development/test/build/CMakeFiles/CMakeTmp
Signing Identity: "-"
/usr/bin/codesign --force --sign - --entitlements /Users/X/Development/test/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_8fbe7.build/cmTC_8fbe7.xcent --timestamp=none /Users/X/Development/test/build/CMakeFiles/CMakeTmp/Debug/cmTC_8fbe7
** BUILD SUCCEEDED **
-- RUN: FAILED_TO_RUN
-- Bad CPU type in executable
CMake Error at CMakeLists.txt:16 (message):
Can't try_run
-- Configuring incomplete, errors occurred!
See also "/Users/X/Development/test/build/CMakeFiles/CMakeOutput.log".
Related to #20863 (closed) This occurs in the wild in the Google benchmark library.
Edited by Brad King