wolffd@0: wolffd@0: wolffd@0: Graphviz Build Instructions for Windows wolffd@0: wolffd@0: wolffd@0:

Graphviz Build Instructions for Windows

wolffd@0:

wolffd@0: (Graphviz versions ≥ 2.22) wolffd@0:

wolffd@0: We now build both Visual Studio and MinGW versions of Graphviz. wolffd@0: In addition, the source package comes with project files for Visual Studio, wolffd@0: so building from source should be fairly simple in either case. wolffd@0:

wolffd@0: Let $ROOT be the root directory (folder) wolffd@0: in which you stored the Graphviz source. wolffd@0:

Building with Visual Studio

wolffd@0:
    wolffd@0:
  1. wolffd@0: Copy the file $ROOT/windows/config.h into $ROOT. wolffd@0:
  2. wolffd@0: Copy the folder $ROOT/windows/FEATURE into $ROOT. wolffd@0:
  3. wolffd@0: Start Visual Studio and read in $ROOT/graphviz.sln. wolffd@0: There are project files for all of the parts of Graphviz. wolffd@0:
  4. wolffd@0: Modify the various settings for include file and library directories to find wolffd@0: the third-party software. wolffd@0:
  5. wolffd@0: Modify the settings as to where you want the software installed. wolffd@0:
  6. wolffd@0: Build Graphviz. wolffd@0:
wolffd@0:

Building with MinGW

wolffd@0:
    wolffd@0:
  1. Install MinGW and Msys. This gives a mini GNU-like compile environment wolffd@0:
  2. Set environment variables based on your machine, giving values to the wolffd@0: first six below: wolffd@0: wolffd@0:
    wolffd@0: export INSTALLROOT           # Root install directory
    wolffd@0: export GTKDIR                # Root of GTK tree
    wolffd@0: export FONTCONFIGINCLUDEDIR  # Path of fontconfig include dir
    wolffd@0: export FONTCONFIGLIBDIR      # Path of fontconfig lib dir
    wolffd@0: export FREETYPEINCLUDEDIR    # Path of freetype2 include dir
    wolffd@0: export FREETYPELIBDIR        # Path of freetype2 lib dir
    wolffd@0: 
    wolffd@0: export CFLAGS="-DGVDLL=1"
    wolffd@0: export CPPFLAGS="-I$GTKDIR/include -I$GTKDIR/include/freetype2 "
    wolffd@0: export LDFLAGS="-L$GTKDIR/lib -no-undefined"
    wolffd@0: export FONTCONFIG_CFLAGS=-I$GTKDIR/include/
    wolffd@0: export FONTCONFIG_LIBS="-L$FONTCONFIGLIBDIR -lfontconfig"
    wolffd@0: export FREETYPE2_CFLAGS=-I$FREETYPEINCLUDEDIR
    wolffd@0: export FREETYPE2_LIBS="-L$FREETYPELIBDIR
    wolffd@0: export PKG_CONFIG=$GTKDIR/bin/pkg-config
    wolffd@0: export PKG_CONFIG_PATH=$GTKDIR/lib/pkgconfig
    wolffd@0: 
    wolffd@0: export PANGOFLAGS="--with-fontconfig --with-fontconfiglibdir$FONTCONFIGLIBDIR --with-fontconfigincludedir=$FONTCONFIGINCLUDEDIR --with-pangocairo"
    wolffd@0: 
    wolffd@0: 
    wolffd@0:
    wolffd@0:
  3. Change directory to $ROOT and run configure:
    wolffd@0: wolffd@0:
    wolffd@0: ./configure -C --prefix=$INSTALLROOT --without-gdk-pixbuf --with-mylibgd --disable-swig --without-x  --disable-tcl --without-ipsepcola --with-codegens --enable-shared --disable-static --with-freetype=$GTKDIR/lib --enable-ltdl $PANGOFLAGS --without-gtk --without-gtkgl
    wolffd@0: 
    wolffd@0: 
    wolffd@0:
    wolffd@0: When configure finishes, it lists all of the Graphviz features that have been wolffd@0: enabled. If there are problems, you can check for errors in config.log. wolffd@0: You may have to add or modify wolffd@0: other flags and environment variables for configure to give you the wolffd@0: settings you want. Run configure --help wolffd@0: to see the allowed options and environment variables. wolffd@0:
  4. Run make wolffd@0:
  5. Run make install wolffd@0:
wolffd@0: These builds create a feature-full version of Graphviz. You can tailor wolffd@0: them to your wants. This is fairly simple for MinGW: just remove or reset wolffd@0: the flag of the option you don't want. For Visual Studio, you will probably wolffd@0: need to reset some of the values in config.h and some of the wolffd@0: compile-time options. wolffd@0:
wolffd@0:

