I need to install svglite, but an error comes up saying I need gdtools first, so I try to install gdtools and get the following error:
> install.packages("gdtools", lib="/usr/local/lib/R/3.4/site-library")
trying URL 'https://cran.rstudio.com/src/contrib/gdtools_0.1.4.tar.gz'
Content type 'application/x-gzip' length 33931 bytes (33 KB)
==================================================
downloaded 33 KB
* installing *source* package ‘gdtools’ ...
** package ‘gdtools’ successfully unpacked and MD5 sums checked
Using PKG_CFLAGS=-I/usr/local/opt/cairo/include/cairo
Using PKG_LIBS=-L/usr/local/opt/cairo/lib -lcairo
** libs
clang++ -I/usr/local/Cellar/r/3.4.1_1/lib/R/include -DNDEBUG -I/usr/local/opt/cairo/include/cairo -I../inst/include/ -I"/usr/local/lib/R/3.4/site-library/Rcpp/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -fPIC -g -O2 -c CairoContext.cpp -o CairoContext.o
In file included from CairoContext.cpp:7:
/usr/local/opt/cairo/include/cairo/cairo-ft.h:46:10: fatal error: 'ft2build.h' file not found
#include <ft2build.h>
^
1 error generated.
make: *** [CairoContext.o] Error 1
ERROR: compilation failed for package ‘gdtools’
* removing ‘/usr/local/lib/R/3.4/site-library/gdtools’
Warning in install.packages :
installation of package ‘gdtools’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/2c/2dtnf2fs5z7cy45v5gt32n0m0000gn/T/Rtmpj7APMT/downloaded_packages’
Can anyone help me please?
I had this same problem and the following solution worked for me:
brew install pkg-config
brew install cairo
I was then able to successfully install the gdtools
and svglite
R packages.
I had the same problem even with cairo
and pkg-config
installed through Homebrew, and none of the solutions with PKG_CONFIG_PATH worked for me.
But installing GitHub version with devtools
did the trick:
devtools::install_github('davidgohel/gdtools')
devtools::install_github("r-lib/svglite")
There must be a reason for devtools
to correctly find paths and flags and maybe someone could explain it.
Besides, if you want to keep your GitHub versions updated, you can use the dtupdate
R package.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With