Linux build system for Plugins

I have been using way old ubuntu to build the Linux plugins for long long time (so old that I need different Ubuntu to actually run them on since e Xojo does not run on that old) and think its about time to update the build system.

Is there any advice what gcc version and glib and all that we actually should be using nowadays ?

Is there anyone that has any info on the Linux builds ?

I have been trying to make new build machine since the old one almost certainly will not go far into the future with some success, as long as there is no gtk in the plugin.

But when it comes to gtk I always end with linker error on the gtk functions, right now I got it something like:

$(CC) $(CFLAGS) pkg-config --cflags --libs gtk+-2.0 -shared -o Linux\ Build/full\ Xojo/ $(FULLBUILDXOJO)

I can compile GTK hello world application just fine, but when it comes to making it into plugin then I will always just get linker error if made with the new machine.

what is the error?

and why not simply include the libs and headers in the command?

I tried also unwrapping the pkg-config and include the libs and headers like I did on last system (where things work)

I get things like this:

The application cannot continue because a needed file cannot be installed. /home/bjorneiriksson/Desktop/DockingTestLinux/DockingTestLinux Libs/ undefined symbol: gdk_gc_set_rgb_fg_color


I really don’t know what more to try, making Gtk hello world application worked fine

Like this:

#include <gtk/gtk.h>

int main( int argc,
char *argv[] )
GtkWidget *window;

gtk_init (&argc, &argv);

window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_show  (window);

gtk_main ();

return 0;


compiled with this line here:
gcc base.c -o base pkg-config --cflags --libs gtk+-2.0

Old build system which was Ubuntu 6 had it like this:

LIBS = -L$(GTKLIBPREFIX) -L/usr/X11R6/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -rdynamic -lgmodule-2.0 -lglib-2.0 -ldl -lXi -lXext -lX11 -lm

(which still works there)

That one though makes same linker error on Ubuntu 15 as I am struggling with. But works on 15 if I compiled it with Ubuntu 6

Putting it to this:

LIBS = -L$(GTKLIBPREFIX) -L/usr/X11R6/lib $(shell pkg-config --cflags --libs gtk±2.0) $(shell pkg-config --cflags --libs gdk-2.0) -rdynamic -lgmodule-2.0 -lglib-2.0 -ldl -lXi -lXext -lX11 -lm

Gives this output (but still gives the error)

#g++ -s -O2 -D__INTEL__ -D__GCC__ -DWIDGET_GTK=1 -DX_WINDOW=1 -I…/Plugins\ SDK9/Includes -I./ -pthread -I/usr/include/gtk-2.0 -I/usr/lib/i386-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/freetype2 -I/usr/lib/gtk-2.0/include -I/usr/lib/i386-linux-gnu/glib-2.0/include -L -L/usr/X11R6/lib -pthread -I/usr/include/gtk-2.0 -I/usr/lib/i386-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/freetype2 -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -pthread -I/usr/include/gtk-2.0 -I/usr/lib/i386-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -lgdk-x11-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -rdynamic -lgmodule-2.0 -lglib-2.0 -ldl -lXi -lXext -lX11 -lm -shared -o Linux\ Build/demo\ Xojo/ DemoBuild\ Xojo/WindowSplitter.o DemoBuild\ Xojo/DemoProtection.o DemoBuild\ Xojo/gtk2drawing.o DemoBuild\ Xojo/EntryPoints.o DemoBuild\ Xojo/PluginMain.o

Got the thing working finally !

For reference if other plugin makers end up building on new system then what changed was:

What before was:
$(CC) $(CFLAGS) -$(LIBS) -shared -o Linux\ Build/full\ Xojo/ $(FULLBUILDXOJO)

Now needs to be:
$(CC) $(CFLAGS) -shared -o Linux\ Build/full\ Xojo/ $(FULLBUILDXOJO) $(LIBS)

I don’t know why its picky on where the libraries are put suddenly but it makes the problem go away.

ah, I had that before.

The linux linker starts with a list of function it needs.
Than it takes first lib and fills all functions it needs. Now this lib can add new entries to function list which need to filled.
So next lib may fill it.
On the end you get an error for all unfilled functions.

Now if lib A provides a function which lib B needs, you get the error if you link B first in the chain.