Friday, April 8, 2022

[SOLVED] Unable to build openssl-1.0.2n on LinuxMint

Issue

I am trying to update my OpenVPN and OpenSSL. While updating openvpn to openvpn-2.4.4, I was required to update my openssl first to the latest openssl-1.0.2n

$ cd~
$ wget https://openvpn.net/index.php/download/openvpn-2.4.4.tar.gz
$ sudo tar -zvxf openvpn--2.4.4.tar.gz
$ cd openvpn-2.4.4
$ sudo ./configure
$ sudo make
$ sudo make install

But when I reach ./configure above, I run into an issue with legacy openssl as I have mentioned earlier (i thought an update would fix that):

checking tap-windows.h presence... no
checking for tap-windows.h... no
checking whether TUNSETPERSIST is declared... yes
checking for setcon in -lselinux... no
checking for pam_start in -lpam... no
checking for PKCS11_HELPER... no
checking for OPENSSL... no
checking for SSL_CTX_new... no
configure: error: openssl check failed

So I tried the following commands to update to the latest openssl :

$ cd /usr/src
$ wget https://www.openssl.org/source/openssl-1.0.2n.tar.gz -O openssl-1.0.2n.tar.gz
$ tar -zxf openssl-1.0.2n.tar.gz
$ cd openssl-1.0.2n
$ ./config
$ sudo make
$ sudo make test
$ sudo make install
$ mv /usr/bin/openssl /root/
$ ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
$ openssl version

When I get to make test, I run into a compilation error. I have copy pasted my terminal output here because that output is HUGE, error is in the bottom : pastebin

Any suggestions how I can move past this issue?

RELEASE=18 sarah, EDITION=Cinnamon 32-bit, GRUB_TITLE=Linux Mint 18 Cinnamon 32-bit

Solution

Judging from your output, you need to run all three commands as sudo, and you missed the initial make.

elliot@warmachine /usr/src/openssl-1.0.2n $ sudo ./config
...
elliot@warmachine /usr/src/openssl-1.0.2n $ make
...
/bin/sh: 1: cannot create buildinf.h: Permission denied
Makefile:58: recipe for target 'buildinf.h' failed

which fails as it does not have permissions to write to the directory, which causes sudo make test to fail because openssl hasn't been built:

/usr/bin/ld: cannot find -lssl
collect2: error: ld returned 1 exit status

-l{library_name} is what ld uses to link in external libraries, meaning test cannot find the openssl .so that should have been built in previous steps

Lastly, it is bad practice to build software as root. My recommendation is to build it as an unprivileged user, then install as root.

$ cd ~
$ wget https://www.openssl.org/source/openssl-1.0.2n.tar.gz -O openssl-1.0.2n.tar.gz
$ tar -zxf openssl-1.0.2n.tar.gz
$ cd openssl-1.0.2n
$ ./config
$ make
$ make test
$ sudo make install


Answered By - Tincman
Answer Checked By - Mary Flores (WPSolving Volunteer)