Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unsupported protocol while download tar.gz package

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 third party library using ExternalProject_Add() CMake function.

ExternalProject_Add(
  luacov
  URL https://github.com/keplerproject/luacov/archive/v0.7.tar.gz
  DOWNLOAD_DIR ${EXTERNAL_PROJECT_DOWNLOAD_DIR}
  CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${MY_TOOLCHAIN_FILE}
  SOURCE_DIR ${EXTERNAL_PROJECT_SRC_DIR}/luacov
  BINARY_DIR ${EXTERNAL_PROJECT_BUILD_DIR}/luacov
  UPDATE_COMMAND ""
  PATCH_COMMAND ""
)

MY OBSERVATION:

  1. Using GIT_REPOSITORY option, ExternalProject_Add() allow http and https protocol to download external project.
  2. Using URL option, ExternalProject_Add() only allow http, but not https protocol to download external project.

PROBLEM:

Is there any way to download and build external project using https protocol?

ERROR:

[ 16%] Performing download step (download, verify and extract) for 'luacov'
-- downloading...
 src='https://github.com/keplerproject/luacov/archive/v0.7.tar.gz'
 dst='/home/build/my_build/external_projects/downloads/v0.7.tar.gz'
 timeout='none'
CMake Error at /home/build/my_build/luacov-prefix/src/luacov-stamp/download-luacov.cmake:21 (message):
 error: downloading
'https://github.com/keplerproject/luacov/archive/v0.7.tar.gz' failed

status_code: 1
status_string: "Unsupported protocol"
log: Protocol "https" not supported or disabled in libcurl

Closing connection -1

make[3]: *** [luacov-prefix/src/luacov-stamp/luacov-download] Error 1
make[2]: *** [CMakeFiles/luacov.dir/all] Error 2
make[1]: *** [CMakeFiles/luacov.dir/rule] Error 2
make: *** [luacov] Error 2
like image 995
AB Bolim Avatar asked Apr 23 '15 07:04

AB Bolim


3 Answers

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.

like image 165
mlbright Avatar answered Nov 15 '22 08:11

mlbright


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
    
like image 30
Edu Avatar answered Nov 15 '22 07:11

Edu


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.

like image 4
AB Bolim Avatar answered Nov 15 '22 08:11

AB Bolim