在 R 上设置 linux 时安装 tidyverse 时出错,我已经尝试了下面的命令,但仍然没有任何效果。
Using PKG_LIBS=-lfreetype -lpng16 -ltiff -lz -ljpeg -lbz2
-----------------------------[ ANTICONF ]-------------------------------
Configuration failed to find one of freetype2 libpng libtiff-4 libjpeg. Try installing:
* deb: libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev (Debian, Ubuntu, etc)
* rpm: freetype-devel libpng-devel libtiff-devel libjpeg-devel (Fedora, CentOS, RHEL)
* csw: libfreetype_dev libpng16_dev libtiff_dev libjpeg_dev (Solaris)
If freetype2 libpng libtiff-4 libjpeg is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a freetype2 libpng libtiff-4 libjpeg.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: ft2build.h: No such file or directory
compilation terminated.
--------------------------------------------------------------------
ERROR: configuration failed for package ‘ragg’
* removing ‘/home/__fr34k/R/x86_64-pc-linux-gnu-library/4.0/ragg’
ERROR: dependency ‘ragg’ is not available for package ‘tidyverse’
* removing ‘/home/__fr34k/R/x86_64-pc-linux-gnu-library/4.0/tidyverse’
The downloaded source packages are in
‘/tmp/RtmpVJh5Ze/downloaded_packages’
Warning messages:
1: In install.packages("tidyverse") :
installation of package ‘xml2’ had non-zero exit status
2: In install.packages("tidyverse") :
installation of package ‘ragg’ had non-zero exit status
3: In install.packages("tidyverse") :
installation of package ‘tidyverse’ had non-zero exit status
即使尝试了下面的命令后,当我尝试重新安装时,我仍然收到上面的错误。
sudo apt install libssl-dev libxml2-dev libfontconfig1-dev libharfbuzz-dev libfribidi-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev
以下解决了我在 Ubuntu 22 上的问题:
sudo apt install libtiff-dev
从这里获取的解决方案https://github.com/r-lib/ragg/issues/86