puppylinux-woof-CE / gtkdialog

Script friendly gtk GUI builder
GNU General Public License v2.0
30 stars 18 forks source link

gtkdialog does not build with gcc-14 #160

Open peabee opened 5 months ago

peabee commented 5 months ago

Tried building gtkdialog with gcc-14 for NoblePup32 and got:

printing.c: In function 'pip_message_print_debug':
printing.c:53:9: error: implicit declaration of function 'g_vprintf'; did you mean 'g_print'? [-Wimplicit-function-declaration]
   53 |         g_vprintf(format, args);
      |         ^~~~~~~~~
      |         g_print
make[2]: *** [Makefile:549: printing.o] Error 1
make[2]: *** Waiting for unfinished jobs....

builds OK with gcc-12 (and I think gcc-13)

dimkr commented 5 months ago

g_vprintf() is a glib function and it's present in my dpup (Debian testing, glib 2.78). lunar has 2.76, so it should have it too.

peabee commented 5 months ago

This was Noble which has glib 2.80

? printing.c needs:

include <glib/gprintf.h>

? but conditionally?

https://packages.ubuntu.com/hu/noble/i386/libglib2.0-dev/filelist

gprintf.h contains: GLIB_AVAILABLE_IN_ALL gint g_vprintf (gchar const *format, va_list args) G_GNUC_PRINTF(1, 0);

dimkr commented 5 months ago

glib 2.70 (2021?) docs say:

glib/gprintf.h must be explicitly included in order to use this function.

If it's been this way for at least 3 years, it needs to be mandatory and not conditional.

