Failed to install gdtools or svglite

I need to install svglite, but an error occurs: first I need gdtools, 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 anybody help me?

+9
source share
4 answers

I had the same problem and the following solution worked for me:

brew install pkg-config brew install cairo

Then I was able to successfully install gdtoolsand svgliteR.

+4
source

I have a similar problem. See the output below at startup install.packages("gdtools").

* installing *source* package ‘gdtools ...
** package ‘gdtools successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=
Using PKG_LIBS=-L/usr/local/Cellar/cairo/1.16.0/lib -lcairo
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because cairo was not found. Try installing:
 * deb: libcairo2-dev (Debian, Ubuntu)
 * rpm: cairo-devel (Fedora, CentOS, RHEL)
 * csw: libcairo_dev (Solaris)
 * brew: cairo (OSX)
If cairo is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a cairo.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: configuration failed for package ‘gdtools
* removing ‘/usr/local/lib/R/3.5/site-library/gdtools

And here is my conclusion brew config:

HOMEBREW_VERSION: 2.0.4
ORIGIN: https://github.com/Homebrew/brew
HEAD: 0f07fe5c5cdfdf0f424bba7b879faa38aedc8ee4
Last commit: 21 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 07d6a7b951c6992fd8cae3f917510ef81aefef33
Core tap last commit: 2 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.1jkVuIO8bN/org.macosforge.xquartz:0
HOMEBREW_LOGS: /Users/swvanderlaan/Library/Logs/Homebrew
CPU: quad-core 64-bit skylake
Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 10.0 build 1000
Git: 2.21.0 => /usr/local/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 11.0.2
macOS: 10.14.3-x86_64
CLT: 10.1.0.0.1.1539992718
Xcode: 10.1
CLT headers: 10.1.0.0.1.1539992718
XQuartz: 2.7.11 => /opt/X11

It looks like I have XQuartz, Xcode, and CLT installed correctly. If I run, brew info cairoI get this:

cairo: stable 1.16.0 (bottled), HEAD
Vector graphics library with cross-device output support
https://cairographics.org/
/usr/local/Cellar/cairo/1.16.0 (117 files, 5.5MB) *
  Poured from bottle on 2019-03-12 at 10:36:28
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/cairo.rb
==> Dependencies
Build: pkg-config ✔
Required: fontconfig ✔, freetype ✔, glib ✔, libpng ✔, pixman ✔
==> Options
--HEAD
    Install HEAD version
==> Analytics
install: 83,081 (30 days), 202,883 (90 days), 583,774 (365 days)
install_on_request: 5,671 (30 days), 16,812 (90 days), 66,295 (365 days)
build_error: 0 (30 days)

, : gdtools , cairo.

0

cairo pkg-config Homebrew, PKG_CONFIG_PATH .

GitHub devtools devtools :

devtools::install_github('davidgohel/gdtools')

devtools::install_github("r-lib/svglite")

devtools , , , , - .

, GitHub, dtupdate R.

0

@bogenton, cairo pkgconfig .

For others using conda instead of brew:

conda install -c anaconda cairo  
conda install -c anaconda pkgconfig
0
source

All Articles