我下载了研究生入学考试 (GMAT)并根据说明运行:
$ ./GMAT-R2018a
./GMAT-R2018a: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory
所以我认为缺少了 libpng。因此我从源代码下载、构建并安装了 libpng 1.6.37。
$ ./GMAT-R2018a
./GMAT-R2018a: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory
因此显然我需要 libpng 的 1.2 版本,我从源代码下载、构建和安装该版本:
$ ./GMAT-R2018a
./GMAT-R2018a: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory
显然 GMAT 无法看到该文件,因此我创建了一个符号链接:
$ ln -s /usr/local/lib/libpng12.so.0 libpng12.so.0
$ ./GMAT-R2018a
./GMAT-R2018a: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory
所以我在某处找到一篇帖子说我应该添加一个存储库:
$ sudo add-apt-repository ppa:linuxuprising/libpng12
$ sudo apt update
$ sudo apt install libpng12-0
所以现在当我运行 GMAT 时,出现一个新的错误:
$ ./GMAT-R2018a
./GMAT-R2018a: /usr/local/lib/libpng12.so.0: no version information available (required by /home/steen/GMAT/GMAT/R2018a/bin/../lib/libwx_gtk2u_core-3.0.so.0)
现在我已经没有任何主意了。有人能帮我吗?
答案1
这里的主要问题是 libpng12,它在 16.04 LTS 之后从存储库中删除。
要安装它,请使用特别购电协议:
sudo add-apt-repository ppa:linuxuprising/libpng12
sudo apt update
sudo apt install libpng12-0
然后下载并解压 GMAT:
cd ~/Downloads
wget https://deac-riga.dl.sourceforge.net/project/gmat/GMAT/GMAT-R2018a/gmat-ubuntu-x64-R2018a.tar.gz
tar -xf gmat-ubuntu-x64-R2018a.tar.gz
cd GMAT/R2018a
./GMAT-R2018a
因此您必须使用以下命令删除有问题的库:
sudo rm /usr/local/lib/libpng12.so.0
答案2
这在 22.04 中不起作用
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package libpng12-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'libpng12-dev' has no installation candidate