Unsupported protocol while download tar.gz package

后端 未结 7 1040
一整个雨季
一整个雨季 2020-12-30 05:07

I have just upgrade my CMake from version 2.8 to 3.2.

It\'s working like a charm in CMake 2.8 but, after the upgrade, it\'s failing.

I\'m trying to build thi

相关标签:
7条回答
  • 2020-12-30 05:37

    I was having the same problem building a library in a computer in which CMake had not support to https protocol.

    I had to build cmake myself with the option -DCMAKE_USE_OPENSSL=ON as suggested by @dekkard's comment.

    0 讨论(0)
  • 2020-12-30 05:41

    I will often just modify the url from https to http.

    0 讨论(0)
  • 2020-12-30 05:43

    In my ExternalProject_Add(), I have use GIT_REPOSITORY insted of URL option.

    #URL https://github.com/keplerproject/luacov/archive/v0.7.tar.gz
    GIT_REPOSITORY https://github.com/keplerproject/luacov.git
    

    And luacov download and build successfully.

    For any https protocol use DOWNLOAD_COMMAND option of ExternalProject_Add() function.

    DOWNLOAD_COMMAND wget https://github.com/keplerproject/luacov/archive/v0.7.tar.gz
    

    and its working as expected.

    Thanks.

    0 讨论(0)
  • 2020-12-30 05:53

    The problem may be that the CURL library shipped with CMake isn't build with SSL support by default. I had to compile cmake with:

    ./bootstrap --system-curl
    make
    sudo make install
    

    ... and that worked, because my system's curl has SSL support.

    0 讨论(0)
  • 2020-12-30 05:53

    Looks like with Cmake 3.2.1 it works as expected.

    Here's my sample project/CMakeLists.txt:

    PROJECT(TestDownload)
    
    SET(CMAKE_CXX_COMPILER "/path/to/bin/g++")
    SET(CMAKE_C_COMPILER "/path/to/bin/gcc")
    
    SET(CMAKE_CXX_FLAGS "")
    SET(CMAKE_C_FLAGS "")
    
    cmake_minimum_required(VERSION 3.2)
    include(ExternalProject)
    
    ExternalProject_Add(
      luacov
      URL https://github.com/keplerproject/luacov/archive/v0.7.tar.gz
      DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/luacov
      UPDATE_COMMAND ""
      PATCH_COMMAND ""
      INSTALL_COMMAND ""
    )
    

    And the commands:

    $ cd project
    $ mkdir build && cd build
    $ cmake ..
    ...
    $ make all
    Scanning dependencies of target luacov
    [ 12%] Creating directories for 'luacov'
    [ 25%] Performing download step (download, verify and extract) for 'luacov'
    -- downloading...
         src='https://github.com/keplerproject/luacov/archive/v0.7.tar.gz'
         dst='/tmp/project/build/luacov/v0.7.tar.gz'
         timeout='none'
    -- [download 7% complete]
    -- [download 21% complete]
    -- [download 76% complete]
    -- [download 100% complete]
    -- downloading... done
    -- verifying file...
         file='/tmp/project/build/luacov/v0.7.tar.gz'
    -- verifying file... warning: did not verify file - no URL_HASH specified?
    -- extracting...
         src='/tmp/project/build/luacov/v0.7.tar.gz'
         dst='/tmp/project/build/luacov-prefix/src/luacov'
    -- extracting... [tar xfz]
    -- extracting... [analysis]
    -- extracting... [rename]
    -- extracting... [clean up]
    -- extracting... done
    [ 37%] No patch step for 'luacov'
    [ 50%] No update step for 'luacov'
    ...
    
    0 讨论(0)
  • 2020-12-30 05:56

    What it worked for me is the following:

    1. Update openssl

      sudo apt-get install openssl libssl-dev
      
    2. Modify bootstrap file to enable CMAKE_USE_OPENSSL. Replace this line by:

      cmake_options="-DCMAKE_BOOTSTRAP=1 -DCMAKE_USE_OPENSSL=ON"
      
    3. Run bootstrap script normally in cmake folder

      /@path_to_cmake/bootstrap
      
    0 讨论(0)
提交回复
热议问题