Catch2
Catch2 copied to clipboard
"Result: Subprocess killed" build/runtime issue with CMake & Xcode generator on macOS with Apple Silicon
using latest macOS Monterey and Xcode (13.3.1)
See minimal repro: catch2-v3-issue.zip
The same thing seems to work just fine on Intel + Xcode.
Working scenario (Makefile/default generator):
-
cmake -S. -B_builds/macos-makefiles -DCMAKE_PREFIX_PATH=/tmp/catch2
(where /tmp/catch2 is where I installed 17a04f88d90d3687bd561e89dab40e4ba6a55b83) -
cmake --build _builds/macos-makefiles
-
./_builds/macos-makefiles/c2issue_tests
Everything builds and runs fine:
➜ catch2-v3-issue cmake -S. -B_builds/macos-makefiles -DCMAKE_PREFIX_PATH=/tmp/catch2
-- The C compiler identification is AppleClang 13.1.6.13160021
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/homebrew/opt/ccache/libexec/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/homebrew/opt/ccache/libexec/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-makefiles
➜ catch2-v3-issue cmake --build _builds/macos-makefiles
[ 25%] Building CXX object CMakeFiles/c2issue.dir/main.cpp.o
[ 50%] Linking CXX executable c2issue
[ 50%] Built target c2issue
[ 75%] Building CXX object CMakeFiles/c2issue_tests.dir/main.tests.cpp.o
[100%] Linking CXX executable c2issue_tests
[100%] Built target c2issue_tests
➜ catch2-v3-issue ./_builds/macos-makefiles/c2issue_tests
Randomness seeded to: 120581041
===============================================================================
All tests passed (1 assertion in 1 test case)
Failing scenario when using Xcode Generator:
-
cmake -S. -B_builds/macos-xcode -GXcode -DCMAKE_PREFIX_PATH=/tmp/catch2
(where /tmp/catch2 is where I installed 17a04f88d90d3687bd561e89dab40e4ba6a55b83) -
cmake --build _builds/macos-xcode
FAILURE
Here is the log:
➜ catch2-v3-issue cmake -S. -B_builds/macos-xcode -GXcode -DCMAKE_PREFIX_PATH=/tmp/catch2
-- The C compiler identification is AppleClang 13.1.6.13160021
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode
➜ catch2-v3-issue cmake --build _builds/macos-xcode
objc[64655]: Class AppleTypeCRetimerRestoreInfoHelper is implemented in both /usr/lib/libauthinstall.dylib (0x1dc73deb0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x104a0c4f8). One of the two will be used. Which one is undefined.
objc[64655]: Class AppleTypeCRetimerFirmwareAggregateRequestCreator is implemented in both /usr/lib/libauthinstall.dylib (0x1dc73df00) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x104a0c548). One of the two will be used. Which one is undefined.
objc[64655]: Class AppleTypeCRetimerFirmwareRequestCreator is implemented in both /usr/lib/libauthinstall.dylib (0x1dc73df50) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x104a0c598). One of the two will be used. Which one is undefined.
objc[64655]: Class ATCRTRestoreInfoFTABFile is implemented in both /usr/lib/libauthinstall.dylib (0x1dc73dfa0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x104a0c5e8). One of the two will be used. Which one is undefined.
objc[64655]: Class AppleTypeCRetimerFirmwareCopier is implemented in both /usr/lib/libauthinstall.dylib (0x1dc73dff0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x104a0c638). One of the two will be used. Which one is undefined.
objc[64655]: Class ATCRTRestoreInfoFTABSubfile is implemented in both /usr/lib/libauthinstall.dylib (0x1dc73e040) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x104a0c688). One of the two will be used. Which one is undefined.
2022-04-19 15:59:15.081 xcodebuild[64655:5564024] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-04-19 15:59:15.082 xcodebuild[64655:5564024] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project catch2-v3-issue.xcodeproj build -target ALL_BUILD -parallelizeTargets -configuration Debug -hideShellScriptEnvironment
User defaults from command line:
HideShellScriptEnvironment = YES
IDEPackageSupportUseBuiltinSCM = YES
note: Using new build system
note: Planning
Analyze workspace
Create build description
Build description signature: 5cc4b70f9e898de2893941342661f4e1
Build description path: /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/build/XCBuildData/5cc4b70f9e898de2893941342661f4e1-desc.xcbuild
note: Build preparation complete
note: Building targets in dependency order
CreateBuildDirectory /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode
cd /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.xcodeproj
builtin-create-build-directory /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode
CreateBuildDirectory /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/Debug
cd /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.xcodeproj
builtin-create-build-directory /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/Debug
WriteAuxiliaryFile /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/ZERO_CHECK.build/Script-BCE4030B4B2B00B1BA6B9344.sh (in target 'ZERO_CHECK' from project 'catch2-v3-issue')
cd /Users/gegles/Workspaces/playground/catch2-v3-issue
write-file /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/ZERO_CHECK.build/Script-BCE4030B4B2B00B1BA6B9344.sh
PhaseScriptExecution Generate\ CMakeFiles/ZERO_CHECK /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/ZERO_CHECK.build/Script-BCE4030B4B2B00B1BA6B9344.sh (in target 'ZERO_CHECK' from project 'catch2-v3-issue')
cd /Users/gegles/Workspaces/playground/catch2-v3-issue
/bin/sh -c /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/ZERO_CHECK.build/Script-BCE4030B4B2B00B1BA6B9344.sh
make: `/Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/CMakeFiles/cmake.check_cache' is up to date.
WriteAuxiliaryFile /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue_tests.build/DerivedSources/Entitlements.plist (in target 'c2issue_tests' from project 'catch2-v3-issue')
cd /Users/gegles/Workspaces/playground/catch2-v3-issue
write-file /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue_tests.build/DerivedSources/Entitlements.plist
WriteAuxiliaryFile /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue.build/DerivedSources/Entitlements.plist (in target 'c2issue' from project 'catch2-v3-issue')
cd /Users/gegles/Workspaces/playground/catch2-v3-issue
write-file /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue.build/DerivedSources/Entitlements.plist
ProcessProductPackaging "" /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue_tests.build/c2issue_tests.xcent (in target 'c2issue_tests' from project 'catch2-v3-issue')
cd /Users/gegles/Workspaces/playground/catch2-v3-issue
Entitlements:
{
"com.apple.security.get-task-allow" = 1;
}
builtin-productPackagingUtility -entitlements -format xml -o /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue_tests.build/c2issue_tests.xcent
ProcessProductPackaging "" /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue.build/c2issue.xcent (in target 'c2issue' from project 'catch2-v3-issue')
cd /Users/gegles/Workspaces/playground/catch2-v3-issue
Entitlements:
{
"com.apple.security.get-task-allow" = 1;
}
builtin-productPackagingUtility -entitlements -format xml -o /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue.build/c2issue.xcent
WriteAuxiliaryFile /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue_tests.build/Objects-normal/arm64/c2issue_tests.LinkFileList (in target 'c2issue_tests' from project 'catch2-v3-issue')
cd /Users/gegles/Workspaces/playground/catch2-v3-issue
write-file /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue_tests.build/Objects-normal/arm64/c2issue_tests.LinkFileList
CompileC /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue_tests.build/Objects-normal/arm64/main.tests.o /Users/gegles/Workspaces/playground/catch2-v3-issue/main.tests.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'c2issue_tests' from project 'catch2-v3-issue')
cd /Users/gegles/Workspaces/playground/catch2-v3-issue
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -target arm64-apple-macos12.3 -fmessage-length\=264 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -fcolor-diagnostics -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 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.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/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/Debug/include -isystem /tmp/catch2/include -I/Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue_tests.build/DerivedSources-normal/arm64 -I/Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue_tests.build/DerivedSources/arm64 -I/Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue_tests.build/DerivedSources -F/Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/Debug -std\=gnu++14 -MMD -MT dependencies -MF /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue_tests.build/Objects-normal/arm64/main.tests.d --serialize-diagnostics /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue_tests.build/Objects-normal/arm64/main.tests.dia -c /Users/gegles/Workspaces/playground/catch2-v3-issue/main.tests.cpp -o /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue_tests.build/Objects-normal/arm64/main.tests.o
WriteAuxiliaryFile /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue.build/Objects-normal/arm64/c2issue.LinkFileList (in target 'c2issue' from project 'catch2-v3-issue')
cd /Users/gegles/Workspaces/playground/catch2-v3-issue
write-file /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue.build/Objects-normal/arm64/c2issue.LinkFileList
CompileC /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue.build/Objects-normal/arm64/main.o /Users/gegles/Workspaces/playground/catch2-v3-issue/main.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'c2issue' from project 'catch2-v3-issue')
cd /Users/gegles/Workspaces/playground/catch2-v3-issue
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -target arm64-apple-macos12.3 -fmessage-length\=264 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -fcolor-diagnostics -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 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.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/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/Debug/include -I/Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue.build/DerivedSources-normal/arm64 -I/Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue.build/DerivedSources/arm64 -I/Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue.build/DerivedSources -F/Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/Debug -MMD -MT dependencies -MF /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue.build/Objects-normal/arm64/main.d --serialize-diagnostics /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue.build/Objects-normal/arm64/main.dia -c /Users/gegles/Workspaces/playground/catch2-v3-issue/main.cpp -o /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue.build/Objects-normal/arm64/main.o
Ld /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/Debug/c2issue normal (in target 'c2issue' from project 'catch2-v3-issue')
cd /Users/gegles/Workspaces/playground/catch2-v3-issue
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target arm64-apple-macos12.3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -L/Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/Debug -F/Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/Debug -filelist /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue.build/Objects-normal/arm64/c2issue.LinkFileList -Xlinker -object_path_lto -Xlinker /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue.build/Objects-normal/arm64/c2issue_lto.o -Xlinker -no_deduplicate -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue.build/Objects-normal/arm64/c2issue_dependency_info.dat -o /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/Debug/c2issue
Ld /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/Debug/c2issue_tests normal (in target 'c2issue_tests' from project 'catch2-v3-issue')
cd /Users/gegles/Workspaces/playground/catch2-v3-issue
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target arm64-apple-macos12.3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -L/Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/Debug -F/Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/Debug -filelist /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue_tests.build/Objects-normal/arm64/c2issue_tests.LinkFileList -Xlinker -object_path_lto -Xlinker /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue_tests.build/Objects-normal/arm64/c2issue_tests_lto.o -Xlinker -no_deduplicate -Wl,-search_paths_first -Wl,-headerpad_max_install_names /tmp/catch2/lib/libCatch2Main.a /tmp/catch2/lib/libCatch2.a -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue_tests.build/Objects-normal/arm64/c2issue_tests_dependency_info.dat -o /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/Debug/c2issue_tests
CodeSign /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/Debug/c2issue (in target 'c2issue' from project 'catch2-v3-issue')
cd /Users/gegles/Workspaces/playground/catch2-v3-issue
Signing Identity: "-"
/usr/bin/codesign --force --sign - --entitlements /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue.build/c2issue.xcent --timestamp\=none --generate-entitlement-der /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/Debug/c2issue
RegisterExecutionPolicyException /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/Debug/c2issue (in target 'c2issue' from project 'catch2-v3-issue')
cd /Users/gegles/Workspaces/playground/catch2-v3-issue
builtin-RegisterExecutionPolicyException /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/Debug/c2issue
WriteAuxiliaryFile /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue_tests.build/Script-70D18F003A153BBE74BB9ACD.sh (in target 'c2issue_tests' from project 'catch2-v3-issue')
cd /Users/gegles/Workspaces/playground/catch2-v3-issue
write-file /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue_tests.build/Script-70D18F003A153BBE74BB9ACD.sh
PhaseScriptExecution CMake\ PostBuild\ Rules /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue_tests.build/Script-70D18F003A153BBE74BB9ACD.sh (in target 'c2issue_tests' from project 'catch2-v3-issue')
cd /Users/gegles/Workspaces/playground/catch2-v3-issue
/bin/sh -c /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue_tests.build/Script-70D18F003A153BBE74BB9ACD.sh
CMake Error at /tmp/catch2/lib/cmake/Catch2/CatchAddTests.cmake:45 (message):
Error running test executable
'/Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/Debug/c2issue_tests':
Result: Subprocess killed
Output:
Command PhaseScriptExecution failed with a nonzero exit code
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution CMake\ PostBuild\ Rules /Users/gegles/Workspaces/playground/catch2-v3-issue/_builds/macos-xcode/catch2-v3-issue.build/Debug/c2issue_tests.build/Script-70D18F003A153BBE74BB9ACD.sh (in target 'c2issue_tests' from project 'catch2-v3-issue')
(1 failure)
Any thoughts, anybody?
FYI, this is still happening with v3.0.0-preview5. Thx!
I'm running into the same problem even with the latest Catch2 v3.0.1.
On Apple Silicon, all binaries need to be signed before they can run otherwise you'll encounter a crash. I think the problem here is that catch_discover_tests
relies on running the compiled test executable for test discovery BEFORE Xcode actually signs it (Xcode seems to sign binaries after CMake's POST_BUILD
steps are run, which is what catch_discover_tests
uses).
The workaround is to manually sign the test executable prior to running catch_discover_tests
(signature will later be overwritten by Xcode). See https://gitlab.kitware.com/cmake/cmake/-/issues/21845 for more info.
Ideally, Catch2 would provide a way of delaying test discovery.
@gegles This issue is still reproducible with latest Catch2 v3.1.0 and latest CMake 3.23 on M1 Mac. It seems like @dwosk suggestion about missing executable signature is correct. In my scenario it reproduces as the result of catch_discover_tests
command trying to run unsigned executable in Xcode build:.codesign -dv --verbose=4 [exe_path]
reports "code object is not signed at all", while executable built without catch_discover_tests
command is signed as expected.
@horenmar Could you please reopen this issue, as it is still reproducible?
Yes, I confirm, this is still a legit issue.
Hello all, AFAIK this is still a problem, since I am currently experiencing it. Could someone be so kind to explain the workaround from @dwosk in a little more detail or provide details for a different workaround? It would be a great "feature" if I could run my catch2 with ctest and thereby have it more easily integrated into my CI/CD system.
@horenmar Any updates on this?
After way too long trying to get this to work, I've got tests running through CMake + Xcode generators on an M1 with the following inside my tests/CMakeLists.txt
if (CMAKE_GENERATOR STREQUAL Xcode)
add_custom_command(TARGET runtests POST_BUILD VERBATIM
COMMAND codesign --force --timestamp --options runtime --sign <IDENTITY> ${CMAKE_BINARY_DIR}/tests/Debug/runtests
)
endif()
Hope that helps some time for anyone else that runs into this.
This is a regression from Catch v2.x. I am porting to v3.x today and encountered this error for the first time. IMO it should be solvable by the Catch team.
By the way, found a good work around. Since 3.5.0 you can use DISCOVERY_MODE
PRE_TEST
when calling catch_discover_tests
successfully with Xcode
https://github.com/catchorg/Catch2/blob/devel/docs/cmake-integration.md#customization
Only downside is you must specify the config when calling ctest... e.g. ctest -C Release