phpprofilinggraphvizdotxhprof

Getting XHProf visualization (issues with Graphviz and dot) working


I installed XHProf and would like to see call graph visualization. I clicked on View Full Callgraph and got following message first:

failed to execute cmd: " dot -Tpng". stderr: `sh: dot: command not found '

After some googling, I find out, that it's caused by not installed Graphviz. Then I installed it:

$ yum install graphviz

and tried again. Now I'm getting following error messages:

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?

'

Indeed executing of dot -c causes an error:

$ 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

But the files libgvplugin_pango.so.6 and libgvplugin_xlib.so.6 are there and located in /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

Well, as symlinks. But it should not matter. Anyway, I also tested this case:

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

No effect, still the same errors.

What is goning wrong here and how to get this working?

Environment: VirtualBox VM with CentOS 6 as guest system.


Solution

  • I've finally got it working.


    Short answer:

    I guess the yum update or/and perhaps the ann-libs installation might have been the decisive step(-s). But it's just an assumption, therefore I described all the steps, that might be important (s. below).


    Detailed answer:

    First I tried to install graphviz with related packages:

    $ yum install 'graphviz*'
    

    But the installation didn't work:

    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)
    

    Then I tried the same, but added the graphviz-rhel.repo to the repositories before:

    $ cd /etc/yum.repos.d/
    $ wget http://www.graphviz.org/graphviz-rhel.repo
    $ yum list available 'graphviz*'
    $ yum install 'graphviz*'
    

    It failed with another error:

    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)
    

    As expected --skip-broken didn't lead to success as well.

    After that I did multiple things: yum clean all, yum erase 'graphviz*', ann-libs installation, and yum update:

    $ 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
    

    Now it works.