10

I am trying to install libpcre3-dev but it gives me the follwing error:

The following packages have unmet dependencies: libpcre3-dev : Depends: libpcre3 (= 2:8.38-3.1) but 2:8.39-1+deb.sury.org~trusty+1 is to be installed E: Unable to correct problems, you have held broken packages.

The 2:8.39-1+deb.sury.org~trusty+1 is from an 'old' ppa (ondrej), so I took a fresh and new Sources.list.

I had the same issue with php7.0-dev and ended up uninstalling php7.0 and installing it from the official repos.

Now when I want to remove libpcre3 it wants to remove nearly all of my packages? Is there another way to "change" the libpcre3 package to the "official" one?

I also tried this, with no luck

2 Answers 2

14

Use

sudo apt-get install libpcre3=2:8.38-3.1 libpcre3-dev=2:8.38-3.1

to force apt-get to install version 2:8.38-3.1 of those packages.

Warning: Only use this this if you are really sure you want to install version 2:8.38-3.1 (the version from the official Ubuntu 16.04 repository) of the packages libpcre3 and libpcre3-dev.

If you are not running Ubuntu 16.04 you should change the version number to the version you actually want to install.

3
  • 3
    This does not work on ubuntu 18.04. It gives Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package 2:8.41-1.1+ubuntu17.10.1+deb.sury.org+3 E: Couldn't find any package by glob '2:8.41-1.1+ubuntu17.10.1+deb.sury.org+3' E: Couldn't find any package by regex '2:8.41-1.1+ubuntu17.10.1+deb.sury.org+3'
    – kashish
    Jul 21, 2018 at 12:13
  • 2
    OMG this just uninstalled my entire PHP distro, including phpmyadmin, mysql, apache and all this other random stuff, and cause my webserver to serve raw code to the browser. Downvoting this answer sorry, can you please provide any links to some relevant knowledge so future punters don't do whatever it is I just did? Ubuntu 18.04LTS btw Feb 28, 2019 at 0:10
  • @AbrahamBrookes: I added a warning. It seems you still have package sources for 16.04 activated on your system. By forcing to install libpcre3 from 16.04 APT removed all packages depending on the 18.04 version of libpcre3. It's usually a good idea to remove old package sources. Mar 1, 2019 at 12:46
0

I had the exact same problem with Ubuntu 22.04.3 and could resolve by simply fixing it with aptitude.

sudo aptitude install libpcre3-dev

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .