Installing latest cmake on Ubuntu 18.04.3 LTS run via WSL: OpenSSL error

I ran into the same problem last year. My solution was this:

run the following in your WSL terminal

sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates gnupg software-properties-common wget

After that is finished

wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add -

Next add the updated repository by typing in the following

sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
sudo apt-get update

Finally

sudo apt-get install cmake

And it should be updated to the latest version.

Note: if the above doesn't work, be very careful when trying the below steps. It is not elegant, it is not clean, but it does work.

If this does not work. Go to https://cmake.org/download/ and download the Latest Ubuntu version. If you have a folder where you maintain all your projects I suggest downloading the file into your top most directory where your projects are.

For example all my projects are in a folder called "Github" so I would download the file into my "Github" Folder. If there is not a top level directory create a cmake folder in the C drive or what ever drive you save your projects to.

Next after its finished downloading Extract the file (through winrar/winzip/7zip/ or terminal) into that same directory. Once extracted cd into the folder (cmake-{version number}) and do the following commands.

cmake .
make
make install

This will make the latest version of cmake and then install the required components. It can take a while to have everything build and installed.

Once that is done you are going to want to locate the /bin/ folder inside your cmake folder. Make sure a file called "cmake" is in this folder. Copy the path of this directory and type the following

sudo nano ~/.bash_aliases

You can use vi or vim or whatever text editor you want from within the terminal. At the end of the file type the following

alias cmake="{PATH to /bin/ folder}/cmake"

Make sure if you copied the path from windows explorer you replace \ with / save the file and exit.

Restart your terminal and type

cmake --version

It should show up with whichever version you just downloaded.

Congrats you now have the updated version of cmake.

As per the comment by John, this is version specific, these exact same directions (for the first method at least) are available here for the latest version of CMake.


I tried to install CMAKE in my WSL and I had the similar problem at the bootstrap stage as well, but this error disappeared once I installed the OpenSSL by using the command in the terminal:

sudo apt-get install libssl-dev

It seems to me the most likely reason in your case is that the OpenSSL package hasn't been properly installed. To test if it is that case, perhaps you could have a look at this answer.