On Linux, unmet dependencies are very common, which is very disturbing and time-wasting. In this article, I will give the reasons and solutions to this problem.
Reason analysis:
The package that you'd like to install requires A version of another package, but you have installed wrong version B. For example:
libglib2.0-dev : Depends: libglib2.0-0(=2.40.0-2) but 2.40.2-0ubuntu1 is to be installed
This means that libglib2.0-dev requires the version of libglib2.0-0 to be 2.40.0-2 ! But , you have installed libglib2.0-0, whose version is 2.40.2-0ubuntu1 ......
Solution:
Step 1: Go to "software update center", choose the "Main Server";
Step 2: In "update" item , choose the first three : important security updates , recommended updates and pre-release updates;
Step 3: Install the package with correct target version which looks like:
sudo apt-get update
sudo apt-get install libpcre3-dev libpcre3=1:8.31-2ubuntu2.3
Where libpcre3-dev is the package you want to install , and 1:8.31-2ubuntu2.3 is the correct version required by libpcre3-dev.
The package version can be shown via "dpkg -s PACKAGE_NAME"
If the solution above did not solve the problem, try to use " aptitude " package manager because it is smarter than " apt-get ".
Any questions , please leave a comment below.