Не в состоянии скомпилировать приложение C ++ под MacOS Catalina 10.15 - PullRequest
2 голосов
/ 23 октября 2019

Вчера я обновился до MacOS Catalina 10.15, и с тех пор я пытаюсь скомпилировать это c ++ приложение (ответвление от nori Educational Ray Tracer), но по какой-то причинеCMake не может найти библиотеку pthread . Вот вывод после запуска 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".

И следующее это 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

Нори-трассировщик ожидает XCode вместе с инструментами командной строки, установленными на MacOSмашина. У меня Xcode версии 11.1 и соответствующие инструменты командной строки.

Насколько я вижу из файла CMakeError.log, clang выдает ошибку из-за неверного номера версии mmacosx-version-мин .

clang: error: invalid version number in '-mmacosx-version-min=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk'

Я пытался найти подсказки по этой теме, но не смог найти то, что решило бы мою проблему. У меня есть версия clang, установленная с Xcode: Apple clang version 11.0.0.

Я открыт, чтобы выслушать любые предложения и предоставить любую дополнительную информацию о моей конфигурации, которая может оказаться полезной для точного определения проблемы.


PS : я забыл упомянуть, что когда я впервые начал работать над этим проектом, у меня была похожая проблема с MacOS Mojave здесь . И я смог это исправить, установив заголовки SDK, как отмечено в этом посте :

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
...