错误:包“ragg”配置失败

rmf*_*rmf 9 r

> install.packages("ragg")\ntrying URL \'https://cloud.r-project.org/src/contrib/ragg_1.1.3.tar.gz\'\nContent type \'application/x-gzip\' length 420401 bytes (410 KB)\n==================================================\ndownloaded 410 KB\n\n\nWelcome at Tue Aug 17 23:24:09 2021\nLibrary path: /home/roy/miniconda3/envs/r-4.1/lib/R/library\n\nRepositories set.\nR_MAX_NUM_DLLS set to 1000.\n* installing *source* package \xe2\x80\x98ragg\xe2\x80\x99 ...\n** package \xe2\x80\x98ragg\xe2\x80\x99 successfully unpacked and MD5 sums checked\n** using staged installation\nFound pkg-config cflags and libs!\nUsing PKG_CFLAGS=-I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/x86_64-linux-gnu\nUsing PKG_LIBS=-lfreetype -lpng16 -lm -lz -lm -lz -ltiff -lwebp -lzstd -llzma -ljbig -ljpeg -lz -lm\n-----------------------------[ ANTICONF ]-------------------------------\nConfiguration failed to find one of freetype2 libpng libtiff-4. Try installing:\n * deb: libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev (Debian, Ubuntu, etc)\n * rpm: freetype-devel libpng-devel libtiff-devel libjpeg-turbo-devel (Fedora, CentOS, RHEL)\n * csw: libfreetype_dev libpng16_dev libtiff_dev libjpeg_dev (Solaris)\nIf freetype2 libpng libtiff-4 is already installed, check that \'pkg-config\' is in your\nPATH and PKG_CONFIG_PATH contains a freetype2 libpng libtiff-4.pc file. If pkg-config\nis unavailable you can set INCLUDE_DIR and LIB_DIR manually via:\nR CMD INSTALL --configure-vars=\'INCLUDE_DIR=... LIB_DIR=...\'\n-------------------------- [ERROR MESSAGE] ---------------------------\nIn file included from /home/roy/miniconda3/envs/r-4.1/x86_64-conda-linux-gnu/sysroot/usr/include/features.h:361,\n                 from /home/roy/miniconda3/envs/r-4.1/x86_64-conda-linux-gnu/sysroot/usr/include/limits.h:27,\n                 from /home/roy/miniconda3/envs/r-4.1/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed/limits.h:194,\n                 from /home/roy/miniconda3/envs/r-4.1/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed/syslimits.h:7,\n                 from /home/roy/miniconda3/envs/r-4.1/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed/limits.h:34,\n                 from /usr/include/libpng16/pngconf.h:31,\n                 from /usr/include/libpng16/png.h:339,\n                 from <stdin>:2:\n/usr/include/x86_64-linux-gnu/sys/cdefs.h:492:49: error: missing binary operator before token "("\n  492 | #if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5)\n      |                                                 ^\nIn file included from /home/roy/miniconda3/envs/r-4.1/x86_64-conda-linux-gnu/sysroot/usr/include/stdio.h:932,\n                 from /usr/include/libpng16/pngconf.h:46,\n                 from /usr/include/libpng16/png.h:339,\n                 from <stdin>:2:\n/usr/include/x86_64-linux-gnu/bits/stdio2.h:228:17: error: missing binary operator before token "("\n  228 | #if __GLIBC_USE (DEPRECATED_GETS)\n      |                 ^\n--------------------------------------------------------------------\nERROR: configuration failed for package \xe2\x80\x98ragg\xe2\x80\x99\n* removing \xe2\x80\x98/home/roy/miniconda3/envs/r-4.1/lib/R/library/ragg\xe2\x80\x99\n\nThe downloaded source packages are in\n    \xe2\x80\x98/tmp/RtmpL1ZZnL/downloaded_packages\xe2\x80\x99\nUpdating HTML index of packages in \'.Library\'\nMaking \'packages.html\' ... done\nWarning message:\nIn install.packages("ragg") :\n  installation of package \xe2\x80\x98ragg\xe2\x80\x99 had non-zero exit status\n\n
Run Code Online (Sandbox Code Playgroud)\n\n\n会话信息\n\n
> install.packages("ragg")\ntrying URL \'https://cloud.r-project.org/src/contrib/ragg_1.1.3.tar.gz\'\nContent type \'application/x-gzip\' length 420401 bytes (410 KB)\n==================================================\ndownloaded 410 KB\n\n\nWelcome at Tue Aug 17 23:24:09 2021\nLibrary path: /home/roy/miniconda3/envs/r-4.1/lib/R/library\n\nRepositories set.\nR_MAX_NUM_DLLS set to 1000.\n* installing *source* package \xe2\x80\x98ragg\xe2\x80\x99 ...\n** package \xe2\x80\x98ragg\xe2\x80\x99 successfully unpacked and MD5 sums checked\n** using staged installation\nFound pkg-config cflags and libs!\nUsing PKG_CFLAGS=-I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/x86_64-linux-gnu\nUsing PKG_LIBS=-lfreetype -lpng16 -lm -lz -lm -lz -ltiff -lwebp -lzstd -llzma -ljbig -ljpeg -lz -lm\n-----------------------------[ ANTICONF ]-------------------------------\nConfiguration failed to find one of freetype2 libpng libtiff-4. Try installing:\n * deb: libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev (Debian, Ubuntu, etc)\n * rpm: freetype-devel libpng-devel libtiff-devel libjpeg-turbo-devel (Fedora, CentOS, RHEL)\n * csw: libfreetype_dev libpng16_dev libtiff_dev libjpeg_dev (Solaris)\nIf freetype2 libpng libtiff-4 is already installed, check that \'pkg-config\' is in your\nPATH and PKG_CONFIG_PATH contains a freetype2 libpng libtiff-4.pc file. If pkg-config\nis unavailable you can set INCLUDE_DIR and LIB_DIR manually via:\nR CMD INSTALL --configure-vars=\'INCLUDE_DIR=... LIB_DIR=...\'\n-------------------------- [ERROR MESSAGE] ---------------------------\nIn file included from /home/roy/miniconda3/envs/r-4.1/x86_64-conda-linux-gnu/sysroot/usr/include/features.h:361,\n                 from /home/roy/miniconda3/envs/r-4.1/x86_64-conda-linux-gnu/sysroot/usr/include/limits.h:27,\n                 from /home/roy/miniconda3/envs/r-4.1/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed/limits.h:194,\n                 from /home/roy/miniconda3/envs/r-4.1/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed/syslimits.h:7,\n                 from /home/roy/miniconda3/envs/r-4.1/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed/limits.h:34,\n                 from /usr/include/libpng16/pngconf.h:31,\n                 from /usr/include/libpng16/png.h:339,\n                 from <stdin>:2:\n/usr/include/x86_64-linux-gnu/sys/cdefs.h:492:49: error: missing binary operator before token "("\n  492 | #if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5)\n      |                                                 ^\nIn file included from /home/roy/miniconda3/envs/r-4.1/x86_64-conda-linux-gnu/sysroot/usr/include/stdio.h:932,\n                 from /usr/include/libpng16/pngconf.h:46,\n                 from /usr/include/libpng16/png.h:339,\n                 from <stdin>:2:\n/usr/include/x86_64-linux-gnu/bits/stdio2.h:228:17: error: missing binary operator before token "("\n  228 | #if __GLIBC_USE (DEPRECATED_GETS)\n      |                 ^\n--------------------------------------------------------------------\nERROR: configuration failed for package \xe2\x80\x98ragg\xe2\x80\x99\n* removing \xe2\x80\x98/home/roy/miniconda3/envs/r-4.1/lib/R/library/ragg\xe2\x80\x99\n\nThe downloaded source packages are in\n    \xe2\x80\x98/tmp/RtmpL1ZZnL/downloaded_packages\xe2\x80\x99\nUpdating HTML index of packages in \'.Library\'\nMaking \'packages.html\' ... done\nWarning message:\nIn install.packages("ragg") :\n  installation of package \xe2\x80\x98ragg\xe2\x80\x99 had non-zero exit status\n\n
Run Code Online (Sandbox Code Playgroud)\n\n