(The Wayback Machine doesn't have older copies of the glib API docs)

peabee commented 5 months ago

Searching for gprintf.h within the gtkdialog code base shows that it is not included anywhere.

It should be added to printing.h I assume?

dimkr commented 5 months ago

I'd do this in printing.c, it's the only file that uses g_vprintf().

peabee commented 5 months ago

Made the update - but although a build was actioned it doesn't seem to have resulted in a new release.....

dimkr commented 5 months ago

build.yml only builds, it doesn't create a tag on success.

step- commented 5 months ago

And for a new release generally bump the version number in https://github.com/puppylinux-woof-CE/gtkdialog/blob/967cc40ed745163a48299c0bb09cda99edb9ec42/configure.ac#L2.

peabee commented 5 months ago

Made release 0.8.5d

peabee commented 4 months ago

Sadly.... still failing to build gtkdialog with gcc-14:

gtkdialog.c: In function 'main':
gtkdialog.c:557:9: warning: 'g_thread_init' is deprecated [-Wdeprecated-declarations]
  557 |         g_thread_init (NULL);
      |         ^~~~~~~~~~~~~
In file included from /usr/include/glib-2.0/glib.h:115:
/usr/include/glib-2.0/glib/deprecated/gthread.h:271:10: note: declared here
  271 | void     g_thread_init                   (gpointer vtable);
      |          ^~~~~~~~~~~~~
gtkdialog.c:631:17: error: implicit declaration of function 'run_program_by_glade' [-Wimplicit-function-declaration]
  631 |                 run_program_by_glade(option_glade_file, option_input_variable);
      |                 ^~~~~~~~~~~~~~~~~~~~
In file included from macros.h:26,
                 from gtkdialog.c:52:
printing.h: At top level:
printing.h:55:1: warning: inline function 'pip_message_print_warning' declared but never defined
   55 | pip_message_print_warning(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~
printing.h:49:1: warning: inline function 'pip_message_print_debug' declared but never defined
   49 | pip_message_print_debug(
      | ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/gtk-2.0/gtk/gtkobject.h:37,
                 from /usr/include/gtk-2.0/gtk/gtkwidget.h:36,
                 from /usr/include/gtk-2.0/gtk/gtkcontainer.h:35,
                 from /usr/include/gtk-2.0/gtk/gtkbin.h:35,
                 from /usr/include/gtk-2.0/gtk/gtkwindow.h:36,
                 from /usr/include/gtk-2.0/gtk/gtkdialog.h:35,
                 from /usr/include/gtk-2.0/gtk/gtkaboutdialog.h:32,
                 from /usr/include/gtk-2.0/gtk/gtk.h:33,
                 from gtkdialog.h:30,
                 from variables.c:23:
/usr/include/gtk-2.0/gtk/gtktypeutils.h:236:1: warning: 'GTypeDebugFlags' is deprecated [-Wdeprecated-declarations]
  236 | void            gtk_type_init   (GTypeDebugFlags    debug_flags);
      | ^~~~
In file included from /usr/include/glib-2.0/gobject/gobject.h:26,
                 from /usr/include/glib-2.0/gobject/gbinding.h:31,
                 from /usr/include/glib-2.0/glib-object.h:24,
                 from /usr/include/glib-2.0/gio/gioenums.h:30,
                 from /usr/include/glib-2.0/gio/giotypes.h:30,
                 from /usr/include/glib-2.0/gio/gio.h:28,
                 from /usr/include/gtk-2.0/gdk/gdkapplaunchcontext.h:30,
                 from /usr/include/gtk-2.0/gdk/gdk.h:32,
                 from /usr/include/gtk-2.0/gtk/gtk.h:32:
/usr/include/glib-2.0/gobject/gtype.h:725:1: note: declared here
  725 | {
      | ^
In file included from /usr/include/gtk-2.0/gtk/gtktoolitem.h:31,
                 from /usr/include/gtk-2.0/gtk/gtktoolbutton.h:30,
                 from /usr/include/gtk-2.0/gtk/gtkmenutoolbutton.h:30,
                 from /usr/include/gtk-2.0/gtk/gtk.h:126:
/usr/include/gtk-2.0/gtk/gtktooltips.h:73:3: warning: 'GTimeVal' is deprecated: Use 'GDateTime' instead [-Wdeprecated-declarations]
   73 |   GTimeVal last_popdown;
      |   ^~~~~~~~
In file included from /usr/include/glib-2.0/glib/galloca.h:34,
                 from /usr/include/glib-2.0/glib.h:32,
                 from /usr/include/glib-2.0/gobject/gbinding.h:30:
/usr/include/glib-2.0/glib/gtypes.h:580:8: note: declared here
  580 | struct _GTimeVal
      |        ^~~~~~~~~
variables.c: In function 'variables_set_value':
variables.c:472:25: error: implicit declaration of function 'yywarning'; did you mean 'g_warning'? [-Wimplicit-function-declaration]
  472 |                         yywarning("Set-value not implemented for this widget.");
      |                         ^~~~~~~~~
      |                         g_warning
variables.c: In function 'do_variables_count_widgets':
variables.c:1122:17: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
 1122 |                 return;
      |                 ^~~~~~
variables.c:1116:13: note: declared here
 1116 | static gint do_variables_count_widgets(variable *actual, gint n)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [Makefile:549: gtkdialog.o] Error 1
make[2]: *** Waiting for unfinished jobs....
step- commented 4 months ago

I think variables.c:1122 should be return n; not return;. The function needs to return an integer value.

step- commented 4 months ago

The other error, "implicit declaration of yywarning" is less clear without more information. Is your build running bison to overwrite the parser.c file? It think the build shouldn't mess with the included parser.[ch] because they were generated a long time ago with an old bison version.

peabee commented 4 months ago

Hi Step - thanks for your interest The petbuild is at: https://github.com/puppylinux-woof-CE/woof-CE/blob/testing/woof-code/rootfs-petbuilds/gtkdialog/petbuild

I'm doing a GTK+2 build so the build instructions are:

        cd gtkdialog-0.8.5d
        ./autogen.sh --prefix=/usr --bindir=/usr/sbin
        make install
        ln -s gtkdialog /usr/sbin/gtk2dialog

No mention of bison....

step- commented 4 months ago

Hi peebee, please see if PR 161 can help. I can't reproduce your exact environment because I only have access to gcc-12.

dimkr commented 4 months ago

I bet the problem is missing or broken bison or flex and/or a gcc/glibc mismatch (let me guess: mix of Ubuntu and Debian packages). The build passes in a clean ubuntu:noble container with all dependencies.

EDIT: nope, undefined functions when forcing use of GCC 14 in noble although it defaults to 13

peabee commented 4 months ago

Closing this issue for the moment. Have incorporated recent changes (thanks both) and re-released version 0.8.5d. Looks like Ubuntu Noble Numbat is shipping with gcc-13 and gcc-14, although available, is "experimental". I will probably stick with gcc-12 for NoblePup32 - Dimkr is probably correct that my "devx" for gcc-13 is probably inconsistent and maybe incomplete.

peabee commented 4 months ago

For reference later: Porting to GCC 14 https://gcc.gnu.org/gcc-14/porting_to.html

peabee commented 4 months ago

Slackware-Current has just moved to GCC-14 As a result, the following petbuilds fail: gtkdialog - https://github.com/puppylinux-woof-CE/woof-CE/tree/testing/woof-code/rootfs-petbuilds/gtkdialog

fail-gtkdialog.txt

dimkr commented 4 months ago

https://github.com/puppylinux-woof-CE/gtkdialog/blob/6e46ac6c9857d952c0ee9f1cbe3f5ac1fc9ffe89/src/signals.c#L1258

#if HAVE_SYS_INOTIFY_H && GTK_CHECK_VERSION(3,0,0)
            return FALSE;
#else
            return;
#endif
peabee commented 4 months ago

Should return; return a value as per #161 ?

dimkr commented 4 months ago

Depends on HAVE_SYS_INOTIFY_H && GTK_CHECK_VERSION(3,0,0) - if true, it should return a boolean, otherwise there's no return value

https://github.com/puppylinux-woof-CE/gtkdialog/blob/6e46ac6c9857d952c0ee9f1cbe3f5ac1fc9ffe89/src/signals.c#L1139-L1148

peabee commented 4 months ago

fail2-gtkdialog.txt

Applied the patch via a temporary cp - @ line 4

Next problem: maybe line 686: gtkdialog.c:361:40: error: passing argument 2 of 'getline' from incompatible pointer type [-Wincompatible-pointer-types]

dimkr commented 4 months ago

Just change it from int to size_t, the types are incorrect

-        int tmp, result;
+        size_t tmp;
+        ssize_t result;
                 from gtkdialog.c:32:
/usr/include/bits/stdio.h:118:36: note: expected 'size_t *' {aka 'long unsigned int *'} but argument is of type 'int *'
peabee commented 4 months ago

Next problems are different for GTK2 and GTK3 builds:

fail3-gtk2-gtkdialog.txt multiple instances of: glade_support.c:65:24: error: passing argument 1 of 'execute_action' from incompatible pointer type [-Wincompatible-pointer-types]

fail3-gtk3-gtkdialog.txt couple of places: ../src/signals.c: In function 'on_any_widget_file_changed_event': /usr/include/glib-2.0/glib/gmacros.h:929:17: error: 'return' with a value, in function returning void [-Wreturn-mismatch]

01micko commented 4 months ago

@peabee

You can just copy/paste the code here instead of having to download: like so

<details>
<summary> some bug </summary> # if using backticks next line must be blank

#3 bacticks go here so code shows up
a big looong bug report
#3 more backticks
</details>

Demo:

something or other ``` The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. ```
peabee commented 3 months ago

OK - going to follow the advice at: https://gcc.gnu.org/gcc-14/porting_to.html

and create a gcc wrapper script /usr/bin/gcc:

#!/bin/sh
exec /usr/bin/gcc-14.1.0 -fpermissive "$@"

This "reverts" GCC-14 to GCC-13 behaviour so fixes the problem for now..... but allows gtkdialog to build with GCC-14

However the stricter error checking in GCC-14 is exposing some coding problems in gtkdialog which probably need to be fixed "properly" for the future.

01micko commented 3 months ago

The code base is ancient . Thunor did what he could and he certainly was a fine programmer, but he's been awol for years. Unfortunately, none of the big distros (apart from pclinuxos - a mandrake fork - and we all know what happened to mandrake) ever picked up on it.

Without a few fine software engineers I'm afraid that gtkdialog is on it's last legs.

dimkr commented 3 months ago

Next problems are different

These functions return bool but only in some build configurations - just make them return; instead of return TRUE; when they're void instead of bool.

Do you read these build logs before you share them here?

error: 'return' with a value, in function returning void