Trying to install libssl-dev on ubuntu 14.04.2

$ make
fatal error: openssl/sha.h: No such file or directory
compilation terminated.

$ sudo apt-get install libssl-dev
The following packages have unmet dependencies:
 libssl-dev : Depends: zlib1g-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

$ sudo apt-get install zlib1g-dev
The following packages have unmet dependencies:
 zlib1g-dev : Depends: zlib1g (= 1: but 1:1.2.8.dfsg-1ubuntu1 is to be installed
E: Unable to correct problems, you have held broken packages.

How can I remove the held package and install the correct?

  • When's the last time you ran sudo apt update and/or sudo apt upgrade?
    – DopeGhoti
    Aug 29, 2017 at 20:24
  • Hi, I have done both between each steps.
    – Sam Healey
    Aug 29, 2017 at 20:31

6 Answers 6


First, try entering this: sudo dpkg --configure -a

This will go a long way toward fixing broken dependencies. If that does not suffice, try: sudo apt-get install -f

Then clean and update: sudo apt-get clean && sudo apt-get update

Then upgrade: sudo apt-get upgrade (say 'y' to upgrades)

If you get a message saying some packages are "held back", do this:

sudo apt-get dist-upgrade

Now do these two commands:

sudo apt-get purge zlib1g-dev
sudo apt-get autoremove

Then see what happens when you enter: sudo apt-get install libssl-dev

If it still doesn't work, try this:

sudo aptitude install libssl-dev zliblg-dev=1:1.2.8.dfsg-1ubuntu1

If it still doesn't work, open up Synaptic Package Manager (It should be in your Launcher. If you can't find it, then at the Terminal enter synaptic-pkexec).

Search for zlib1g-dev. If the box next to zlib1g-dev is not green, click on it and select "Mark for installation". If you see more than one version, pick 1:1.2.8.dfsg-1ubuntu1 . Then search for libssl-dev. If the box next to libssl-dev is not green, click on it and select "Mark for installation".

Then select "Apply".

  • Hi, thank you for replying. I did everything above and got the same error as in my original post. When I ran upgrade I got the following message. The following packages have been kept back: linux-generic-lts-utopic linux-headers-generic-lts-utopic linux-image-generic-lts-utopic 0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
    – Sam Healey
    Aug 30, 2017 at 8:13
  • 1
    what gives apt-cache policy zlib1g-dev and grep -P '^[ \t]*[^#[ \t]+' /etc/apt/sources.list /etc/apt/sources.list.d/*.list
    – user192526
    Aug 30, 2017 at 8:32
  • @Bahamut Are you sure you mean "-P" ? For me, I get E: Command line option 'P' [from -P] is not known.
    – gracious1
    Aug 30, 2017 at 23:43
  • 1
    yes I mean -P ` -P, --perl-regexp Interpret the pattern as a Perl-compatible regular expression (PCRE)`
    – user192526
    Aug 31, 2017 at 6:14
  • 2
    @Bahamut Why no sudo with graphical program?
    – gracious1
    Sep 11, 2017 at 0:51

You have to look for all files related with your package and purge them, then reinstall.

sudo dpkg --list
sudo apt-get purge "file-name"

repeat second command with every file and then just reinstall.

  • In the end this works, thanks for this Sir :)
    – falero80s
    Aug 5, 2020 at 1:17
sudo aptitude install lib_name_depending

worked for me when I wanted to install libcurl4-openssl-dev on my Ubuntu 14.04LTS.

Several depending libs were not installed on my machine, and with use of aptitude tool, I manage to interactively install/downgrade necessary libs/package to be able to install libcurl4-openssl-dev.


I had this problem and fixed it as follows: 1) Open Software & Updates utility 2) Go to 'Updates' tab 3) Make sure that all options are selected:

+ Important security updates
+ Recommended updates
+ Unsupported updates

4) sudo apt update && sudo apt upgrade

5) reboot


How I fixed it was by when it said broken packages, there was a package listed on top of it. I ran sudo apt-get install (package name), and then I ran sudo apt-get upgrade, and then it worked!


(Ubuntu 20.04.2 LTS) Using Synaptic Package Manager - Edit - Fix Broken Packages seemed to clear the logjam.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.