CLion - can't run a program on apple m1 - c++

I ran clion a month ago and it worked perfectly. Now when I run a program I get:
/bin/sh: /Users/a/Library/Application Support/JetBrains/Toolbox/apps/CLion-ARM/ch-0/203.7717.62/CLion.app/Contents/bin/cmake/mac/bin/cmake: No such file or directory
make: *** [cmake_check_build_system] Error 127
Also, on clion startup, the cmake tool window shows me an error:
CMake Warning at /Users/a/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-1/211.7142.21/CLion.app/Contents/bin/cmake/mac/share/cmake-3.19/Modules/Platform/Darwin-Initialize.cmake:303 (message):
Ignoring CMAKE_OSX_SYSROOT value:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk
because the directory does not exist.
Call Stack (most recent call first):
/Users/a/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-1/211.7142.21/CLion.app/Contents/bin/cmake/mac/share/cmake-3.19/Modules/CMakeSystemSpecificInitialize.cmake:21 (include)
CMakeLists.txt:2 (project)
-- The C compiler identification is AppleClang 12.0.5.12050022
-- The CXX compiler identification is AppleClang 12.0.5.12050022
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - broken
CMake Error at /Users/a/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-1/211.7142.21/CLion.app/Contents/bin/cmake/mac/share/cmake-3.19/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
"/Library/Developer/CommandLineTools/usr/bin/cc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/a/CLionProjects/untitled1/cmake-build-debug/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_e3f61/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_e3f61.dir/build.make CMakeFiles/cmTC_e3f61.dir/build
Building C object CMakeFiles/cmTC_e3f61.dir/testCCompiler.c.o
/Library/Developer/CommandLineTools/usr/bin/cc -arch arm64 -o CMakeFiles/cmTC_e3f61.dir/testCCompiler.c.o -c /Users/a/CLionProjects/untitled1/cmake-build-debug/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_e3f61
"/Users/a/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-1/211.7142.21/CLion.app/Contents/bin/cmake/mac/bin/cmake" -E cmake_link_script CMakeFiles/cmTC_e3f61.dir/link.txt --verbose=1
/Library/Developer/CommandLineTools/usr/bin/cc -arch arm64 -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_e3f61.dir/testCCompiler.c.o -o cmTC_e3f61
ld: library not found for -lSystem
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [cmTC_e3f61] Error 1
make: *** [cmTC_e3f61/fast] Error 2
I have xcode command line tools installed. What should I do?

Erase cmake-build-... directory manually and reload a CMake project.

Related

Failure to compile for arm64 devices

