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

Command PhaseScriptExecution failed with a nonzero exit code #12

Open
MyPublicGitHubAcct opened this issue Aug 7, 2022 · 3 comments
Open

Comments

@MyPublicGitHubAcct
Copy link

I am getting the error below when building Tests. I saw the same thing when compiling Catch2 v3 tests for a simple Hello World program on the same system (macOS 12.5, Xcode 13.4.1) and wondered how you had solved it. This does not happen on an older system (intel process, macOS 11.x).

CMake Error at _deps/catch2-src/extras/CatchAddTests.cmake:60 (message):
  Error running test executable
  '/Users/home/Documents/SourceControl/test-pample/Builds/Debug/Tests':

    Result: Subprocess killed
    Output: 


Command PhaseScriptExecution failed with a nonzero exit code

@MyPublicGitHubAcct
Copy link
Author

MyPublicGitHubAcct commented Aug 7, 2022

This appears to be related to this - > catchorg/Catch2#2411

Seems that the easiest thing that can be done currently (at least while developing) is to just remove the catch_discover_tests step in the CMakeLists file, but I don't know if this is really correct. The post on the CMake gitlab post linked to here catchorg/Catch2#2411 (comment) makes me think someone is thinking about a better way.

@sudara
Copy link
Owner

sudara commented Aug 14, 2022

Interesting, haven't run into this... I use CLion (as it provides a consistent interface on macOS/Windows, can use clang-format and is a nicer experience overall).

Not sure what to suggest outside of waiting for the Catch/CMake team to respond...

@jemmons
Copy link

jemmons commented Jun 18, 2023

I use CLion

It seems weird that CLion would do something different with executable signing than Xcode. Or are you not building on an Apple Silicon CPU? If you are, it’d be good to know what specifically in CLion’s build process is different.

In the mean time, the work-around suggested in the Catch2 thread seems to work well. I added this to my CMakeLists.txt right after set_target_properties(Tests ...):

if (CMAKE_GENERATOR STREQUAL Xcode)
    add_custom_command(TARGET Tests POST_BUILD VERBATIM
        COMMAND codesign --force --timestamp --options runtime --sign SOME_IDENTITY ${CMAKE_BINARY_DIR}/Debug/Tests
    )
endif()

Where SOME_IDENTITY is your signing identity. You can find that with:

security find-identity -v -p codesigning

Replace SOME_IDENTITY with either the 40-character hex string or the (full!) quoted string that comes after it. If you run this and nothing comes up, these Apple Docs are probably the place to start reading?

And if you don’t want to mess with your cmake file, you could always just manually sign from the command line with something like:

 codesign --force --timestamp --options runtime --sign SOME_IDENTITY Builds/Debug/Tests

and then run Tests from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants