Building
External packages
The full build requires external libraries that you must obtain elsewhere.Most, if not all of these are optional, and configure will build graphvizwith reduced functionality if an external library is not found. Newerversions of these libraries should be fine - if not, please let us know.
A list of these external libraries can be found on the Graphvizsourcedownload page.
Notes
- GD (generic raster graphics driver for PNG, GIF, JPEG)
- ZLIB (raster image compression)NB: Use
./configure -s
to build shared libraries. (See notes inzlib-1.2.3/Makefile
)
These libraries (either static or dynamic) and their interface header filesmust already be on your system. It's OK if you install your own copies ofthese packages, though you may need to tell make or configure where to findthem. Runconfigure --help
for details.
On most Linux distributions these packages are already installed orinstallable from packages included in the distribution. You might need toinstall some-devel
packages to get the include header files. Also, some ofthese packages require other packages, so for sanity, you should use someautomated install mechanism such as rpms or macports, or look for completepackages.
Abbreviated Build Instructions
The recommended method for building graphviz from a downloadedsource package is the usual:
./configuremakemake install
If you are building from Git sources, then you must haverecent versions oflibtool
,libltdl-dev
,automake
,autoconf
, andpkg-config
/pkgconf
.Build with:
./autogen.shmakemake install
autogen.sh
accepts the same options as theconfigure
script that it generates for subsequent use.
Detailed Build Instructions
The preferred image renderer is cairo, with support from pango for fonts.This handles various bitmap formats as well as svg, pdf and PostScript.
The generic raster driver isgd
and it can be configured to generate GIF(no compression), PNG (lossless compression), JPEG (lossy compression), andwireless bitmap (WBMP) files. The compressors all needzlib
. In the currentbuild, we use a top-levelconfig.h
file that defines various symbols, suchas:
HAVE_JPEG
HAVE_PNG
This file is typically generated by configure based on how youinvoke it and what it finds on your system.
If you don't enable thegd
based drivers, graphviz will still have theprintf
style drivers for PostScript and SVG. (However, even these benefitfrom better text size estimation via Freetype, when it is available.)
Build tools for Unix
Useconfigure
generated by GNU autoconf.This comes with the source packages.This often works well on a vanilla Linux distribution withTcl/Tk, freetype-devel and libjpeg already installed by rootunder/usr
. It works OK with other versions of Unix, butsome adjusting of command line argumentstoconfigure
may be needed.For Linux you can also just pick up the source tarballor RPMshere.
First, if you are using sources from Git, run./autogen.sh
to generate theconfigure
script. If you are using sourcesfromgraphviz-<version>.tar.gz
thisautogen.sh
step is not needed.
Next, run configure. For help on possible configure options, run:
./configure --help
For example, I use
./configure --prefix=$HOME/arch/sgi.mips3 \--with-freetypeincludedir=$HOME/arch/$ARCH/include/freetype2 \--with-freetypelibdir=$HOME/arch/$ARCH/lib \--with-tcl=/usr/common/tcl8.3.3
Obviously you would change the pathnames to reflect your installation.
Note that the directory${prefix}/include
is automatically searchedfor headers, and${prefix}/lib
for libraries.
If you have problems with one or more of the optional script language bindings,they can be disabled with e.g.--disable-perl
.
When configure is finished, it reports which optional packages werefound and which Graphviz features are enabled. If some package orfeature you expected is not shown as used, you may need to checkthe config.log file or configure.ac or configure files to see whatwent wrong. Usually, any problem can be resolved using environmentvariables or the command-line flags of configure.
Once configure has finished, complete the build with
gmakegmake install
Build tools for win32
See separatebuild notes for Microsoft Windows.
With some persistence you can likely get Graphviz to build onUWIN orCygwin installed on Microsoft Windows. You willstill need various third-party packages to enable all the Graphviz drivers.
Unix platform-specific build notes
Apple Mac OS/X
Currently, Glen Low provides a full-featuredport ofGraphviz.Also, Ryan Schmidt maintains versions of Graphviz for macports.
We recommend using macports to install the desired third-partylibraries. Once these have been installed,the standard build using configure and make works fine. The only caveatis that sometimes, an incompatible, non-GNU tool is picked uprather than the needed GNU version.
Compiling Smyrna for OS X, Snow Leopard (Amanda Stent)
Xcode:
First if you updated from Leopard you have to reinstall developer tools. No getting around it, I tried, you just have to do it.
Macports:
Then you have to uninstall and clean up the Macports ports, all of them. Take the opportunity to reinstall Macports itself. There are migration instructions on the web, but it's a little hairier than they make it out to be because some of the links (e.g. hs-ports) will not be there and you will have to get over those hurdles manually.
Briefly, to do a clean install of macports do:
sudo port -f uninstall installedsudo port clean --work --archive alland then new macportsand then sudo port install the things you need nowand possibly sudo port selfupdate and sudo port upgrade outdated at the end
Then you have to install all the tools needed for Smyrna, glut, glade, etc., and all their dependencies. This takes days.
Now macports doesn't do glut separately. It's sneaky because if you say install glut, something will happen, but actually glut now comes with mesa. This will mess up your head. (The real meat of glut is part of the mesa package - ed.)
Graphviz:
Then you get your graphviz and you configure with--with-smyrna
. I used the following:
configure --with-smyrna --with-glutincludedir=/opt/local/var/macports/software/mesa/7.6.1_1+hw_render/opt/local/include --with-glutlibdir=/opt/local/var/macports/software/mesa/7.6.1_1+hw_render/opt/local/lib --prefix=/usr/local/share/graphviz
I use:
configure --with-smyrna --with-glutincludedir=/opt/local/include --with-glutlibdir=/opt/local/lib
On the webs they say to use -framework commandline option to gcc; however I couldn't figure out how to make this work with the makefile and configure file for graphviz.
Now, I got to a certain point and it grumbled about permissions and refused to go any further. So you may have to chmod in the source directory.
And I got to the point where it was building gv_perl.cpp and it refused to go any further. I got around this eventually by changing the call to XS to XSPROTO, thus obviating the need forXSUB.h
(what does it do for you? nothing!).
And then it said it was done but when I went to run it it wouldn't start due to some missing template.dot so then you make clean, and make install again because by now you are confused as well.
And then it should work!
By the way making by sneakily cd'ing into the macosx folder and using the makefile labeled with your OSdoes not work.
AIX
Matt Fago tells us that--enable-shared=no
is required or theexecutables segfault after seemingly correct compiles. (Bug #421)
Solaris
Put/usr/ccs/bin
in$PATH
HP-UX
The X11 package must include/usr/contrib/X11R6
as well as the base stuff. For some reason GNU autoconf doesn't seem to findX11 in this location so you may need to add the following to the./configure
line:
--with-Xawincludedir=/usr/contrib/X11R6/include --with-Xawlibdir=/usr/contrib/X11R6/lib