[英]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
一旦修復,一切正常:缺乏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.