microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
22.88k stars 6.31k forks source link

[qt5-base] build failure on macOS 10.15 #14943

Closed FranciscoPombal closed 2 years ago

FranciscoPombal commented 3 years ago

Host Environment

To Reproduce

I reproduced this in release-only build, but from the failure logs, it does not look like that has any impact.

./vcpkg install qt5-base:x64-osx-release --clean-after-build --overlay-triplets=triplets_overlay

Contents of triplets_overlay/x64-osx-release.cmake:

set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)

set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_BUILD_TYPE release)

Failure logs

https://github.com/FranciscoPombal/qBittorrent/runs/1499053061?check_suite_focus=true

Starting package 26/26: qt5-base:x64-osx-release
Building package qt5-base[core]:x64-osx-release...
-- [OVERLAY] Loading triplet configuration from: /Users/runner/work/qBittorrent/qBittorrent/triplets_overlay/x64-osx-release.cmake
-- Figuring out qt target mkspec. Target arch x64
-- Target mkspec set to: macx-clang
-- Host mkspec not set. Qt's own buildsystem will try to figure out the host system
-- Downloading http://download.qt.io/official_releases/qt/5.15/5.15.1/submodules/qtbase-everywhere-src-5.15.1.tar.xz...
-- Extracting source /Users/runner/qbt_tools/vcpkg/downloads/qtbase-everywhere-src-5.15.1.tar.xz
-- Applying patch patches/winmain_pro.patch
-- Applying patch patches/windows_prf.patch
-- Applying patch patches/qt_app.patch
-- Applying patch patches/gui_configure.patch
-- Applying patch patches/icu.patch
-- Applying patch patches/xlib.patch
-- Applying patch patches/egl.patch
-- Applying patch patches/zstdd.patch
-- Applying patch patches/Qt5BasicConfig.patch
-- Applying patch patches/Qt5PluginTarget.patch
-- Applying patch patches/create_cmake.patch
-- Applying patch patches/Qt5GuiConfigExtras.patch
-- Using source at /Users/runner/qbt_tools/vcpkg/buildtrees/qt5-base/src/5.15.1-63a9328040.clean
xcodebuild: error: SDK "/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk" cannot be located.
xcrun: error: unable to lookup item 'SDKVersion' in SDK '/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk'
-- Detected OSX SDK Version: 
CMake Error at ports/qt5-base/portfile.cmake:264 (string):
  string sub-command REGEX, mode MATCH needs at least 5 arguments total to
  command.
Call Stack (most recent call first):
  scripts/ports.cmake:136 (include)

