在自己的cmake选项过程中,cmake无法通过协议HTTPS下载

问题描述 投票:0回答:1

当我适应我的cmake选项

cmake -DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DINSTALL_C_EXAMPLES=OFF \
-DINSTALL_PYTHON_EXAMPLES=OFF \
-DBUILD_EXAMPLES=OFF \
-DOPENCV_EXTRA_MODULES_PATH=/home/luke/cv/last/opencv_contrib/modules  ..

通过HTTPS协议下载一些必要的文件会导致故障(写在警告中)。

CMake Warning at cmake/OpenCVDownload.cmake:190 (message):
  IPPICV: Download failed: 1;"Unsupported protocol"

  For details please refer to the download log file:

  /home/luke/cv/last/oc/opencv/build/CMakeDownloadLog.txt

Here是输入CMake命令的完整输出结果。来自档案的信息:

  CMakeDownloadLog.txt

也显示here。似乎像libcurl不起作用。好的,我安装了curl的最后一个版本以及OpenSSL,我已经制作了./configure --with-ssl命令。当我看到配置的log of libcurl时,我可以在协议枚举上看到HTTPS。那应该得到支持。但是Cmake再次在配置和生成时仍然会因为警告中的下载而失败(如上面的链接所示)。 CMake告诉:在libcurl中不支持或禁用,但libcurl表示(似乎......)支持。啊。我在想它但不知道还有什么不对。

有人知道什么可能是错的,或者你有任何想法/提示吗?

curl https cmake openssl libcurl
1个回答
0
投票

由于您在安装最新的curl和openssl软件包之后仍然看到错误 - 甚至自己构建libcurl - 我怀疑您可能已经使用其引导程序自己构建了cmake。

如果是这种情况,那么值得注意的是,cmake的bootstrap脚本将默认忽略系统包并使用所有cmake依赖项的内部版本。不幸的是,这包括没有ssl支持的libcurl版本。这就是为什么它没有看到您添加到系统中的版本,并且您仍然得到https不支持或禁用的协议错误。

幸运的是,bootstrap脚本是可配置的,你可以告诉它使用各种系统库而不是内部系统库!这是您可以看到可用的引导选项的方法:

cmake-repo> ./bootstrap --help

这将输出如下内容:

Usage: ../bootstrap [<options>...] [-- <cmake-options>...]
Options: [defaults in brackets after descriptions]
Configuration:
  --help                  print this message
  --version               only print version information
  --verbose               display more information
  --parallel=n            bootstrap cmake in parallel, where n is
                          number of nodes [1]
  --enable-ccache         Enable ccache when building cmake
  --init=FILE             load FILE as script to populate cache
  --system-libs           use all system-installed third-party libraries
                          (for use only by package maintainers)
  --no-system-libs        use all cmake-provided third-party libraries
                          (default)
  --system-curl           use system-installed curl library
  --no-system-curl        use cmake-provided curl library (default)
  --system-expat          use system-installed expat library
  --no-system-expat       use cmake-provided expat library (default)
  --system-jsoncpp        use system-installed jsoncpp library
  --no-system-jsoncpp     use cmake-provided jsoncpp library (default)
  --system-zlib           use system-installed zlib library
  --no-system-zlib        use cmake-provided zlib library (default)
  --system-bzip2          use system-installed bzip2 library
  --no-system-bzip2       use cmake-provided bzip2 library (default)
  --system-liblzma        use system-installed liblzma library
  --no-system-liblzma     use cmake-provided liblzma library (default)
  --system-libarchive     use system-installed libarchive library
  --no-system-libarchive  use cmake-provided libarchive library (default)
  --system-librhash       use system-installed librhash library
  --no-system-librhash    use cmake-provided librhash library (default)
  --system-libuv          use system-installed libuv library
  --no-system-libuv       use cmake-provided libuv library (default)

  --qt-gui                build the Qt-based GUI (requires Qt >= 4.2)
  --no-qt-gui             do not build the Qt-based GUI (default)
  --qt-qmake=<qmake>      use <qmake> as the qmake executable to find Qt

  --sphinx-info           build Info manual with Sphinx
  --sphinx-man            build man pages with Sphinx
  --sphinx-html           build html help with Sphinx
  --sphinx-qthelp         build qch help with Sphinx
  --sphinx-build=<sb>     use <sb> as the sphinx-build executable
  --sphinx-flags=<flags>  pass <flags> to sphinx-build executable

Directory and file names:
  --prefix=PREFIX         install files in tree rooted at PREFIX
                          [/usr/local]
  --bindir=DIR            install binaries in PREFIX/DIR
                          [bin]
  --datadir=DIR           install data files in PREFIX/DIR
                          [share/cmake-3.14]
  --docdir=DIR            install documentation files in PREFIX/DIR
                          [doc/cmake-3.14]
  --mandir=DIR            install man pages files in PREFIX/DIR/manN
                          [man]
  --xdgdatadir=DIR        install XDG specific files in PREFIX/DIR
                          [share]

解决这个特殊问题的重要一点是--system-curl选项。

以下是我从源代码构建时的使用方法。 (与cmake docs用法示例不同,我更喜欢构建子文件夹而不是源目录本身。):

cmake-repo> mkdir build && cd build
cmake-repo/build> ../bootstrap --system-curl
cmake-repo/build> make -j<core-count> # use max cores for a fast build
cmake-repo/build> sudo make install

一旦新构建的cmake替换了非ssl版本,你应该能够在从源代码构建opencv时避免那些讨厌的下载错误(这就是你正在做的事情。)

© www.soinside.com 2019 - 2024. All rights reserved.