wolffd@0: (2.21 >= Graphviz versions > 2.14) wolffd@0:

wolffd@0: To simplify our build process, especially as most Windows users only wolffd@0: want a binary version of the software, the Graphviz build for Windows wolffd@0: now uses uwin, wolffd@0: an open-source Unix layer on top of Windows. In this wolffd@0: environment, we can use essentially the same tools and process wolffd@0: used on Unix. In particular, we do not have to maintain multiple build wolffd@0: files. wolffd@0:

wolffd@0: To build Graphviz: wolffd@0:

    wolffd@0:
  1. wolffd@0: Install the third-party libraries. This is most easily done by installing wolffd@0: a Windows binary verion of GTK 2.0 or later. wolffd@0:
  2. wolffd@0: Download the Graphviz source package:
    Go to wolffd@0: http://www.graphviz.org/Download_source.php wolffd@0: and copy over either the stable release graphviz-VERSION.tar.gz wolffd@0: or the development source package graphviz-working.tar.gz. wolffd@0:
  3. wolffd@0: Unwrap the package:
    wolffd@0: You can use, for example,

    wolffd@0: gunzip < graphviz-working.tar.gz | tar xf -
    wolffd@0: wolffd@0:
    wolffd@0: Let $ROOT be the directory in which you stored the Graphviz source. wolffd@0:
  4. wolffd@0: Configure the package for your system:

    wolffd@0: cd $ROOT
    wolffd@0: configure --disable-shared --enable-static --with-mylibgd --disable-swig --without-x --without-tclsh --with-codegens --disable-ltdl

    wolffd@0: You will probably want to provide additional arguments to wolffd@0: configure to indicate where you have installed GTK, where wolffd@0: you want the results installed (--prefix) and which wolffd@0: additional optional packages you want built. Run configure --help wolffd@0: to see the available set of arguments. wolffd@0:
  5. wolffd@0: Build Graphviz:

    wolffd@0: make install

    wolffd@0:
wolffd@0:

wolffd@0: Presumably, a similar approach would work with Cygwin or MinGW. wolffd@0: The following are some notes by wolffd@0: Steve Roush wolffd@0: describing how he wolffd@0: made a static build of the libraries on MinGW. wolffd@0:

