Difference between revisions of "CompilingStatic"

From Inkscape Wiki
Jump to navigation Jump to search
(Adding intro paragraphs)
 
(removed - outdated (and more or less superseded by the AppImage build))
 
(40 intermediate revisions by 5 users not shown)
Line 1: Line 1:
Static compilation of Inkscape is one way to sidestep dependency issues.  Instead of requiring the user to install the particular versions of particular libraries, we just include them in the Inkscape binary.
 
  
Warning Will Robinson, this has a cost:  The inkscape binary gets BIG.  But that's the tradeoff we pay for gaining this convenience.  From a packager's point of view it's also a bit more work, but this page will list out the steps to take achieve it.  Of course, we'll still provide "regular" libs for people who are willing to get the dependencies in order, or who won't like downloading a huge package.
 
 
== Libraries ==
 
 
By static, we mean "all the nasty C++ and other new-fangled stuff".  This is not a TRUE static binary.  We are going to include only the items that we expect people may not have on their systems, and leave the more standard libraries dynamically linked.
 
 
List of libraries to build statically if you're crazy:
 
* glib 2.0+
 
* atk 1.0+
 
* freetype 2.0+
 
* xft 2.1+
 
* libxml 2.0+
 
* pango 1.0+
 
* gtk+ 2.4+ (configure with "./configure --enable-static --without-libtiff --disable-modules --with-included-loaders=xpm,png,bmp,jpeg --prefix=/extra/static", and you'll also have to edit Makefile to drop "demos" and "tests", and modules/Makefile to remove "input" from SUBDIRS)
 
 
List of libraries to build statically for sure:
 
* libgc 6.3+ (since some distros don't have this yet)
 
* libsigc++ 2.0+ (because C++ bindings can be evil)
 
* glibmm 2.4+ (because C++ bindings can be evil)
 
* gtkmm 2.4+ (because C++ bindings can be evil)
 
 
Since you probably don't want to overwrite your existing versions of these libraries, put them somewhere other than /usr or /usr/local or /opt.  For these examples, I'll use /extra/static.  Since glibmm depends on libsigc++, etc, you'll need to export these variables first:
 
  PATH=/extra/static/bin:$PATH
 
  PKG_CONFIG_PATH=/extra/static/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig
 
  CPPFLAGS=-I/extra/static/include
 
  LDFLAGS=-L/extra/static/lib
 
 
Each of the libraries is configured with:
 
  ./configure --disable-shared  --enable-static --prefix=/extra/static
 
 
One note, though.  It seems that the gtkmm stuff will fail on it's own examples, demos, and tests.  Just remove any mentions of those directories from the Makefile, and continue.
 
 
Then "make install" each of them.
 
 
== Inkscape ==
 
 
If you're just building inkscape yourself, you can finally configure and build inkscape:
 
  ./configure ....
 
  make
 
 
If you're building an RPM, you can build it with the existing inkscape.spec file, just do it with the "ink_static_root" defined, like this:
 
  rpmbuild -ba inkscape.spec --define 'ink_static_root /extra/static'
 

Latest revision as of 14:52, 28 May 2019