繁体   English   中英

无法使用 cairo 安装 R

[英]Cannot install R with cairo

我正在从源代码安装 R:

cd R-3.2.2
./configure --prefix=$( pwd ) --with-cairo=yes --with-readline=no --with-libpng=yes --with-x=no

我已经从源代码安装了 cairo (v1.14.8) 和 pango (v1.40.6)(安装时都没有任何错误)。 但是 R 没有配置 cairo:

R is now configured for x86_64-pc-linux-gnu

  Source directory:          .
  Installation directory:    /athena/elementolab/scratch/chm2059/from_dat02/chm2059/lib/R-3.2.2

  C compiler:                gcc -std=gnu99  -I/athena/elementolab/scratch/chm2059/from_dat02/chm2059/lib/bzip2-1.0.6/include/packages/include
  Fortran 77 compiler:       gfortran  -g -O2

  C++ compiler:              g++  -g -O2
  C++ 11 compiler:           g++  -std=c++11 -g -O2
  Fortran 90/95 compiler:    gfortran -g -O2
  Obj-C compiler:         

  Interfaces supported:      
  External libraries:        zlib, PCRE, curl
  Additional capabilities:   NLS
  Options enabled:           shared BLAS, R profiling

  Capabilities skipped:      PNG, JPEG, TIFF, cairo, ICU
  Options not enabled:       memory profiling

  Recommended packages:      yes

configure: WARNING: you cannot build info or HTML versions of the R manuals
configure: WARNING: you cannot build PDF versions of the R manuals
configure: WARNING: you cannot build PDF versions of vignettes and help pages

我在配置时看到这些行:

checking for X... disabled
using X11 ... no
checking whether pkg-config knows about cairo and pango... yes
checking whether cairo including pango is >= 1.2 and works... no

有什么想法吗?

我在为什么希腊字母无法在 R 的 (v4) PDF 输出中呈现同样的问题 - 这就是我为 R 4.0.3 修复它的方式:

打开configure脚本,找到这个:

$as_echo_n "checking whether cairo including pango is >= 1.2 and works... " >&6; }
if ${r_cv_cairo_works+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#include <pango/pango.h>
#include <pango/pangocairo.h>
#include <cairo-xlib.h>
#if CAIRO_VERSION  < 10200
#error cairo version >= 1.2 required
#endif
int main(void) {
    cairo_t  *CC = NULL; // silence picky compilers
    cairo_arc(CC, 0.0, 0.0, 1.0, 0.0, 6.28);
    pango_cairo_create_layout(CC);
    pango_font_description_new();
    return 0;
 }

_ACEOF

将此核心代码部分复制到某个test.c文件中:

#include <pango/pango.h>
#include <pango/pangocairo.h>
#include <cairo-xlib.h>
#if CAIRO_VERSION  < 10200
#error cairo version >= 1.2 required
#endif
int main(void) {
    cairo_t  *CC = NULL; // silence picky compilers
    cairo_arc(CC, 0.0, 0.0, 1.0, 0.0, 6.28);
    pango_cairo_create_layout(CC);
    pango_font_description_new();
    return 0;
 }

然后运行cc test.c $(pkg-config --cflags --libs pangocairo) 这可能会为您提供有关configure测试失败原因的更多信息。 也用

cc test.c $(pkg-config --cflags --libs pangocairo) --verbose

cc test.c $(pkg-config --cflags --libs pangocairo) -Wl,--verbose

以获取更多信息。

就我而言,我在安装了一些丢失的软件包后终于得到了这个:

/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: cannot find -lharfbuzz
collect2: error: ld returned 1 exit status

原因是/usr/lib64链接断开: 在此处输入图片说明

一旦修复,一切正常:缺乏root权限,我使用

mkdir ~/lib
cp /usr/lib64/libharfbuzz.so.0 ~/lib/libharfbuzz.so
export LIBRARY_PATH=~/lib

然后, cc test.c $(pkg-config --cflags --libs pangocairo)完成,使用 pango 和 cairo 进行配置也能正常工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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