坚持一元论debug
最近遇到一个极其BT的问题,我原来的目的是要安装R Shiny-server。
在安装了centos之后陆续安装了conda,R,Rstudio-server等科学计算工具和环境,之后重启发现就启动不了图形界面了,但ssh依然能够连接。
在ssh下startx之后报错:
/usr/libexec/gnome-session-binary: symbol lookup error: /usr/lib64/libharfbuzz.so.0: undefined symbol: FT_Done_MM_Var
我想既然能够登录,没有GUI也没关系,于是继续其他安装。知道安装了Shiny-server之后,测试网页报错,回到log一看:
Warning in pngfun(filename = filename, width = width, height = height, res = res, :
无法打开链结到X11显示''
Warning: Error in .External2: 无法打开PNG设备
127: pngfun
126: startPNG
125: drawPlot
111: <reactive:plotObj>
95: drawReactive
82: origRenderFunc
81: output$distPlot
1: runApp
既然无法打开PNG设备的话,我启动R看了看,输入capabilities()看了看,原来jpeg,png,tiff这几个都是false,搜索一下发现可能和我没有编译安装cairo包有关。
于是到R下面想install.packages(“Cario”)的时候,在安装依赖的时候发现有个包叫“systemfonts”安装不上,报错如下:
Error: package or namespace load failed for ‘systemfonts’ in dyn.load(file, DLLpath = DLLpath, ...):
无法载入共享目标对象‘/usr/local/lib64/R/library/00LOCK-systemfonts/00new/systemfonts/libs/systemfonts.so’::
/usr/lib64/libfontconfig.so.1: undefined symbol: FT_Done_MM_Var
错误: 载入失败
停止执行
ERROR: loading failed
* removing ‘/usr/local/lib64/R/library/systemfonts’
这下就糊涂了,到底问题出在哪里?直觉告诉我肯定于FT_Done_MM_Var这个函数有关。
在搜索了很长时间之后,找到一条线索,原因可能是conda安装的时候覆盖了freetype这个包,改变了库链接,所以导致其他库找不到函数了。
于是抱着试一试的态度,先卸载了可能受影响的fontconfig包,然后下载freetype编译,编译后发现少了harfbuzz,又下载下来再次编译,之后make安装,问题解决了。这下startx也能启动了,shiny-server工作也正常了。
conda uninstall fontconfig #可选
yum install harfbuzz-devel
wget https://download.savannah.gnu.org/releases/freetype/freetype-2.10.0.tar.bz2
.configure --prefix=/usr/local/freetype
make && make install
如下图:
从这件事得出一个结论,有时候一个问题可能表现出很多形式,但debug务必需要坚持一元论。
完。