wolffd@0:
  • Install MinGW and Msys. This gives a mini GNU-like compile environment wolffd@0: that produces Windows-compatible results. wolffd@0:
  • You may need to configure and build in Windows "Safe mode". Try wolffd@0: ./configure in normal mode; if it dies with "fork" problems, use Safe mode. wolffd@0:
  • Edit the "configure" file.
    wolffd@0: after this line:
    wolffd@0: DEFS=-DHAVE_CONFIG_H
    wolffd@0: add these lines:
    wolffd@0: wolffd@0:
    wolffd@0:     case "$host_os" in
    wolffd@0:      mingw*)
    wolffd@0:        DEFS="$DEFS -DWIN32 -DMSWIN32"
    wolffd@0:        ;;
    wolffd@0:      esac
    wolffd@0: 
    wolffd@0:
    wolffd@0:
  • run configure:
    wolffd@0: wolffd@0:
    wolffd@0:    ./configure  --enable-static=yes --enable-shared=no 
    wolffd@0: --prefix=/usr/local/ --with-libgd=no --enable-ltdl=no --disable-swig  
    wolffd@0: --disable-sharp --disable-guile --disable-io --disable-java 
    wolffd@0: --disable-lua --disable-ocaml --disable-perl --disable-php 
    wolffd@0: --disable-python --disable-ruby --disable-tcl
    wolffd@0: 
    wolffd@0:
    wolffd@0:
  • edit lib/Makefile
    wolffd@0: replace these lines:
    wolffd@0: wolffd@0:
    wolffd@0:  SUBDIRS = cdt graph agraph gd pathplan agutil sfio vmalloc ast vpsc \
    wolffd@0:      circogen dotgen fdpgen neatogen twopigen common pack gvc \
    wolffd@0:      ingraphs expr
    wolffd@0: 
    wolffd@0:
    wolffd@0: wolffd@0: with these lines:
    wolffd@0: wolffd@0:
    wolffd@0:  SUBDIRS = cdt graph agraph gd pathplan  vpsc \
    wolffd@0:     circogen dotgen fdpgen neatogen twopigen common pack gvc \
    wolffd@0:     ingraphs
    wolffd@0: 
    wolffd@0: make  # builds most of "lib" (see Makefile changes), cmd/dot and 
    wolffd@0: cmd/tools - stops on cmd/gvpr
    wolffd@0: make install
    wolffd@0: 
    wolffd@0:
    wolffd@0:
  • wolffd@0: here is the command line I used to build "simple.c" (dot.demo/simple.c), wolffd@0: after adding a few lines based on wolffd@0: https://mailman.research.att.com/pipermail/graphviz-interest/2006q2/003586.html wolffd@0: wolffd@0: wolffd@0: wolffd@0:
    wolffd@0: X=simple;gcc -v -I'/usr/local/include/graphviz' -I'/usr/local/include' 
    wolffd@0: -o $X -O $X.c  -L/usr/local/lib -L/usr/local/lib/graphviz -lgvc  -lgraph 
    wolffd@0: -lpathplan -lcdt -lgvplugin_core -lgvplugin_dot_layout 
    wolffd@0: -lgvplugin_neao_layout -lgvplugin_gd -lgvplugin_pango -lgvc -lpathplan
    wolffd@0: 
    wolffd@0:
    wolffd@0:

    wolffd@0: If you wolffd@0: desire to build directly using Visual Studio or other non-Unix-based wolffd@0: environment, you will need to derive the necessary information from the wolffd@0: supplied Makefiles. wolffd@0:


    wolffd@0:

    wolffd@0: (2.14 >= Graphviz versions >= 2.3) wolffd@0:

    wolffd@0: We build Graphviz on Windows using the MS Visual C++ 6.0 compiler wolffd@0: only. The simplest way to build the software from source on Windows is as wolffd@0: follows: wolffd@0:

      wolffd@0:
    1. wolffd@0: Download the Windows source package from: wolffd@0: http://www.graphviz.org/Download_windows.php. wolffd@0:
    2. wolffd@0: wolffd@0:
    3. wolffd@0: Unwrap the package:
      wolffd@0: If you have Unix tools available, you can use wolffd@0: wolffd@0: gunzip < graphviz-win.tgz | tar xf -
      wolffd@0: wolffd@0: If not, double click on the file and WinZip should start up and let you wolffd@0: store all of the files into a directory.
      wolffd@0: Let $ROOT be the directory in which you stored the Graphviz source. wolffd@0:
    4. wolffd@0: wolffd@0:
    5. wolffd@0: Add the third-party libraries: wolffd@0: wolffd@0: wolffd@0: wolffd@0: The versions should be at least the ones indicated. wolffd@0: You can download the files from wolffd@0: http://www.graphviz.org/Misc/third-party.zip. wolffd@0: Unzip the package in the $ROOT directory; this will create a subdirectory called wolffd@0: third-party. wolffd@0: Or you can obtain the libraries yourself, and install wolffd@0: them in $ROOT\third-party wolffd@0: Also note that these libraries come with the binary release. wolffd@0:
    6. wolffd@0: wolffd@0:
    7. wolffd@0: Build the software in one of the following ways:
      wolffd@0:
        wolffd@0:
      • Run the script $ROOT\build.bat while in the $ROOT wolffd@0: directory. You'll first want to check wolffd@0: that the vc variable points to your local installation of visual C. wolffd@0: Obviously, this should be run in a DOS command window. wolffd@0:
      • The file $ROOT\ws\graphviz.dsw wolffd@0: is the main workspace for the Graphviz libraries and graph drawing programs. wolffd@0: The file wolffd@0: $ROOT\ws\tools.dsw provides the workspace for the wolffd@0: additional Graphviz tools. Double-clicking on these files will open the wolffd@0: workspaces using the MS Visual Studio, from which you can use the Build wolffd@0: menu item to create the various libraries and programs. wolffd@0: wolffd@0: Note that we have avoided all dependencies (i.e., there are no .dep files) wolffd@0: because we found they tended to include absolute pathnames. wolffd@0: If necessary, follow the order used in build.bat to be safe. wolffd@0:
      • If you have a Unix environment, with a real ksh, run the script wolffd@0: $ROOT\wmake.sh wolffd@0: after setting the PATH, LIB and INCLUDE shell variables to the paths where wolffd@0: the Visual C programs are installed on your machine, and the associated wolffd@0: library and include file directories. wolffd@0:
      wolffd@0:
    wolffd@0:

    Once built, all of the libraries and programs will be found in wolffd@0: either the Release or Debug subdirectory of the corresponding source wolffd@0: directory. If you wish to install wolffd@0: the software somewhere, edit the file $ROOT\install.bat to wolffd@0: set the variable root to be the absolute pathname of the wolffd@0: directory where you want wolffd@0: the software installed, and then run the script $ROOT\install.bat wolffd@0: from the $ROOT directory. wolffd@0:

    wolffd@0: If you want to change source files, you can just do it and rebuild. wolffd@0: If, however, you want to add new files or projects, you will wolffd@0: have to redo the makefiles or scripts. wolffd@0:

    wolffd@0: If you have problems or questions, please contact us at wolffd@0: erg@research.att.com. wolffd@0: wolffd@0: