open-source-parsers / open-source-parsers/jsoncpp

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

Open
#1,371 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug build
Dominant language
C++
Stars
8.9k
Forks
2.7k
Avg merge
31m
Merged PRs (30d)
1

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Xcode build with CMAKE_OSX_ARCHITECTURES=arm64 and JSONCPP_WITH_POST_BUILD_UNITTEST enabled, then compare it with the disabled-option and x86_64 builds described in the issue. Investigate the CMake post-build path that runs jsoncpp_test; done means the arm64 build completes and the test runs successfully with all 119 tests passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, macos
Domain
build-system, operating-systems, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.