Graphviz static build

From genomewiki
Revision as of 18:39, 30 May 2017 by Max (talk | contribs)
Jump to navigationJump to search

Dot is not very static by default.

I first installed + compiled cairo-1.14.8 pango-1.40.5 libpng-1.6.29 fontconfig-2.12.1 harfbuzz-1.4.6 pcre and libgd-2.2.3

  • pcre:
    • configure --prefix=${HOME}/usr --enable-static --enable-utf && make -j40 && make install
  • cairo:
    • configure --prefix=${HOME}/usr --enable-static --without-x --enable-xcb=no --enable-xcb-shm=no --enable-xlib-xcb=no --without-xlib-xrender --without-xlib --enable-xlib-xrender=no --enable-xblib=no --disable-xlib --disable-x 2>&1 | less
  • pango
    • configure --prefix=${HOME}/usr --enable-static --without-xft --enable-static --with-pic CFLAGS=-fPIC CXXFLAGS=-fPIC --disable-shared
  • libgd
    • configure --prefix=${HOME}/usr --enable-static --without-x --without-fontconfig --without-xpm
    • need to add #include <limits.h> to gd_gd2.c, at least when using the 2.2.4 release
  • fontconfig
    • configure --prefix=${HOME}/usr --enable-static --sysconfdir=/etc --localstatedir=/var --disable-docs --with-pic && make -j30 && make install

It is possible that only libgd is really needed to get graphviz to work.

Download and extract graphviz 2.28.0

   configure --prefix=${HOME}/usr --enable-static=yes --enable-ltdl=no --enable-swig=no --enable-tcl=no --enable-x=no --with-expat=no --with-visio=no --with-cgraph=no --with-fontconfig=no --disable-sharp --disable-guile --disable-io --disable-java  --disable-lua --disable-ocaml --disable-perl --disable-php  --disable-python --disable-ruby --disable-tcl --enable-shared=no  --with-gtk=no --with-poppler=no --with-gdk-pixbuf=no --with-fontconfig=no --with-gtkgl=no --with-gtkglext=no --with-ann=no --with-glade=no --with-qt=no -with-x=no

After a graphviz compile, cd cmd/dot and

   rm dot_static
   make CCLD="echo gcc"

Based on the output, I constructed this GCC command:

   gcc -g -O2 -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wall -ffast-math -o dot_static dot_static-dot.o dot_static-dot_builtins.o -L/cluster/home/max/usr/lib ../../plugin/dot_layout/.libs/libgvplugin_dot_layout_C.a ../../plugin/neato_layout/.libs/libgvplugin_neato_layout_C.a ../../plugin/core/.libs/libgvplugin_core_C.a ../../lib/gvc/.libs/libgvc_C.a ../../lib/pathplan/.libs/libpathplan_C.a ../../lib/cgraph/.libs/libcgraph_C.a ../../lib/xdot/.libs/libxdot_C.a ../../lib/cdt/.libs/libcdt_C.a -L/usr/lib64 ../../plugin/gd/.libs/libgvplugin_gd_C.a -L/ /cluster/home/max/usr/lib/libgd.a /cluster/home/max/usr/lib/libjpeg.a ../../plugin/pango/.libs/libgvplugin_pango_C.a /cluster/home/max/usr/lib/libpangocairo-1.0.a /cluster/home/max/usr/lib/libpangoft2-1.0.a /cluster/home/max/usr/lib/libharfbuzz.a /cluster/home/max/usr/lib/libpcre.a /cluster/home/max/usr/lib/libpango-1.0.a /cluster/home/max/usr/lib/libgthread-2.0.a /cluster/home/max/usr/lib/libcairo.a /cluster/home/max/usr/lib/libpixman-1.a /cluster/home/max/usr/lib/libfontconfig.a /cluster/home/max/usr/lib/libexpat.a /cluster/home/max/usr/lib/libfreetype.a -lbz2 -lpng12 /cluster/home/max/usr/lib/libpng16.a -lz -lm /cluster/home/max/usr/lib/libgobject-2.0.a -lffi /cluster/home/max/usr/lib/libglib-2.0.a -lpthread -lrt -pthread -Wl,-rpath -Wl,/cluster/home/max/usr/lib -Wl,-rpath -Wl,/cluster/home/max/usr/lib

Now it's much more static:

       linux-vdso.so.1 =>  (0x00007ffdd2571000)
       libpng12.so.0 => /usr/lib64/libpng12.so.0 (0x0000003ba8200000)
       libz.so.1 => /cluster/software/lib/libz.so.1 (0x00007f1a3c264000)
       libm.so.6 => /lib64/libm.so.6 (0x0000003ba3200000)
       libffi.so.5 => /usr/lib64/libffi.so.5 (0x00007f1a3c05c000)
       libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003ba3600000)
       librt.so.1 => /lib64/librt.so.1 (0x0000003ba4200000)
       libc.so.6 => /lib64/libc.so.6 (0x0000003ba2e00000)
       /lib64/ld-linux-x86-64.so.2 (0x0000003ba2a00000)