Search code examples
aixgtk2

IBM AIX 7.1 unable to compile with gtk2-2.24.30-2


I have tried to install GTK2 on my IBM AIX7.1 from AIX Toolbox for Linux Applications. It offers me gtk2-2.24.30-2waixX11 so I have intalled it via rpm -i.

Now I have just simple empty main.c which only includes GTK2.

#include <gtk/gtk.h>

int main (int argc, char *argv[])
{
  return 0;
}

When I try to compile my example, using:

gcc -maix64 main.c `pkg-config --cflags gtk+-2.0`

It returns me an error:

In file included from /usr/include/sys/thread.h:41:0,
             from /usr/include/sys/ptrace.h:28,
             from /usr/include/sys/proc.h:42,
             from /usr/include/sys/pri.h:43,
             from /usr/include/sys/sched.h:38,
             from /usr/include/sched.h:51,
             from /usr/include/pthread.h:63,
             from /home/run/tools/include/glib-2.0/glib/deprecated/gthread.h:128,
             from /home/run/tools/include/glib-2.0/glib.h:108,
             from /home/run/tools/include/glib-2.0/gobject/gbinding.h:28,
             from /home/run/tools/include/glib-2.0/glib-object.h:23,
             from /home/run/tools/include/glib-2.0/gio/gioenums.h:28,
             from /home/run/tools/include/glib-2.0/gio/giotypes.h:28,
             from /home/run/tools/include/glib-2.0/gio/gio.h:26,
             from /home/run/tools/include/gtk-2.0/gdk/gdkapplaunchcontext.h:30,
             from /home/run/tools/include/gtk-2.0/gdk/gdk.h:32,
             from /home/run/tools/include/gtk-2.0/gtk/gtk.h:32,
             from main.c:1:
/home/run/tools/include/gtk-2.0/gtk/gtktypeutils.h:61:24: error: expected ';', ',' or ')' before '.' token
      gpointer      func_data);
                    ^
/home/run/tools/include/gtk-2.0/gtk/gtkwindow.h:443:36: error: expected ';', ',' or ')' before '.' token
       gpointer                 func_data);

It continues with the same error over more header. It seems that gpointer is unknown for GTK headers? I even have tried to add glib include into gtktypeutils.h, typedef void* gpointer definition into the same file or I have chaged gpointer to void*. Bus it returns always the same problem.

Here are my glib and gtk packages:

rpm -qa | grep gtk
gtk2-2.24.30-2waixX11
gtk2-devel-2.24.30-2waixX11

rpm -qa | grep glib
glib2-2.56.1-2
glib2-devel-2.56.1-2

Do you heve some idea? Thanks, Jiri.


Solution

  • In AIX, symbol func_data is also defined in /usr/include/sys/timer.h as t_union.data unless you define symbol _LINUX_SOURCE_COMPAT (I cannot tell what other consequences this definition might have):

    gcc -maix64 main.c -D_LINUX_SOURCE_COMPAT `pkg-config --cflags gtk+-2.0`
    

    Or rather, you could edit the header files in question, something like this:

    perl -pi.bak -e 's/func_data/pfunc_data/g' \
        $(grep -l func_data $(find pathto/gtk/ -name '*.h'))