在 Ubuntu 18.04 上安装 libmagick++-dev 的依赖问题

在 Ubuntu 18.04 上安装 libmagick++-dev 的依赖问题

我正在尝试使用 install splashr,但遇到了一些依赖项问题,似乎什么都不起作用。我知道这与操作系统中的配置错误有关,而不是与包本身的问题有关,但也许你们可以提供一些指导。基本上,当尝试安装 splashr 时,我收到以下日志:

> install.packages("splashr")
Installing package into ‘/home/guilherme/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependency ‘magick’

trying URL 'https://cloud.r-project.org/src/contrib/magick_2.5.0.tar.gz'
Content type 'application/x-gzip' length 4824979 bytes (4.6 MB)
==================================================
downloaded 4.6 MB

trying URL 'https://cloud.r-project.org/src/contrib/splashr_0.6.0.tar.gz'
Content type 'application/x-gzip' length 1099679 bytes (1.0 MB)
==================================================
downloaded 1.0 MB

* installing *source* package ‘magick’ ...
** package ‘magick’ successfully unpacked and MD5 sums checked
Package Magick++ was not found in the pkg-config search path.
Perhaps you should add the directory containing `Magick++.pc'
to the PKG_CONFIG_PATH environment variable
No package 'Magick++' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lMagick++-6.Q16
--------------------------- [ANTICONF] --------------------------------
Configuration failed to find the Magick++ library. Try installing:
 - deb: libmagick++-dev (Debian, Ubuntu)
 - rpm: ImageMagick-c++-devel (Fedora, CentOS, RHEL)
 - csw: imagemagick_dev (Solaris)
 - brew imagemagick@6 (MacOS)
For Ubuntu versions Trusty (14.04) and Xenial (16.04) use our PPA:
   sudo add-apt-repository -y ppa:cran/imagemagick
   sudo apt-get update
   sudo apt-get install -y libmagick++-dev
If Magick++ is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a Magick++.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
-------------------------- [ERROR MESSAGE] ---------------------------
<stdin>:1:10: fatal error: Magick++.h: No such file or directory
compilation terminated.
--------------------------------------------------------------------
ERROR: configuration failed for package ‘magick’
* removing ‘/home/guilherme/R/x86_64-pc-linux-gnu-library/3.4/magick’
Warning in install.packages :
  installation of package ‘magick’ had non-zero exit status
ERROR: dependency ‘magick’ is not available for package ‘splashr’
* removing ‘/home/guilherme/R/x86_64-pc-linux-gnu-library/3.4/splashr’
Warning in install.packages :
  installation of package ‘splashr’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmp8hJktb/downloaded_packages’

它抱怨找不到 Magick++,并导致它所依赖的包 magick 再次安装失败。输出类似:

> install.packages("magick")
Installing package into ‘/home/guilherme/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/magick_2.5.0.tar.gz'
Content type 'application/x-gzip' length 4824979 bytes (4.6 MB)
==================================================
downloaded 4.6 MB

* installing *source* package ‘magick’ ...
** package ‘magick’ successfully unpacked and MD5 sums checked
Package Magick++ was not found in the pkg-config search path.
Perhaps you should add the directory containing `Magick++.pc'
to the PKG_CONFIG_PATH environment variable
No package 'Magick++' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lMagick++-6.Q16
--------------------------- [ANTICONF] --------------------------------
Configuration failed to find the Magick++ library. Try installing:
 - deb: libmagick++-dev (Debian, Ubuntu)
 - rpm: ImageMagick-c++-devel (Fedora, CentOS, RHEL)
 - csw: imagemagick_dev (Solaris)
 - brew imagemagick@6 (MacOS)
For Ubuntu versions Trusty (14.04) and Xenial (16.04) use our PPA:
   sudo add-apt-repository -y ppa:cran/imagemagick
   sudo apt-get update
   sudo apt-get install -y libmagick++-dev
If Magick++ is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a Magick++.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
-------------------------- [ERROR MESSAGE] ---------------------------
<stdin>:1:10: fatal error: Magick++.h: No such file or directory
compilation terminated.
--------------------------------------------------------------------
ERROR: configuration failed for package ‘magick’
* removing ‘/home/guilherme/R/x86_64-pc-linux-gnu-library/3.4/magick’
Warning in install.packages :
  installation of package ‘magick’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmp8hJktb/downloaded_packages’

因此我进入终端来安装缺少的软件包 libmagick++-dev,但是也没有成功,因为它不断询问依赖项的依赖项:

以下软件包具有未满足的依赖项:libmagick++-dev:依赖:libmagick++-6.q16-dev,但不会安装

依赖树继续如下:

libmagick++-dev 
    libmagick++-6.q16-dev 
        libmagickcore-6.q16-dev 
            libmagickwand-6.q16-dev 
                librsvg2-dev 
                    libcairo2-dev 
                        libfontconfig1-dev 
                            libfontconfig1 

我无法安装任何一个,因为出现错误:“...但它不会被安装”

我已经尝试卸载/安装 imagemagick 多次但无济于事。

这些是有关环境变量的一些信息。

$PATH:
/home/guilherme/.local/share/umake/bin:/home/guilherme/bin:/home/guilherme/.local/share/umake/bin:/home/guilherme/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/guilherme/.config/composer/vendor/bin:bin/msys-ssh-1000-18:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/guilherme/.fzf/bin:/home/guilherme/.config/composer/vendor/bin

$PKG_CONFIG_PATH:(空)

lsb_release -a: 
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.5 LTS
Release:        18.04
Codename:       bionic

我完全不知所措。有人能帮我吗?

编辑: 根据 N0rbert 的建议,这是输出apt-cache policy libmagick++-6.q16-dev

libmagick++-6.q16-dev:
  Installed: (none)
  Candidate: 8:6.9.7.4+dfsg-16ubuntu6.8
  Version table:
     8:6.9.7.4+dfsg-16ubuntu6.8 500
        500 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu bionic-security/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
     8:6.9.7.4+dfsg-16ubuntu6 500
        500 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

答案1

我能够使用终端中的以下命令在 Ubuntu 上安装 magick 包:

sudo add-apt-repository -y ppa:cran/imagemagick
sudo apt-get update
sudo apt-get install -y libmagick++-dev

答案2

所需文件Magick++.pc包含在libmagick++-6.q16-dev可从仿生更新和/或仿生安全因此,您必须先通过运行“软件和更新”(software-properties-gtk)或手动编辑来检查您的存储库/etc/apt/sources.list

然后,在全新更新的 18.04 LTS 系统上执行以下命令将导致编译成功:

sudo apt-get install r-base-dev libcurl4-openssl-dev libxml2-dev libssl-dev libmagick++-6.q16-dev

最后在R会议中:

install.packages("splashr")

应该可以成功结束。

答案3

我在维护者的帮助下找到了答案魔法在此仓库中问题。总之,主要问题是libfontconfig1我有 2.3 版本,但要求的版本是 2:

$ sudo apt install libfontconfig1-dev 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
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:
 libfontconfig1-dev : Depends: libfontconfig1 (= 2.12.6-0ubuntu2) but 2.12.6-0ubuntu2.3 is to be installed
E: Unable to correct problems, you have held broken packages.

我只是按照建议强制安装了版本 2杰伦

sudo apt-get install libfontconfig1=2.12.6-0ubuntu2

此后,从底部开始的每个依赖项都顺利安装。

相关内容