简体   繁体   中英

Homebrew R build missing Cairo

I installed R on an OSX 10.7.5 server using brew:

brew install R

Everything seems so OK far, however Cairo is not working:

> svg(tempfile())
Warning messages:
1: In svg(tempfile()) :
  unable to load shared object '/usr/local/Cellar/r/2.15.2/R.framework/Resources/library/grDevices/libs//cairo.so':
  dlopen(/usr/local/Cellar/r/2.15.2/R.framework/Resources/library/grDevices/libs//cairo.so, 6): image not found
2: In svg(tempfile()) : failed to load cairo DLL

The shared object file seems to be missing completely:

id-86-243:Resources jeroen$ ls -ltr library/grDevices/libs/
total 488
-rwxrwxr-x  1 jeroen  admin  245764 Dec 22 17:03 grDevices.so

I rarely use OSX, so I am not quite sure if this is a bug in this particular distribution of R, or if I have done something wrong when building it?

I just ran into this problem. It seems to be a problem with pkg-config locating cairo during the R configure stage. The workaround seems to be:

export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig

so that R can properly use cairo .

I install R directly from source, rather than with homebrew , but I do use homebrew to keep other libraries up to date. This resolves the problem for me.

For reference, I am running OSX Mavericks.

What finally worked for me was building R explicitly with cairo (brew's default R tap uses --without-cairo and simply editing the tap did not solve the issue for me).

It's all explained in this nice blog post: https://luispuerto.net/blog/2018/05/11/installing-r-with-homebrew-with-all-the-capabilities/

Works like a charm for me with R 4.0.2, cairo 1.16.0_3 under macOS Catalina 10.15.6.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM