Recently I started to see some inconsistency of compile for one particular program using CMake in different environments. While the CMake versions do vary in different environments, the inconsistency is a problem of downloading some files from the internet. At first, I thought it is an internet connecting or port issue, I quickly eliminated this possibility since using
wget to get those files does not have any problems. After doing some Google, I found that building CMake natively using the official installation protocol does not have SSL support. Without SSL support, there will be problems to download files using
https protocol. The problem source is likely to be that the
libcurl library which comes with the CMake installation package for building CMake was not built with SSL support, and this is still not fixed in the latest version 3.14.4.
One way to get around is to install CMake using
apt on Ubuntu. That particular CMake distribution has built-in SSL support. The only problem is that the CMake version (3.10.2) is not the latest, which might not meet the requirement of some of the projects.
Someone suggests to use
curl libraries from the system, which are likely built with SSL support, to build CMake. However, when I tried to use that method to build CMake, I was notified that it cannot find
curl libraries from my system while I do have different kinds of
libcurl.so.* installed. There are also some other more complicated methods posted, but I just don’t want to even try them, since I just have to install a
libcurl.so that the CMake installation program could find and the problem should be fixed.
It turns out that the solution is simple and straightforward.
libcurl4-openssl-dev provides the
curl libraries required for building CMake. This is the simplest complete solution I have seen so far.
$ cd /tmp $ sudo apt-get install libcurl4-openssl-dev $ wget https://github.com/Kitware/CMake/releases/download/v3.14.4/cmake-3.14.4.tar.gz $ tar -xf cmake-3.14.4.tar.gz $ cd cmake-3.14.4 $ ./bootstrap --system-curl --parallel=16 # Use `parallel` argument to accelerate the process $ make -j16 # Use `j` argument to accelerate the process $ sudo make install
Alternatively, installing using the
sh file also seems to work.
$ cd /tmp $ wget https://github.com/Kitware/CMake/releases/download/v3.14.4/cmake-3.14.4-Linux-x86_64.sh $ chmod +x cmake-3.14.4-Linux-x86_64.sh $ sudo ./cmake-3.14.4-Linux-x86_64.sh --prefix=/usr/local --exclude-subdir --skip-license $ rm ./cmake-3.14.4-Linux-x86_64.sh # Optional
I have been enjoying using
apt to manage my software libraries since it is always easy to install, upgrade, and especially uninstall. To uninstall some programs that were not installed via
apt, I need to keep the installations files in case someday in the future I will have to do a
sudo make uninstall, which is not favored. I wish there could be the CMake Ubuntu distribution that could be always up-to-date because CMake is really important.
This SSL support “bug” might be fixed by Kitware in the future release. But it should have been fixed a long time ago since it was an old problem.