Use of GTK2 and static linking

hi,

i am quite sure that this is the wrong place to be asking this, but please bear with me as i am a first-time user to the forums.

i am wanting to ask about doing something similar to what the Ardour project has done with GTK2, taking a subset of the original GTK2 source code and turning it into a library that is statically linked into their project. in the case of Ardour they are calling their subset YTK, and all source code (both of Ardour and YTK) is published. the reason for statically linking is that many Linux distros are moving away from GTK2, while adapting Ardour to use GTK3 and/or Qt5 is impractical for the project’s authors.

in my case, i am wanting to do the same with the Lazarus IDE, an IDE for use with FPC (the Free Pascal Compiler). to this end, someone has put together a proof-of-concept that works extremely well - the added overhead of statically linking in Ardour’s YTK is only around 4mb. btw, the reason for doing this in the case of the Lazarus IDE is that currently Lazarus ships pre-configured with GTK2 as the default widget set. people are working on getting GTK3 and Qt5 up and running with it, but this is a major task that is progressing slowly. Statically linking in a subset of GTK2 (ie, YTK) would yield an ELF binary of the Lazarus IDE that talks directly to the X11 layer and is agnostic of installed widget sets - a major bonus for beginner users.

see this discussion on the Lazarus forums:

the tricky part in the case of the Lazarus IDE is that it uses FPC to create ELF binaries (the Lazarus IDE is itself written in Pascal and built using FPC). while the source code of Lazarus is open and freely available, the ELF binaries someone creates using it may end up being distributed without any source code and under a restrictive license. quite simply, the Lazarus IDE and FPC are just tools, and there is no control that can be exerted over what users decide to create with those tools.

my question is: how do the GTK2 developers feel about the Lazarus IDE being a tool that enables folks to create ELF binaries that have portions of the GTK2 source code statically linked into those ELF binaries? my personal view is that there should be no problem with incorporating a subset of GTK2 into Lazarus and that the LGPL is not incompatible with this, but that downstream (people using the Lazarus IDE and FPC to create ELF binaries) things get murky.

any feedback is much appreciated. and if desired, i would be more than happy to discussion offline.

cheers,
rob :slight_smile:

You don’t have to ask how the GTK developers “feel” about static linking: you just need to abide to the LGPL v2.0 licensing terms that GTK is released under.

For any other legal opinion, you will have to ask a lawyer, not a bunch of software developers.

Keep in mind that Ardour dynamically links gtk (ytk). Static linking of those libraries is still problematic for various reasons.

Ardour is also slowly moving away from GTK[mm]. Most of Ardour’s canvas relies on gdk only. The current effort is mainly to allow GNU/Linux distros that have already dropped gtk+2 to continue to ship Ardour; at least until they drop libglibmm-2.4 and sigc++2.0.