Hello i am quite new to linux and i am trying to do some cross-compilation to run a flutter app on an external device.
Setup :
VM under virtual box : Ubuntu 22.04 LTS
External device : (imx8) with arm64
So i need to compile my app to match the arm64 architecture but i am having many errors that i have no idea how to fix and no idea where they come from :
Failed to cmake:
-- The CXX compiler identification is Clang 14.0.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ - broken
-- Configuring incomplete, errors occurred!
See also "/home/tom/test_app/build/elinux/arm64/release/CMakeFiles/CMakeOutput.log".
See also "/home/tom/test_app/build/elinux/arm64/release/CMakeFiles/CMakeError.log".
CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:62 (message):
The C++ compiler
"/usr/bin/clang++"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/tom/test_app/build/elinux/arm64/release/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_46f48/fast && /usr/bin/gmake -f CMakeFiles/cmTC_46f48.dir/build.make CMakeFiles/cmTC_46f48.dir/build
gmake[1]: Entering directory '/home/tom/test_app/build/elinux/arm64/release/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_46f48.dir/testCXXCompiler.cxx.o
/usr/bin/clang++ --target=aarch64-linux-gnu --sysroot=/opt/arm64-sysroot -MD -MT CMakeFiles/cmTC_46f48.dir/testCXXCompiler.cxx.o -MF
CMakeFiles/cmTC_46f48.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_46f48.dir/testCXXCompiler.cxx.o -c
/home/tom/test_app/build/elinux/arm64/release/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
Linking CXX executable cmTC_46f48
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_46f48.dir/link.txt --verbose=1
/usr/bin/clang++ --target=aarch64-linux-gnu --sysroot=/opt/arm64-sysroot CMakeFiles/cmTC_46f48.dir/testCXXCompiler.cxx.o -o cmTC_46f48
/usr/bin/aarch64-linux-gnu-ld: cannot find Scrt1.o: No such file or directory
/usr/bin/aarch64-linux-gnu-ld: cannot find crti.o: No such file or directory
/usr/bin/aarch64-linux-gnu-ld: cannot find crtbeginS.o: No such file or directory
/usr/bin/aarch64-linux-gnu-ld: cannot find -lstdc++: No such file or directory
/usr/bin/aarch64-linux-gnu-ld: cannot find -lm: No such file or directory
/usr/bin/aarch64-linux-gnu-ld: cannot find -lgcc_s: No such file or directory
/usr/bin/aarch64-linux-gnu-ld: cannot find -lgcc: No such file or directory
/usr/bin/aarch64-linux-gnu-ld: cannot find -lc: No such file or directory
/usr/bin/aarch64-linux-gnu-ld: cannot find -lgcc_s: No such file or directory
/usr/bin/aarch64-linux-gnu-ld: cannot find -lgcc: No such file or directory
/usr/bin/aarch64-linux-gnu-ld: cannot find crtendS.o: No such file or directory
/usr/bin/aarch64-linux-gnu-ld: cannot find crtn.o: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[1]: *** [CMakeFiles/cmTC_46f48.dir/build.make:100: cmTC_46f48] Error 1
gmake[1]: Leaving directory '/home/tom/test_app/build/elinux/arm64/release/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:127: cmTC_46f48/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
For more specification, i am using the flutter-elinux package to cross-compile and i have raised an issue there, but i am not sure the issue comes from the package as i don't know anything about linux compilation.
I have installed manually the following packages :
sudo apt install cpp-aarch64-linux-gnu
sudo apt install binutils-aarch64-linux-gnu
Thanks in advance for any help i really need to get this working...
EDIT : i have tried another solution using a docker container and the image arm64v8/ubuntu:18.04.
I have created a systroot ubuntu18-arm64-sysroot on my host and i use it to compile my app in arm64 arch. I am having the following error only :
Failed to cmake:
-- The CXX compiler identification is unknown
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /home/tom/ubuntu18-arm64-sysroot/usr/bin/clang++
-- Check for working CXX compiler: /home/tom/ubuntu18-arm64-sysroot/usr/bin/clang++ - broken
-- Configuring incomplete, errors occurred!
See also "/home/tom/test_app/build/elinux/arm64/debug/CMakeFiles/CMakeOutput.log".
See also "/home/tom/test_app/build/elinux/arm64/debug/CMakeFiles/CMakeError.log".
CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:62 (message):
The C++ compiler
"/home/tom/ubuntu18-arm64-sysroot/usr/bin/clang++"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/tom/test_app/build/elinux/arm64/debug/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_848af/fast && /usr/bin/gmake -f
CMakeFiles/cmTC_848af.dir/build.make CMakeFiles/cmTC_848af.dir/build
gmake[1]: Entering directory '/home/tom/test_app/build/elinux/arm64/debug/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_848af.dir/testCXXCompiler.cxx.o
/home/tom/ubuntu18-arm64-sysroot/usr/bin/clang++ -o CMakeFiles/cmTC_848af.dir/testCXXCompiler.cxx.o -c
/home/tom/test_app/build/elinux/arm64/debug/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
aarch64-binfmt-P: Could not open '/lib/ld-linux-aarch64.so.1': No such file or directory
gmake[1]: *** [CMakeFiles/cmTC_848af.dir/build.make:78: CMakeFiles/cmTC_848af.dir/testCXXCompiler.cxx.o] Error 255
gmake[1]: Leaving directory '/home/tom/test_app/build/elinux/arm64/debug/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:127: cmTC_848af/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)

