facebook / watchman

Watches files and records, or triggers actions, when they change.
https://facebook.github.io/watchman/
MIT License
12.57k stars 986 forks source link

macOS : cmake build is assuming SDKs are based on host OS version and hard-coded locations rather than available SDKs #1069

Open skull-squadron opened 1 year ago

skull-squadron commented 1 year ago

Repro

  1. brew install -s watchman

  2. Causes

cmake -S . -B build -DENABLE_EDEN_SUPPORT=ON -DWATCHMAN_VERSION_OVERRIDE=2022.10.24.00 -DWATCHMAN_BUILDINFO_OVERRIDE=Homebrew -DWATCHMAN_STATE_DIR=/Users/ba/.homebrew/var/run/watchman -DCMAKE_INSTALL_PREFIX=/Users/ba/.homebrew/Cellar/watchman/2022.10.24.00 -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=Release -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_VERBOSE_MAKEFILE=ON -Wno-dev -DBUILD_TESTING=OFF -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.sdk

Problem

  1. Ventura ships with MacOSX12.sdk. SDKs vary widely and aren't tied to the host.

  2. Xcode ships with CLT inside of itself (usually) at {{xcode app of varying names and paths}}.app/Contents//Developer The path is $(mdfind 'kMDItemCFBundleIdentifier = "com.apple.dt.Xcode"')

    a. /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.sdk exists in Xcode 14.0.1 + macOS 13. b. /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include definitely doesn't exist in anything except (currently usable and unsupportable) beta software. It could be in the stand-alone CLT for Xcode 14, but that's pie in the sky.

Remediation

Verify beforehand or let the tools figure out -isysroot.