Error: Building package qt5-base:x64-osx-release failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `./vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
  Package: qt5-base:x64-osx-release
  Vcpkg version: 2020.11.12-unknownhash

Additionally, attach any relevant sections from the log files above.

Additional context

I don't have a macOS system so I can't test this further on my own.

FranciscoPombal commented 3 years ago

@Neumann-A This is a follow-up to https://github.com/microsoft/vcpkg/issues/14941, as mentioned in https://github.com/microsoft/vcpkg/issues/14941#issuecomment-738806392.

Neumann-A commented 3 years ago

that is due to xcrun --show-sdk-version failing you could try setting VCPKG_OSX_DEPLOYMENT_TARGET to 10.15 in the triplet to skip the detection but I assume it has something to do with an env variable being missing for xcrun to succeed (probably SDKROOT and/or MACOSX_DEPLOYMENT_TARGET)

FranciscoPombal commented 3 years ago

@Neumann-A

that is due to xcrun --show-sdk-version failing you could try setting VCPKG_OSX_DEPLOYMENT_TARGET to 10.15 in the triplet to skip the detection

OK, I'm trying that now: https://github.com/FranciscoPombal/qBittorrent/runs/1499371354?check_suite_focus=true

but I assume it has something to do with an env variable being missing for xcrun to succeed (probably SDKROOT and/or MACOSX_DEPLOYMENT_TARGET)

If the triplet method does not work, do you known what I should set those variables to?

Neumann-A commented 3 years ago

Nope don't have access to macosx myself. I am just cleverly googling error messages and that error does not have a clever solution yet. https://stackoverflow.com/questions/60536169/xcrun-show-sdk-version-error-cant-build-with-xcode-on-mojave

maybe you can run xcrun --show-sdk-version --verbose or use --log to get more info from what is happening and why it is not working (https://www.real-world-systems.com/docs/xcrun.1.html). maybe xcode is simply not setup correctly.

FranciscoPombal commented 3 years ago

@Neumann-A

I ran:

xcrun --show-sdk-path --verbose --log
echo "**********"
xcrun --show-sdk-version --verbose --log

Here is the output:

/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
**********
xcrun: note: looking up SDK with '/Applications/Xcode_12.2.app/Contents/Developer/usr/bin/xcodebuild -sdk /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -version SDKVersion'
xcrun: note: PATH = '/usr/local/opt/pipx_bin:/Users/runner/.cargo/bin:/usr/local/lib/ruby/gems/2.7.0/bin:/usr/local/opt/ruby/bin:/usr/local/opt/curl/bin:/usr/local/bin:/usr/local/sbin:/Users/runner/bin:/Users/runner/.yarn/bin:/usr/local/go/bin:/Users/runner/Library/Android/sdk/tools:/Users/runner/Library/Android/sdk/platform-tools:/Users/runner/Library/Android/sdk/ndk-bundle:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/bin:/bin:/usr/sbin:/sbin:/Users/runner/.dotnet/tools:/Users/runner/.ghcup/bin:/Users/runner/hostedtoolcache/stack/2.5.1/x64'
xcrun: note: SDKROOT = '/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk'
xcrun: note: TOOLCHAINS = ''
xcrun: note: DEVELOPER_DIR = '/Applications/Xcode_12.2.app/Contents/Developer'
xcrun: note: XCODE_DEVELOPER_USR_PATH = ''
xcrun: note: xcrun_db = '/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/xcrun_db'
xcodebuild: error: SDK "/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk" cannot be located.
xcrun: error: unable to lookup item 'SDKVersion' in SDK '/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk'

Looks like the same "incoherence" mentioned in https://stackoverflow.com/questions/60536169/xcrun-show-sdk-version-error-cant-build-with-xcode-on-mojave.

The output from xcrun --sdk macosx10.15 --show-sdk-path --verbose --log is:

xcrun: note: looking up SDK with '/Applications/Xcode_12.2.app/Contents/Developer/usr/bin/xcodebuild -sdk macosx10.15 -version Path'
xcrun: note: PATH = '/usr/local/opt/pipx_bin:/Users/runner/.cargo/bin:/usr/local/lib/ruby/gems/2.7.0/bin:/usr/local/opt/ruby/bin:/usr/local/opt/curl/bin:/usr/local/bin:/usr/local/sbin:/Users/runner/bin:/Users/runner/.yarn/bin:/usr/local/go/bin:/Users/runner/Library/Android/sdk/tools:/Users/runner/Library/Android/sdk/platform-tools:/Users/runner/Library/Android/sdk/ndk-bundle:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/bin:/bin:/usr/sbin:/sbin:/Users/runner/.dotnet/tools:/Users/runner/.ghcup/bin:/Users/runner/hostedtoolcache/stack/2.5.1/x64'
xcrun: note: SDKROOT = 'macosx10.15'
xcrun: note: TOOLCHAINS = ''
xcrun: note: DEVELOPER_DIR = '/Applications/Xcode_12.2.app/Contents/Developer'
xcrun: note: XCODE_DEVELOPER_USR_PATH = ''
xcrun: note: xcrun_db = '/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/xcrun_db'
xcodebuild: error: SDK "macosx10.15" cannot be located.
xcrun: note: looking up SDK with '/Applications/Xcode_12.2.app/Contents/Developer/usr/bin/xcodebuild -sdk macosx10.15 -version Path'
xcrun: note: PATH = '/usr/local/opt/pipx_bin:/Users/runner/.cargo/bin:/usr/local/lib/ruby/gems/2.7.0/bin:/usr/local/opt/ruby/bin:/usr/local/opt/curl/bin:/usr/local/bin:/usr/local/sbin:/Users/runner/bin:/Users/runner/.yarn/bin:/usr/local/go/bin:/Users/runner/Library/Android/sdk/tools:/Users/runner/Library/Android/sdk/platform-tools:/Users/runner/Library/Android/sdk/ndk-bundle:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/bin:/bin:/usr/sbin:/sbin:/Users/runner/.dotnet/tools:/Users/runner/.ghcup/bin:/Users/runner/hostedtoolcache/stack/2.5.1/x64'
xcrun: note: SDKROOT = 'macosx10.15'
xcrun: note: TOOLCHAINS = ''
xcrun: note: DEVELOPER_DIR = '/Applications/Xcode_12.2.app/Contents/Developer'
xcrun: note: XCODE_DEVELOPER_USR_PATH = ''
xcrun: note: xcrun_db = '/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/xcrun_db'
xcodebuild: error: SDK "macosx10.15" cannot be located.
xcrun: error: unable to lookup item 'Path' in SDK 'macosx10.15'

There might be a problem with the runner setup I guess.

FranciscoPombal commented 3 years ago

that is due to xcrun --show-sdk-version failing you could try setting VCPKG_OSX_DEPLOYMENT_TARGET to 10.15 in the triplet to skip the detection

OK, I'm trying that now: https://github.com/FranciscoPombal/qBittorrent/runs/1499371354?check_suite_focus=true

It builds OK with this workaround (adding set(VCPKG_OSX_DEPLOYMENT_TARGET 10.15) to the triplet file).

Neumann-A commented 3 years ago

hmm maybe it needs to be xcrun --sdk macosx --show-sdk-path

ericfont commented 2 years ago

I experienced this issue to when trying to build qt5-base via vcpkg on github's mac runner:

  Starting package 32/32: qt5-base:x64-osx
  Building package qt5-base[core]:x64-osx...
  -- Figuring out qt target mkspec. Target arch x64
  -- Target mkspec set to: macx-clang
  -- Host mkspec not set. Qt's own buildsystem will try to figure out the host system
  -- Downloading https://download.qt.io/official_releases/qt/5.15/5.15.2/submodules/qtbase-everywhere-src-5.15.2.tar.xz;https://mirrors.ocf.berkeley.edu/qt/official_releases/qt/5.15/5.15.2/submodules/qtbase-everywhere-src-5.15.2.tar.xz -> qtbase-everywhere-src-5.15.2.tar.xz...
  -- Extracting source /Users/runner/work/SerialAudio/SerialAudio/vcpkg/downloads/qtbase-everywhere-src-5.15.2.tar.xz
  -- Applying patch patches/winmain_pro.patch
  -- Applying patch patches/windows_prf.patch
  -- Applying patch patches/qt_app.patch
  -- Applying patch patches/gui_configure.patch
  -- Applying patch patches/icu.patch
  -- Applying patch patches/xlib.patch
  -- Applying patch patches/egl.patch
  -- Applying patch patches/zstdd.patch
  -- Applying patch patches/mysql_plugin_include.patch
  -- Applying patch patches/mysql-configure.patch
  -- Applying patch patches/Qt5BasicConfig.patch
  -- Applying patch patches/Qt5PluginTarget.patch
  -- Applying patch patches/create_cmake.patch
  -- Applying patch patches/Qt5GuiConfigExtras.patch
  -- Applying patch patches/limits_include.patch
  -- Using source at /Users/runner/work/SerialAudio/SerialAudio/vcpkg/buildtrees/qt5-base/src/5.15.2-fa8de595e1.clean
  xcodebuild: error: SDK "/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk" cannot be located.
  xcrun: error: unable to lookup item 'SDKVersion' in SDK '/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk'
  -- Detected OSX SDK Version: 
  CMake Error at ports/qt5-base/portfile.cmake:323 (string):
  Error:   string sub-command REGEX, mode MATCH needs at least 5 arguments total to
    command.
  Call Stack (most recent call first):
    scripts/ports.cmake:142 (include)

  Error: Building package qt5-base:x64-osx failed with: BUILD_FAILED
  Please ensure you're using the latest portfiles with `git pull` and `./vcpkg update`, then
  submit an issue at https://github.com/Microsoft/vcpkg/issues including:
    package: qt5-base[core]:x64-osx -> 5.15.2#13
    vcpkg version: 2021-11-02-af04ebf6274fd6f7a941bff4662b3955c64f6f42
    vcpkg-tool version: 369878e 2021-11-10 (2 hours ago)

  Additionally, attach any relevant sections from the log files above.

  [LogCollection][End]File:'/Users/runner/work/SerialAudio/SerialAudio/builds/ninja-multi-vcpkg/vcpkg-manifest-install.log'.
  CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:831 (message):
  Error:   vcpkg install failed.  See logs for more information:
    /Users/runner/work/SerialAudio/SerialAudio/builds/ninja-multi-vcpkg/vcpkg-manifest-install.log
  Call Stack (most recent call first):
    /Users/runner/work/_temp/-1442738397/cmake-3.21.2-macos-universal/CMake.app/Contents/share/cmake-3.21/Modules/CMakeDetermineSystem.cmake:124 (include)
    CMakeLists.txt:3 (project)

  CMake Error: CMake was unable to find a build program corresponding to "Ninja Multi-Config".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
  CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
  CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
  -- Configuring incomplete, errors occurred!
⏱ elapsed: 2846.265 seconds
Error: "CMake failed with error code: '1'.
    at CMakeRunner.<anonymous> (/Users/runner/work/_actions/lukka/run-cmake/v10/dist/index.js:4164:23)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/runner/work/_actions/lukka/run-cmake/v10/dist/index.js:4007:58)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: run-cmake action execution failed: 'Error: "CMake failed with error code: '1'.'

(I should note the windows build was successfull)

JackBoosY commented 2 years ago

That means VCPKG_OSX_DEPLOYMENT_TARGET is not defined or empty.

Adela0814 commented 2 years ago

@FranciscoPombal #21486 fixed this issue, please get the latest version and try again.