Failing to compile a c++ application under MacOS Catalina 10.15

Note: For how I solved the problem, please look at the end of the post.
Yesterday, I have updated to MacOS Catalina 10.15 and since then I am trying to compile this c++ application (a fork of the nori educational ray tracer), but for some reason CMake fails to find the pthread library. Here is the output after running CMake:
$ cmake ..
-- The C compiler identification is AppleClang 11.0.0.11000033
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Setting build type to 'Release' as none was specified.
-- Performing Test HAS_CPP14_FLAG
-- Performing Test HAS_CPP14_FLAG - Success
-- Performing Test HAS_CPP11_FLAG
-- Performing Test HAS_CPP11_FLAG - Success
-- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.11")
-- Performing Test HAVE_GCC_INLINE_ASM_AVX
-- Performing Test HAVE_GCC_INLINE_ASM_AVX - Failed
-- Performing Test HAVE_SYSCONF_NPROCESSORS_ONLN
-- Performing Test HAVE_SYSCONF_NPROCESSORS_ONLN - Failed
-- TBB: NOT using libc++.
-- Looking for pthread.h
-- Looking for pthread.h - not found
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find Threads (missing: Threads_FOUND)
Call Stack (most recent call first):
/Applications/CMake.app/Contents/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/Applications/CMake.app/Contents/share/cmake-3.15/Modules/FindThreads.cmake:220 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
ext/nanogui/ext/glfw/CMakeLists.txt:60 (find_package)
-- Configuring incomplete, errors occurred!
See also "/Users/harry/dev/nori/build/CMakeFiles/CMakeOutput.log".
See also "/Users/harry/dev/nori/build/CMakeFiles/CMakeError.log".
And following is the CMakeError.log:
Performing C++ SOURCE FILE Test HAVE_GCC_INLINE_ASM_AVX failed with the following output:
Change Dir: /Users/harry/dev/nori/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_1e411/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_1e411.dir/build.make CMakeFiles/cmTC_1e411.dir/build
Building CXX object CMakeFiles/cmTC_1e411.dir/src.cxx.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -std=c++14 -fvisibility=hidden -Wno-switch -Wno-tautological-compare -Wno-deprecated-register -DHAVE_GCC_INLINE_ASM_AVX -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk -mmacosx-version-min=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk -o CMakeFiles/cmTC_1e411.dir/src.cxx.o -c /Users/harry/dev/nori/build/CMakeFiles/CMakeTmp/src.cxx
clang: error: invalid version number in '-mmacosx-version-min=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk'
clang: warning: using sysroot for 'DriverKit' but targeting 'MacOSX' [-Wincompatible-sysroot]
make[1]: *** [CMakeFiles/cmTC_1e411.dir/src.cxx.o] Error 1
make: *** [cmTC_1e411/fast] Error 2
Source file was:
int main()
{
#if defined(__GNUC__) && defined(__SSE2__)
int n = 0;
int eax = 0;
int edx = 0;
__asm__(
"xgetbv ;"
"vzeroupper "
: "=a"(eax), "=d"(edx) : "c"(n) : );
#else
#error No GCC style inline asm supported for AVX instructions
#endif
}
Performing C++ SOURCE FILE Test HAVE_SYSCONF_NPROCESSORS_ONLN failed with the following output:
Change Dir: /Users/harry/dev/nori/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_db06f/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_db06f.dir/build.make CMakeFiles/cmTC_db06f.dir/build
Building CXX object CMakeFiles/cmTC_db06f.dir/src.cxx.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -std=c++14 -fvisibility=hidden -Wno-switch -Wno-tautological-compare -Wno-deprecated-register -DHAVE_SYSCONF_NPROCESSORS_ONLN -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk -mmacosx-version-min=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk -o CMakeFiles/cmTC_db06f.dir/src.cxx.o -c /Users/harry/dev/nori/build/CMakeFiles/CMakeTmp/src.cxx
clang: error: invalid version number in '-mmacosx-version-min=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk'
clang: warning: using sysroot for 'DriverKit' but targeting 'MacOSX' [-Wincompatible-sysroot]
make[1]: *** [CMakeFiles/cmTC_db06f.dir/src.cxx.o] Error 1
make: *** [cmTC_db06f/fast] Error 2
Source file was:
#include <unistd.h>
int main()
{
sysconf(_SC_NPROCESSORS_ONLN);
}
Performing C++ SOURCE FILE Test HAS_LIBCPP failed with the following output:
Change Dir: /Users/harry/dev/nori/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_4098b/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_4098b.dir/build.make CMakeFiles/cmTC_4098b.dir/build
Building CXX object CMakeFiles/cmTC_4098b.dir/src.cxx.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -std=c++14 -fvisibility=hidden -DHAS_LIBCPP -stdlib=libc++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk -mmacosx-version-min=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk -o CMakeFiles/cmTC_4098b.dir/src.cxx.o -c /Users/harry/dev/nori/build/CMakeFiles/CMakeTmp/src.cxx
clang: error: invalid version number in '-mmacosx-version-min=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk'
clang: warning: using sysroot for 'DriverKit' but targeting 'MacOSX' [-Wincompatible-sysroot]
clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)
make[1]: *** [CMakeFiles/cmTC_4098b.dir/src.cxx.o] Error 1
make: *** [cmTC_4098b/fast] Error 2
...and run output:
Return value: 1
Source file was:
#include <iostream>
int main(int argc, char **argv) { std::cout << "test"; return 0; }
Performing C++ SOURCE FILE Test SUPPORTS_STDCXX11 failed with the following output:
Change Dir: /Users/harry/dev/nori/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_74f47/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_74f47.dir/build.make CMakeFiles/cmTC_74f47.dir/build
Building CXX object CMakeFiles/cmTC_74f47.dir/src.cxx.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -std=c++14 -fvisibility=hidden -DSUPPORTS_STDCXX11 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk -mmacosx-version-min=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk -std=c++11 -o CMakeFiles/cmTC_74f47.dir/src.cxx.o -c /Users/harry/dev/nori/build/CMakeFiles/CMakeTmp/src.cxx
clang: error: invalid version number in '-mmacosx-version-min=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk'
clang: warning: using sysroot for 'DriverKit' but targeting 'MacOSX' [-Wincompatible-sysroot]
make[1]: *** [CMakeFiles/cmTC_74f47.dir/src.cxx.o] Error 1
make: *** [cmTC_74f47/fast] Error 2
Source file was:
int main() { return 0; }
Performing C++ SOURCE FILE Test SUPPORTS_MRTM failed with the following output:
Change Dir: /Users/harry/dev/nori/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_60b35/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_60b35.dir/build.make CMakeFiles/cmTC_60b35.dir/build
Building CXX object CMakeFiles/cmTC_60b35.dir/src.cxx.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -std=c++14 -fvisibility=hidden -DSUPPORTS_MRTM -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk -mmacosx-version-min=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk -mrtm -Werror -o CMakeFiles/cmTC_60b35.dir/src.cxx.o -c /Users/harry/dev/nori/build/CMakeFiles/CMakeTmp/src.cxx
clang: error: invalid version number in '-mmacosx-version-min=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk'
clang: error: using sysroot for 'DriverKit' but targeting 'MacOSX' [-Werror,-Wincompatible-sysroot]
make[1]: *** [CMakeFiles/cmTC_60b35.dir/src.cxx.o] Error 1
make: *** [cmTC_60b35/fast] Error 2
Source file was:
int main() { return 0; }
Determining if the include file pthread.h exists failed with the following output:
Change Dir: /Users/harry/dev/nori/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_b4d5d/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_b4d5d.dir/build.make CMakeFiles/cmTC_b4d5d.dir/build
Building C object CMakeFiles/cmTC_b4d5d.dir/CheckIncludeFile.c.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -Wno-deprecated-declarations -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk -mmacosx-version-min=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk -o CMakeFiles/cmTC_b4d5d.dir/CheckIncludeFile.c.o -c /Users/harry/dev/nori/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
clang: error: invalid version number in '-mmacosx-version-min=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk'
clang: warning: using sysroot for 'DriverKit' but targeting 'MacOSX' [-Wincompatible-sysroot]
make[1]: *** [CMakeFiles/cmTC_b4d5d.dir/CheckIncludeFile.c.o] Error 1
make: *** [cmTC_b4d5d/fast] Error 2
The nori ray tracer expects XCode along with the command line tools installed on a MacOS machine. I have Xcode version 11.1 and the corresponding command line tools.
As far as I can see from the CMakeError.log file, clang produces an error, because of an invalid version number of mmacosx-version-min.
clang: error: invalid version number in '-mmacosx-version-min=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk'
I have researched a while trying to find clues on the topic, but failed to find something that solves my problem. The version of clang I have, is the one installed with Xcode: Apple clang version 11.0.0.
I am open to hear any suggestion and provide any additional information on my configuration you may find useful to pinpoint the issue.
P.S.: I forgot to mention, that back when I first started working on this project, I had a similar issue on MacOS Mojave here. And I was able to fix it by installing the SDK headers as noted in this post:
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
Working solution: Installing an older version of XCode (10.2.1 works well for me) and redirecting to it (making it the active developer directory with xcode-select -s [path-to-old-xcode]) turns out to solve my problem. The solution was proposed by Aaron19960821 from GitHub. See here.

