在 macOS 上通过 vcpkg 安装 Qt

Installing Qt via vcpkg on macOS

尝试在 macOS Monterey 上安装 Qt5 时,我遇到了以下问题:

 % ./vcpkg install qt5                                                     
Computing installation plan...
The following packages will be built and installed:
  * icu[core]:x64-osx -> 69.1#18
  * jasper[core,opengl]:x64-osx -> 2.0.33#3
  * libjpeg-turbo[core]:x64-osx -> 2.1.3#1
  * liblzma[core]:x64-osx -> 5.2.5#5
  * libwebp[core,nearlossless,simd]:x64-osx -> 1.2.1
  * opengl[core]:x64-osx -> 2022-03-14
  * openssl[core]:x64-osx -> 1.1.1n
  * pcre2[core]:x64-osx -> 10.39#2
  * pkgconf[core]:x64-osx -> 1.8.0#2
    qt5[activeqt,core,declarative,essentials,imageformats,multimedia,networkauth,quickcontrols2,svg,tools]:x64-osx -> 5.15.3#1
  * qt5-base[core]:x64-osx -> 5.15.3#2
  * qt5-declarative[core]:x64-osx -> 5.15.3
  * qt5-imageformats[core]:x64-osx -> 5.15.3
  * qt5-multimedia[core]:x64-osx -> 5.15.3
  * qt5-networkauth[core]:x64-osx -> 5.15.3
  * qt5-quickcontrols2[core]:x64-osx -> 5.15.3
  * qt5-svg[core]:x64-osx -> 5.15.3
  * qt5-tools[core]:x64-osx -> 5.15.3
  * sqlite3[core]:x64-osx -> 3.37.2#1
  * tiff[core,jpeg,lzma,zip]:x64-osx -> 4.3.0#6
  * vcpkg-pkgconfig-get-modules[core]:x64-osx -> 2022-02-10
  * zstd[core]:x64-osx -> 1.5.2#1
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-osx...
Restored 0 packages from /Users/user/.cache/vcpkg/archives in 93.27 us. Use --debug to see more details.
Starting package 1/22: icu:x64-osx
Building package icu[core]:x64-osx...
-- Using cached icu4c-69_1-src.tgz.
-- Cleaning sources at /Users/user/vcpkg/buildtrees/icu/src/c-69_1-src-b48be0c7ce.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source /Users/user/vcpkg/downloads/icu4c-69_1-src.tgz
-- Applying patch disable-escapestr-tool.patch
-- Applying patch remove-MD-from-configure.patch
-- Applying patch fix_parallel_build_on_windows.patch
-- Applying patch fix-extra.patch
-- Applying patch mingw-dll-install.patch
-- Applying patch disable-static-prefix.patch
-- Applying patch fix-win-build.patch
-- Using source at /Users/user/vcpkg/buildtrees/icu/src/c-69_1-src-b48be0c7ce.clean
-- Getting CMake variables for x64-osx-dbg
-- Getting CMake variables for x64-osx-rel
-- Generating configure for x64-osx
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:128 (message):
    Command failed: /usr/local/bin/autoreconf -vfi
    Working Directory: /Users/user/vcpkg/buildtrees/icu/src/c-69_1-src-b48be0c7ce.clean/source
    Error code: 2
    See logs for more information:
      /Users/user/vcpkg/buildtrees/icu/autoconf-x64-osx-err.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_configure_make.cmake:629 (vcpkg_execute_required_process)
  ports/icu/portfile.cmake:51 (vcpkg_configure_make)
  scripts/ports.cmake:145 (include)


Error: Building package icu:x64-osx failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `git pull` and `./vcpkg update`.
Then check for known issues at:
  https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+icu
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?template=report-package-build-failure.md&title=[icu]+Build+error
including:
  package: icu[core]:x64-osx -> 69.1#18
    vcpkg-tool version: 2022-03-09-1affd32f93b299d5a907816c328ca3ededb73a7e
    vcpkg-scripts version: 6b6a35335 2022-03-21 (5 hours ago)

Additionally, attach any relevant sections from the log files above.
user@users-MBP vcpkg % which make
/usr/bin/make
user@users-MBP vcpkg % ./vcpkg install libtool
Computing installation plan...
Error: while loading libtool:
The port directory (/Users/user/vcpkg/ports/libtool) does not exist
Error: failed to load port from /Users/user/vcpkg/ports/libtool
note: updating vcpkg by rerunning bootstrap-vcpkg may resolve this failure.
user@users-MBP vcpkg % ./bootstrap-vcpkg.sh 
Downloading vcpkg-macos...
Telemetry
---------
vcpkg collects usage data in order to help us improve your experience.
The data collected by Microsoft is anonymous.
You can opt-out of telemetry by re-running the bootstrap-vcpkg script with -disableMetrics,
passing --disable-metrics to vcpkg on the command line,
or by setting the VCPKG_DISABLE_METRICS environment variable.

Read more about vcpkg telemetry at docs/about/privacy.md
user@users-MBP vcpkg % 

在 /Users/user/vcpkg/buildtrees/icu/autoconf-x64-osx-err.log 上我看到:

autoreconf: export WARNINGS=
autoreconf: Entering directory '.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force
Can't exec "aclocal": No such file or directory at /usr/local/Cellar/autoconf/2.71/share/autoconf/Autom4te/FileUtils.pm line 274.
autoreconf: error: aclocal failed with exit status: 2

对如何进行有什么建议吗?

文件: https://github.com/microsoft/vcpkg/blob/master/scripts/azure-pipelines/osx/configuration/vagrant-box-configuration.json

包含系统依赖项列表,您需要先安装这些系统依赖项,然后 vcpkg 才能在 osx 上正常运行。不过你可能可以省略单声道。

Can't exec "aclocal"

aclocalautomake (https://www.gnu.org/software/automake/manual/html_node/aclocal-Invocation.html) 的一部分,所以尝试:

brew install automake