0

it is not 'universe repo' problem, this post was suggested by forum member How do I enable the "Universe" repository?. It is because missing some depends, see the answer below.

How to install libgdal on ubuntu 20.04.2 server? I got the following errors:

$ sudo apt install libgdal-dev

... Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:

The following packages have unmet dependencies: libgdal-dev : Depends: default-libmysqlclient-dev but it is not going to be installed

The following solutions not works for me:

According to @N0rbert 's advice, here are the output of the command:

$ apt-cache policy libgdal-dev libmysqlclient-dev default-libmysqlclient-dev
libgdal-dev:
  Installed: 3.0.4+dfsg-1build3
  Candidate: 3.0.4+dfsg-1build3
  Version table:
 *** 3.0.4+dfsg-1build3 500
        500 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe amd64 Packages
        500 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages
        100 /var/lib/dpkg/status
libmysqlclient-dev:
  Installed: 8.0.25-0ubuntu0.20.04.1
  Candidate: 8.0.25-0ubuntu0.20.04.1
  Version table:
 *** 8.0.25-0ubuntu0.20.04.1 500
        500 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 Packages
        500 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/main amd64 Packages
        100 /var/lib/dpkg/status
     8.0.19-0ubuntu5 500
        500 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 Packages
     5.7.34-1ubuntu18.04 500
        500 http://repo.mysql.com/apt/ubuntu bionic/mysql-5.7 amd64 Packages
default-libmysqlclient-dev:
  Installed: 1.0.5ubuntu2
  Candidate: 1.0.5ubuntu2
  Version table:
 *** 1.0.5ubuntu2 500
        500 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status

Add apt info here

$ grep -r "^deb" /etc/apt/ --include=*.list
/etc/apt/sources.list.d/mysql.list:deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-apt-config
/etc/apt/sources.list.d/mysql.list:deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-5.7
/etc/apt/sources.list.d/mysql.list:deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-tools
/etc/apt/sources.list.d/mysql.list:deb-src http://repo.mysql.com/apt/ubuntu/ bionic mysql-5.7
/etc/apt/sources.list.d/linuxuprising-ubuntu-libpng12-focal.list:deb http://ppa.launchpad.net/linuxuprising/libpng12/ubuntu focal main
/etc/apt/sources.list:deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted
/etc/apt/sources.list:deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted
/etc/apt/sources.list:deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal universe
/etc/apt/sources.list:deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates universe
/etc/apt/sources.list:deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal multiverse
/etc/apt/sources.list:deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates multiverse
/etc/apt/sources.list:deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
/etc/apt/sources.list:deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted
/etc/apt/sources.list:deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security universe
/etc/apt/sources.list:deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security multiverse
/etc/apt/sources.list:deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/
/etc/apt/sources.list:deb http://archive.ubuntu.com/ubuntu focal universe
wm3
  • 1
  • Check your repostories first. This library normally installs on fresh 20.04 LTS VM without any additional special actions - as simple as sudo apt-get update; sudo apt-get install libgdal-dev . Please add the output of apt-cache policy libgdal-dev libmysqlclient-dev default-libmysqlclient-dev to the question. – N0rbert Jul 16 '21 at 06:48
  • @N0rbert Yes, it is a fresh install 20.04.2 LTS VM. The output of policy was added in question. – wm3 Jul 16 '21 at 08:27
  • And to be completely sure please show the full list of your repositories - add output of grep -r "^deb" /etc/apt/ --include=*.list to the question or upload it to pastebin if long. – N0rbert Jul 16 '21 at 08:37
  • @N0rbert both info were appended to the question. – wm3 Jul 16 '21 at 09:43
  • I still can't reproduce the issue on the system with the same repositories. The strange thing is that you have bionic repository of MySQL on the 20.04 LTS (focal) system. But with it, I get successful execution of sudo apt-get install libgdal-dev libmysqlclient-dev default-libmysqlclient-dev. So you probably have local packages, or maybe pinned packages. List them using aptitude search ~o and apt-mark showhold and apt-cache policy | grep -A100 Pin. – N0rbert Jul 16 '21 at 10:00
  • no pinned packages; The old version MySQL (5.7) was required by a web service. use the command sudo apt-get install libgdal-dev libmysqlclient-dev default-libmysqlclient-dev works – wm3 Jul 16 '21 at 10:15

1 Answers1

0

It turns out that this lib is required libmysqlclient-dev for libgdal, and I should install it manually first.

$ sudo apt update
$ sudo apt install libmysqlclient-dev
$ sudo apt install libgdal-dev

Check the installation:

$ gdalinfo --version
GDAL 3.0.4, released 2020/01/28

wm3
  • 1