此问题发生在 conda 环境中。安装建议的 Linux 库(见下文,在相同的 conda 环境中运行)。

\n
sudo apt-get install -y libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev            \nReading package lists... Done\nBuilding dependency tree       \nReading state information... Done\nlibjpeg-dev is already the newest version (8c-2ubuntu8).\nlibpng-dev is already the newest version (1.6.37-2).\nlibfreetype6-dev is already the newest version (2.10.1-2ubuntu0.1).\nlibtiff5-dev is already the newest version (4.1.0+git191117-2ubuntu0.20.04.1).\n0 to upgrade, 0 to newly install, 0 to remove and 26 not to upgrade.\n
Run Code Online (Sandbox Code Playgroud)\n

raggconda env 之外的安装工作正常。我的猜测是,从 conda env 安装时,它找不到某些路径。有小费吗?

\n

小智 12

我看到了同样的错误。修复方法是将 pkg-config 安装到 conda 环境中:

conda 安装-c conda-forge pkg-config

不知何故,conda环境下的R c编译器似乎无法正确调用系统pkg-config。


小智 6

看起来像是与这个问题的答案有关的东西。当我尝试在 conda 环境中安装“ragg”包时,我遇到了同样的问题,并且日志中建议的修复(由@BlackBear 答案提到)并不是问题的真正原因,问题的原因如下所示日志:

    -------------------------- [ERROR MESSAGE] ---------------------------
In file included from /home/roy/miniconda3/envs/r-4.1/x86_64-conda-linux-gnu/sysroot/usr/include/features.h:361,
                 from /home/roy/miniconda3/envs/r-4.1/x86_64-conda-linux-gnu/sysroot/usr/include/limits.h:27,
                 from /home/roy/miniconda3/envs/r-4.1/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed/limits.h:194,
                 from /home/roy/miniconda3/envs/r-4.1/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed/syslimits.h:7,
                 from /home/roy/miniconda3/envs/r-4.1/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed/limits.h:34,
                 from /usr/include/libpng16/pngconf.h:31,
                 from /usr/include/libpng16/png.h:339,
                 from <stdin>:2:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:492:49: error: missing binary operator before token "("
  492 | #if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5)
      |                                                 ^
In file included from /home/roy/miniconda3/envs/r-4.1/x86_64-conda-linux-gnu/sysroot/usr/include/stdio.h:932,
                 from /usr/include/libpng16/pngconf.h:46,
                 from /usr/include/libpng16/png.h:339,
                 from <stdin>:2:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:228:17: error: missing binary operator before token "("
  228 | #if __GLIBC_USE (DEPRECATED_GETS)
      |                 ^
--------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)

它可能以某种方式与令人困惑的宏定义有关。我不是 glibc 和其他方面的专家,对我来说,@MrFlick 在对直接通过 conda 安装软件包的问题的评论中的建议有效(mamba install -c conda-forge r-ragg)