## Build log snippet Catch you later in the diffs and not too many SEVs :) ``` -- PACKAGE_VERSION=2022.10.24.00, BUILD_INFO= -- The CXX compiler identification is AppleClang 14.0.0.14000029 -- The C compiler identification is AppleClang 14.0.0.14000029 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /Users/ba/.homebrew/Library/Homebrew/shims/mac/super/clang++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /Users/ba/.homebrew/Library/Homebrew/shims/mac/super/clang - skipped -- Detecting C compile features -- Detecting C compile features - done -- Found gmock via config, defines=, include=/Users/ba/.homebrew/include, libs=GTest::gmock_main;GTest::gmock;GTest::gtest -- Looking for accept4 -- Looking for accept4 - not found -- Looking for backtrace -- Looking for backtrace - found -- Looking for backtrace_symbols -- Looking for backtrace_symbols - found -- Looking for backtrace_symbols_fd -- Looking for backtrace_symbols_fd - found -- Looking for fdopendir -- Looking for fdopendir - found -- Looking for getattrlistbulk -- Looking for getattrlistbulk - found -- Looking for inotify_init -- Looking for inotify_init - not found -- Looking for inotify_init1 -- Looking for inotify_init1 - not found -- Looking for kqueue -- Looking for kqueue - found -- Looking for localeconv -- Looking for localeconv - found -- Looking for memmem -- Looking for memmem - found -- Looking for mkostemp -- Looking for mkostemp - found -- Looking for openat -- Looking for openat - found -- Looking for pipe2 -- Looking for pipe2 - not found -- Looking for port_create -- Looking for port_create - not found -- Looking for statfs -- Looking for statfs - found -- Looking for strtoll -- Looking for strtoll - found -- Looking for sys_siglist -- Looking for sys_siglist - found -- Looking for include file CoreServices/CoreServices.h -- Looking for include file CoreServices/CoreServices.h - found -- Looking for include file execinfo.h -- Looking for include file execinfo.h - found -- Looking for include file fcntl.h -- Looking for include file fcntl.h - found -- Looking for include file inttypes.h -- Looking for include file inttypes.h - found -- Looking for include file locale.h -- Looking for include file locale.h - found -- Looking for include file port.h -- Looking for include file port.h - not found -- Looking for include file sys/event.h -- Looking for include file sys/event.h - found -- Looking for include file sys/inotify.h -- Looking for include file sys/inotify.h - not found -- Looking for include file sys/mount.h -- Looking for include file sys/mount.h - found -- Looking for include file sys/param.h -- Looking for include file sys/param.h - found -- Looking for include file sys/resource.h -- Looking for include file sys/resource.h - found -- Looking for include file sys/socket.h -- Looking for include file sys/socket.h - found -- Looking for include file sys/statfs.h -- Looking for include file sys/statfs.h - not found -- Looking for include file sys/statvfs.h -- Looking for include file sys/statvfs.h - found -- Looking for include file sys/types.h -- Looking for include file sys/types.h - found -- Looking for include file sys/ucred.h -- Looking for include file sys/ucred.h - found -- Looking for include file sys/vfs.h -- Looking for include file sys/vfs.h - not found -- Looking for include file valgrind/valgrind.h -- Looking for include file valgrind/valgrind.h - not found -- Performing Test HAVE_STRUCT_STATVFS_F_FSTYPENAME -- Performing Test HAVE_STRUCT_STATVFS_F_FSTYPENAME - Failed -- Performing Test HAVE_STRUCT_STATVFS_F_BASETYPE -- Performing Test HAVE_STRUCT_STATVFS_F_BASETYPE - Failed -- Looking for O_SYMLINK -- Looking for O_SYMLINK - found -- Found PCRE2: /Users/ba/.homebrew/lib/libpcre2-8.dylib -- Found Threads: TRUE -- Found OpenSSL: /Users/ba/.homebrew/opt/openssl@1.1/lib/libcrypto.dylib (found version "1.1.1q") -- Found gflags from package config /Users/ba/.homebrew/lib/cmake/gflags/gflags-config.cmake -- Found Glog: /Users/ba/.homebrew/lib/libglog.dylib -- Found gflags as a dependency of glog::glog, include=/Users/ba/.homebrew/include, libs=gflags_shared -- Found Boost: /Users/ba/.homebrew/lib/cmake/Boost-1.80.0/BoostConfig.cmake (found suitable version "1.80.0", minimum required is "1.54.0") found components: context thread -- Found libevent: /Users/ba/.homebrew/lib/libevent.dylib -- Found edencommon: /Users/ba/.homebrew -- Found Boost: /Users/ba/.homebrew/lib/cmake/Boost-1.80.0/BoostConfig.cmake (found suitable version "1.80.0", minimum required is "1.51.0") found components: context filesystem program_options regex system thread -- Found folly: /Users/ba/.homebrew -- Found Sodium: /Users/ba/.homebrew/lib/libsodium.dylib -- Found folly: /Users/ba/.homebrew -- Found ZLIB: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.sdk/usr/lib/libz.tbd (found version "1.2.11") -- Found fizz: /Users/ba/.homebrew -- Found wangle: /Users/ba/.homebrew -- Found FBThrift: /Users/ba/.homebrew -- Found fb303: /Users/ba/.homebrew -- Using sys python -- Found Python3: /Users/ba/.homebrew/bin/python3.10 (found version "3.10.8") found components: Interpreter Development Development.Module Development.Embed -- Configuring done CMake Error in CMakeLists.txt: Imported target "FBThrift::thriftcpp2" includes non-existent path "/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include" in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include: * The path was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and references files it does not provide. CMake Error in CMakeLists.txt: Imported target "FBThrift::thriftcpp2" includes non-existent path "/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include" in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include: * The path was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and references files it does not provide. CMake Error in CMakeLists.txt: Imported target "FBThrift::thriftcpp2" includes non-existent path "/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include" in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include: * The path was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and references files it does not provide. ```
fanzeyi commented 1 year ago

The error message seems to be talking about the imported target FBThrift::thriftcpp2 having these paths. Could it be from how Thrift's CMake target was exported?

CMake Error in CMakeLists.txt:
  Imported target "FBThrift::thriftcpp2" includes non-existent path

    "/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.