Test Cmake run finished with errors (CLION)

I have the following problem after changing path to one that is easier for the operating system. My MinGW configuration in CLion:
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken
CMake Error at C:/Program Files/JetBrains/CLion 2018.2.5/bin/cmake/win/share/cmake-3.12/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"C:/MinGW/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/Michał/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp
Run Build Command:"C:/MinGW/bin/mingw32-make.exe" "cmTC_da460/fast"
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_da460.dir\build.make CMakeFiles/cmTC_da460.dir/build
mingw32-make.exe[1]: Entering directory 'C:/Users/Micha│/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_da460.dir/testCCompiler.c.obj
C:\MinGW\bin\gcc.exe -o CMakeFiles\cmTC_da460.dir\testCCompiler.c.obj -c C:\Users\Michał\AppData\Local\Temp\cmake_check_environment\_build\CMakeFiles\CMakeTmp\testCCompiler.c
gcc.exe: error: C:\Users\Michał\AppData\Local\Temp\cmake_check_environment\_build\CMakeFiles\CMakeTmp\testCCompiler.c: No such file or directory
gcc.exe: fatal error: no input files
compilation terminated.
CMakeFiles\cmTC_da460.dir\build.make:64: recipe for target 'CMakeFiles/cmTC_da460.dir/testCCompiler.c.obj' failed
mingw32-make.exe[1]: *** [CMakeFiles/cmTC_da460.dir/testCCompiler.c.obj] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/Users/Micha│/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp'
Makefile:120: recipe for target 'cmTC_da460/fast' failed
mingw32-make.exe: *** [cmTC_da460/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:1 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/Michał/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Michał/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeError.log".
Error code: 1
Here is a screenshot from my PC:

gcc-4.8 can't compile test program? [duplicate]

This question already has answers here:
g++: error trying to exec 'cc1plus': execvp: No such file or directory
(5 answers)
Closed 5 years ago.
I've installed gcc-4.8 on Ubuntu 16.04 to build a C++11 program. I have a CMakeList.txt file that worked well on OS X with Clang and GCC 4.8 built from Macports.
I started by setting CXX=/usr/bin/gcc-4.8 and then CMake fails with the following error:
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/gcc-4.8
-- Check for working CXX compiler: /usr/bin/gcc-4.8 -- broken
CMake Error at /usr/share/cmake-3.5/Modules/CMakeTestCXXCompiler.cmake:54 (message):
The C++ compiler "/usr/bin/gcc-4.8" is not able to compile a simple test
program.
It fails with the following output:
Change Dir: /home/ruipacheco/databaseclient/cpp/ninja/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_5df0c/fast"
/usr/bin/make -f CMakeFiles/cmTC_5df0c.dir/build.make
CMakeFiles/cmTC_5df0c.dir/build
make[1]: Entering directory
'/home/ruipacheco/databaseclient/cpp/ninja/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_5df0c.dir/testCXXCompiler.cxx.o
/usr/bin/gcc-4.8 -o CMakeFiles/cmTC_5df0c.dir/testCXXCompiler.cxx.o -c
/home/ruipacheco/databaseclient/cpp/ninja/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
gcc-4.8: error trying to exec 'cc1plus': execvp: No such file or directory
CMakeFiles/cmTC_5df0c.dir/build.make:65: recipe for target
'CMakeFiles/cmTC_5df0c.dir/testCXXCompiler.cxx.o' failed
make[1]: *** [CMakeFiles/cmTC_5df0c.dir/testCXXCompiler.cxx.o] Error 1
make[1]: Leaving directory
'/home/ruipacheco/databaseclient/cpp/ninja/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_5df0c/fast' failed
make: *** [cmTC_5df0c/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:6 (project)
-- Configuring incomplete, errors occurred!
Again, I know gcc-4.8 is capable of building C++11 programs and I've managed to make this CMakeLists.txt file work with gcc 4.8 on OSX so what could I be missing?
"gcc-4.8" is a C compiler, not a C++ compiler. You should set the CXX variable to "g++-4.8" or "g++" or some other C++ compiler executable.

CMAKE Error /usr/bin/cc -- broken

I am trying to compile a simple .cpp file but when i issue cmake .. its throw error
-- The C compiler identification is GNU 4.7.3
-- The CXX compiler identification is GNU 4.7.3
-- Check for working C compiler: /usr/bin/cc
-- **Check for working C compiler: /usr/bin/cc -- broken**
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "/usr/bin/cc" is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/user/jagdish/hello/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/make "cmTryCompileExec3772316685/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec3772316685.dir/build.make
CMakeFiles/cmTryCompileExec3772316685.dir/build
make[1]: Entering directory `/home/user/jagdish/hello/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report
/home/user/jagdish/hello/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object
CMakeFiles/cmTryCompileExec3772316685.dir/testCCompiler.c.o
/usr/bin/cc -o CMakeFiles/cmTryCompileExec3772316685.dir/testCCompiler.c.o
-c /home/user/jagdish/hello/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTryCompileExec3772316685
/usr/bin/cmake -E cmake_link_script
CMakeFiles/cmTryCompileExec3772316685.dir/link.txt --verbose=1
/usr/bin/cc CMakeFiles/cmTryCompileExec3772316685.dir/testCCompiler.c.o -o
cmTryCompileExec3772316685 -rdynamic
collect2: error: ld terminated with signal 11 [Segmentation fault]
make[1]: *** [cmTryCompileExec3772316685] Error 1
make[1]: Leaving directory `/home/user/jagdish/hello/CMakeFiles/CMakeTmp'
make: *** [cmTryCompileExec3772316685/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
-- Configuring incomplete, errors occurred!
See also "/home/user/jagdish/hello/CMakeFiles/CMakeOutput.log".
See also "/home/user/jagdish/hello/CMakeFiles/CMakeError.log".