jsoncpp icon indicating copy to clipboard operation
jsoncpp copied to clipboard

Post-build unit test fails to run on Mac OS Apple silicon M1

Open retifrav opened this issue 4 years ago • 2 comments

Describe the bug

When building on Mac OS Apple Silicon M1, the build fails with the following errors:

WriteAuxiliaryFile /Users/some/buildAgent/work/jsoncpp/build/src/test_lib_json/jsoncpp.build/Debug/jsoncpp_test.build/Script-A6438F521B5657CAC4CB248A.sh (in target 'jsoncpp_test' from project 'jsoncpp')
    cd /Users/some/buildAgent/work/jsoncpp
    write-file /Users/some/buildAgent/work/jsoncpp/build/src/test_lib_json/jsoncpp.build/Debug/jsoncpp_test.build/Script-A6438F521B5657CAC4CB248A.sh

PhaseScriptExecution CMake\ PostBuild\ Rules /Users/some/buildAgent/work/jsoncpp/build/src/test_lib_json/jsoncpp.build/Debug/jsoncpp_test.build/Script-A6438F521B5657CAC4CB248A.sh (in target 'jsoncpp_test' from project 'jsoncpp')
    cd /Users/some/buildAgent/work/jsoncpp
    /bin/sh -c /Users/some/buildAgent/work/jsoncpp/build/src/test_lib_json/jsoncpp.build/Debug/jsoncpp_test.build/Script-A6438F521B5657CAC4CB248A.sh
/Users/some/buildAgent/work/jsoncpp/build/src/test_lib_json/jsoncpp.build/Debug/jsoncpp_test.build/Script-A6438F521B5657CAC4CB248A.sh: line 6: 72847 Killed: 9
/Users/some/buildAgent/work/jsoncpp/build/bin/Debug/jsoncpp_test
Command PhaseScriptExecution failed with a nonzero exit code

** BUILD FAILED **

The following build commands failed:
        PhaseScriptExecution CMake\ PostBuild\ Rules /Users/some/buildAgent/work/jsoncpp/build/src/test_lib_json/jsoncpp.build/Debug/jsoncpp_test.build/Script-A6438F521B5657CAC4CB248A.sh
(1 failure)

If I try to run jsoncpp_test manually, that fails like this:

$ ./bin/Debug/jsoncpp_test
zsh: killed     ./bin/Debug/jsoncpp_test

To reproduce

Steps to reproduce the behavior:

$ cd /path/to/jsoncpp
$ mkdir build && cd $_
$ cmake -G Xcode -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_INSTALL_PREFIX="../install" -DCMAKE_DEBUG_POSTFIX="d" ..
$ cmake --build . --target install --config Debug

Expected behavior

The build succeeds.

Environment

$ uname -m
arm64

$ sw_vers -productVersion
11.2

$ clang --version
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: arm64-apple-darwin20.3.0

$ cmake --version
cmake version 3.19.8

Additional context

If I configure the build with JSONCPP_WITH_POST_BUILD_UNITTEST option unset, then the build succeeds and I can also successfully run jsoncpp_test manually:

$ cmake -G Xcode -DCMAKE_OSX_ARCHITECTURES="arm64" -DJSONCPP_WITH_POST_BUILD_UNITTEST=0 -DCMAKE_INSTALL_PREFIX="../install" -DCMAKE_DEBUG_POSTFIX="d" ..
$ cmake --build . --target install --config Debug

** BUILD SUCCEEDED **

$ ./bin/Debug/jsoncpp_test
...
All 119 tests passed

Also, everything (both the build and automatic post-build unit test) succeeds if I configure and build for x86_64 architecture:

$ cmake -G Xcode -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_INSTALL_PREFIX="../install" -DCMAKE_DEBUG_POSTFIX="d" ..
$ cmake --build . --target install --config Debug

retifrav avatar Dec 16 '21 13:12 retifrav

I run into the same issue. Are there any leads?

Ufaowl avatar Feb 15 '22 09:02 Ufaowl

I am facing same issue not able to build for iOS simulator on Mac M1

varun-naharia avatar Sep 09 '24 10:09 varun-naharia