Building on macOS 12.6 fails because CMake tries to link with libatomic, which does not exist.
The following warning message printed when running CMake might be related:
CMake Warning (dev) at /usr/local/Cellar/cmake/3.24.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args`
(GCCLIBATOMIC) does not match the name of the calling package (GccAtomic).
This can lead to problems in calling code that expects `find_package`
result variables (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
cmake/Modules/FindGccAtomic.cmake:19 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:14 (find_package)
and
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
GCCLIBATOMIC_LIBRARY
linked by target "testSwap" in directory /Users/termi/Documents/ChimeraTK/cppext
linked by target "example2" in directory /Users/termi/Documents/ChimeraTK/cppext
linked by target "testWhenAny" in directory /Users/termi/Documents/ChimeraTK/cppext
linked by target "testSharing" in directory /Users/termi/Documents/ChimeraTK/cppext
linked by target "testWhenAll" in directory /Users/termi/Documents/ChimeraTK/cppext
linked by target "testSemaphore" in directory /Users/termi/Documents/ChimeraTK/cppext
linked by target "testContinuations" in directory /Users/termi/Documents/ChimeraTK/cppext
linked by target "testPushPop" in directory /Users/termi/Documents/ChimeraTK/cppext
linked by target "testPerformance" in directory /Users/termi/Documents/ChimeraTK/cppext
linked by target "testStresstestMultiproducer" in directory /Users/termi/Documents/ChimeraTK/cppext
linked by target "testExceptions" in directory /Users/termi/Documents/ChimeraTK/cppext
linked by target "testFront" in directory /Users/termi/Documents/ChimeraTK/cppext
linked by target "testEmpty" in directory /Users/termi/Documents/ChimeraTK/cppext
linked by target "testReadWriteAvailable" in directory /Users/termi/Documents/ChimeraTK/cppext
linked by target "testStresstest" in directory /Users/termi/Documents/ChimeraTK/cppext
linked by target "example" in directory /Users/termi/Documents/ChimeraTK/cppext
Subsequently, the build process fails with the following message:
ld: library not found for -lGCCLIBATOMIC_LIBRARY-NOTFOUND
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I could fix the problems by removing the references to libatomic from CMakeLists.txt, but of course this isn’t a good solution because builds will then fail on systems where libatomic is needed.
I think the best way of solving this would be linking against libatomic, if it is found, but simply ignoring it, if it is not found.
Building on macOS 12.6 fails because CMake tries to link with
libatomic
, which does not exist.The following warning message printed when running CMake might be related:
and
Subsequently, the build process fails with the following message:
If I understand https://clang.llvm.org/docs/Toolchain.html#atomics-library correctly, when using Clang / LLVM, support for atomics is provided by compiler-rt instead of libatomic.
I could fix the problems by removing the references to libatomic from
CMakeLists.txt
, but of course this isn’t a good solution because builds will then fail on systems where libatomic is needed.I think the best way of solving this would be linking against libatomic, if it is found, but simply ignoring it, if it is not found.