gcc build error : cannot find -lssl

5,687

Both errors are related to the OpenSSL development libraries not being installed ( -lssl is a pretty dead giveway).

The -lssl can be divided into -l, meaning "link with", and ssl, which is the desired library gcc is asked to link in. Usually, the file to link in is named lib<whatever_comes_after_the_-l>.a and it needs the headers. The file and headers are in the dev (Debian-based) or devel (RPM-based) packages. Here, ssl -> openssl, but you need development packages so it is either openssl-dev or openssl-devel.

So now you can search for the package that contains lib<whatever_comes_after_the_-l>.a. For Debian-based distributions, I install apt-file.

In Debian:

apt-file update
apt-file search libssl.a 

In CentOS:

rpm -q -f libssl.a

In Debian/Ubuntu, to install them do:

sudo apt-get install libssl-dev

In CentOS, to install them do:

sudo yum install openssl-devel
Share:
5,687

Related videos on Youtube

Mheni
Author by

Mheni

Updated on September 18, 2022

Comments

  • Mheni
    Mheni almost 2 years


    Hey all,
    i am trying to build a project called RamCloud on CentOS Linux release 7.4.1708
    this project specifically requires gcc 4.9 and with my centos i only had gcc 4.8 so i had to :

    • completely remove gcc4.8 from my system sudo yum remove --skip-broken gcc
    • install scl sudo yum install centos-release-scl
    • install devtoolset-3 which includes gcc4.9 sudo yum install devtoolset-3
    • enable the devtoolset scl enable devtoolset-3 bash

    that helped with some errors i had before, but now when i try to run sudo make -j12 to build the project, i get errors related to the devtoolset
    this is what the error looks like :

    /opt/rh/devtoolset-3/root/usr/libexec/gcc/x86_64-redhat-linux/4.9.2/ld: cannot find -lssl /opt/rh/devtoolset-3/root/usr/libexec/gcc/x86_64-redhat-linux/4.9.2/ld: cannot find -lcrypto collect2: error: ld returned 1 exit status
    make: [obj.master/apps/client] Error 1
    make: Waiting for unfinished jobs....

    i'm not sure but i think it's a linking problem, any one encountered this before ?