我安装了XHProf并希望看到调用图可视化。我单击查看完整调用图
并首先收到以下消息:
failed to execute cmd: " dot -Tpng". stderr: `sh: dot: command not found '
经过一番谷歌搜索后,我发现这是由于未安装 Graphviz 引起的。然后我安装了它:
$ yum install graphviz
并再次尝试。现在我收到以下错误消息:
failed to execute cmd: " dot -Tpng". stderr: `Error: /usr/lib64/graphviz/config6 is zero sized, or other read error.
Error: /usr/lib64/graphviz/config6 is zero sized, or other read error.
There is no layout engine support for "dot"
Perhaps "dot -c" needs to be run (with installer's privileges) to register the plugins?
'
执行dot -c
确实会导致错误:
$ dot -c
Error: /usr/lib64/graphviz/config6 is zero sized, or other read error.
Warning: Could not load "/usr/lib64/graphviz/libgvplugin_pango.so.6" - file not found
Warning: Could not load "/usr/lib64/graphviz/libgvplugin_xlib.so.6" - file not found
Segmentation fault
但是文件 libgvplugin_pango.so.6
和 libgvplugin_xlib.so.6
存在并且位于 /usr/lib64/graphviz/
:
$ ls -l /usr/lib64/graphviz
total 724
...
lrwxrwxrwx 1 root root 26 May 19 13:58 libgvplugin_pango.so.6 -> libgvplugin_pango.so.6.0.0
-rwxr-xr-x 1 root root 22408 Sep 19 2012 libgvplugin_pango.so.6.0.0
lrwxrwxrwx 1 root root 25 May 19 13:58 libgvplugin_xlib.so.6 -> libgvplugin_xlib.so.6.0.0
-rwxr-xr-x 1 root root 15656 Sep 19 2012 libgvplugin_xlib.so.6.0.0
嗯,作为符号链接(symbolic link)。但这应该不重要。不管怎样,我也测试了这个案例:
mv /usr/lib64/graphviz/libgvplugin_pango.so.6 /usr/lib64/graphviz/libgvplugin_pango.so.6_DEACT
mv /usr/lib64/graphviz/libgvplugin_xlib.so.6 /usr/lib64/graphviz/libgvplugin_xlib.so.6_DEACT
cp /usr/lib64/graphviz/libgvplugin_pango.so.6.0.0 /usr/lib64/graphviz/libgvplugin_pango.so.6
cp /usr/lib64/graphviz/libgvplugin_xlib.so.6.0.0 /usr/lib64/graphviz/libgvplugin_xlib.so.6
没有效果,仍然是同样的错误。
这里出了什么问题以及如何使其正常工作?
环境:以 CentOS 6 作为 guest 系统的 VirtualBox VM。
最佳答案
我终于成功了。
简短回答:
我猜yum更新
或/和ann-libs
安装可能是决定性的脚步)。但这只是一个假设,因此我描述了可能很重要的所有步骤(见下文)。
详细答案:
首先我尝试使用相关软件包安装graphviz
:
$ yum install 'graphviz*'
但是安装失败:
Error: php56w-common conflicts with php-common-5.3.3-46.el6_6.x86_64
You could try using --skip-broken to work around the problem
** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
cairo-1.8.8-3.1.el6.x86_64 has missing requires of libpixman-1.so.0()(64bit)
然后我尝试了相同的操作,但之前将 graphviz-rhel.repo
添加到存储库中:
$ cd /etc/yum.repos.d/
$ wget http://www.graphviz.org/graphviz-rhel.repo
$ yum list available 'graphviz*'
$ yum install 'graphviz*'
由于另一个错误而失败:
Error: Package: graphviz-2.38.0-1.el6.x86_64 (graphviz-stable)
Requires: libANN.so.1()(64bit)
You could try using --skip-broken to work around the problem
** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
cairo-1.8.8-3.1.el6.x86_64 has missing requires of libpixman-1.so.0()(64bit)
正如预期的那样,--skip-broken
也没有成功。
之后我做了多件事:yum clean all
、yum删除'graphviz*'
、ann-libs
安装和百胜更新
:
$ yum clean all
$ yum install 'graphviz*'
$ yum erase 'graphviz*'
$ cd ~/temp/
$ wget http://dl.fedoraproject.org/pub/epel/6/x86_64/ann-libs-1.1.1-4.el6.x86_64.rpm
$ rpm -i ann-libs-1.1.1-4.el6.x86_64.rpm
$ yum update
现在可以了。
关于php - 让 XHProf 可视化(Graphviz 和 dot 的问题)正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30326511/