Graphviz static build: Difference between revisions

From genomewiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 3: Line 3:
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
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


The source code is all in ~max/software with log.txt sprinkled around with the commands I used. The result is in ~max/usr/lib.
* libpng:
** curl -LO https://download.sourceforge.net/libpng/libpng-1.6.39.tar.gz
** tar xvzf libpng-1.6.39.tar.gz
** cd libpng-1.6.39
** configure --prefix=${HOME}/usr --enable-static
** make && make install
* bz2:
** change the Makefile and add -fpic to CFLAGS
** make
** make install PREFIX=/cluster/home/max/usr
* pcre:
* pcre:
** configure --prefix=${HOME}/usr --enable-static --enable-utf && make -j40 && make install
** configure --prefix=${HOME}/usr --enable-static --enable-utf && make -j40 && make install
Line 10: Line 22:
** configure --prefix=${HOME}/usr --enable-static  --without-xft --enable-static --with-pic CFLAGS=-fPIC CXXFLAGS=-fPIC --disable-shared
** configure --prefix=${HOME}/usr --enable-static  --without-xft --enable-static --with-pic CFLAGS=-fPIC CXXFLAGS=-fPIC --disable-shared
* libgd
* libgd
** configure --prefix=${HOME}/usr --enable-static --without-x --without-fontconfig --without-xpm
** configure --prefix=${HOME}/usr --enable-static --without-x --without-xpm
** need to add #include <limits.h> to gd_gd2.c, at least when using the 2.2.4 release 
** need to add #include <limits.h> to gd_gd2.c, otherwise it doesn't compile on centos (release: 2.2.4 from early 2017)
* fontconfig
* fontconfig
** configure --prefix=${HOME}/usr --enable-static  --sysconfdir=/etc --localstatedir=/var --disable-docs --with-pic && make -j30 && make install  
** change src/fcxml.c, add "return;" in line 560 at the beginning of the function FcConfigMessage
 
** This shuts up the warnings. The format of font.conf has changed and on newer centos versions this leads to tons of warnings
It is possible that only libgd is really needed to get graphviz to work.
** configure --prefix=${HOME}/usr --enable-static  --sysconfdir=/etc --localstatedir=/var --disable-docs --with-pic && make -j30  
** make install does not work
*** cp src/.libs/libfontconfig.a ~/usr/lib/libfontconfig.a
*** cp src/.libs/libfontconfig.so ~/usr/lib/libfontconfig.so


If you compiled with only libgd then there is antialiasing  for some reason. This is why I added cairo.
Download and extract graphviz 2.28.0
Download and extract graphviz 2.28.0


Line 28: Line 45:
Based on the output, I constructed this GCC command:
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
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 /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 /cluster/home/max/usr/lib/libbz2.a /cluster/home/max/usr/lib/libpng.a /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:
Now it's much more static:

Latest revision as of 14:39, 26 June 2023

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

The source code is all in ~max/software with log.txt sprinkled around with the commands I used. The result is in ~max/usr/lib.

  • libpng:
  • bz2:
    • change the Makefile and add -fpic to CFLAGS
    • make
    • make install PREFIX=/cluster/home/max/usr
  • 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-xpm
    • need to add #include <limits.h> to gd_gd2.c, otherwise it doesn't compile on centos (release: 2.2.4 from early 2017)
  • fontconfig
    • change src/fcxml.c, add "return;" in line 560 at the beginning of the function FcConfigMessage
    • This shuts up the warnings. The format of font.conf has changed and on newer centos versions this leads to tons of warnings
    • configure --prefix=${HOME}/usr --enable-static --sysconfdir=/etc --localstatedir=/var --disable-docs --with-pic && make -j30
    • make install does not work
      • cp src/.libs/libfontconfig.a ~/usr/lib/libfontconfig.a
      • cp src/.libs/libfontconfig.so ~/usr/lib/libfontconfig.so

If you compiled with only libgd then there is antialiasing for some reason. This is why I added cairo.

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 /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 /cluster/home/max/usr/lib/libbz2.a /cluster/home/max/usr/lib/libpng.a /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)