Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gtkdialog does not build with gcc-14 #160

Open
peabee opened this issue Apr 16, 2024 · 28 comments
Open

gtkdialog does not build with gcc-14 #160

peabee opened this issue Apr 16, 2024 · 28 comments

Comments

@peabee
Copy link
Contributor

peabee commented Apr 16, 2024

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
Copy link
Contributor

dimkr commented Apr 16, 2024

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
Copy link
Contributor Author

peabee commented Apr 17, 2024

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
Copy link
Contributor

dimkr commented Apr 17, 2024

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
Copy link
Contributor Author

peabee commented Apr 17, 2024

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
Copy link
Contributor

dimkr commented Apr 17, 2024

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

peabee added a commit that referenced this issue Apr 17, 2024
Needed to provide g_vprintf
see #160
@peabee
Copy link
Contributor Author

peabee commented Apr 17, 2024

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

@dimkr
Copy link
Contributor

dimkr commented Apr 17, 2024

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

@step-
Copy link
Collaborator

step- commented Apr 17, 2024

And for a new release generally bump the version number in

AC_INIT([gtkdialog], [0.8.5], [[email protected]], [gtkdialog],
.

@peabee
Copy link
Contributor Author

peabee commented Apr 17, 2024

Made release 0.8.5d

@peabee
Copy link
Contributor Author

peabee commented Apr 18, 2024

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-
Copy link
Collaborator

step- commented Apr 18, 2024

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

@step-
Copy link
Collaborator

step- commented Apr 18, 2024

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
Copy link
Contributor Author

peabee commented Apr 18, 2024

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- added a commit to step-/gtkdialog that referenced this issue Apr 19, 2024
step- added a commit to step-/gtkdialog that referenced this issue Apr 19, 2024
it's inconsistent with other functions in this file

for puppylinux-woof-CE#160
step- added a commit to step-/gtkdialog that referenced this issue Apr 19, 2024
@step-
Copy link
Collaborator

step- commented Apr 19, 2024

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
Copy link
Contributor

dimkr commented Apr 19, 2024

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
Copy link
Contributor Author

peabee commented Apr 20, 2024

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 peabee closed this as completed Apr 20, 2024
@peabee
Copy link
Contributor Author

peabee commented May 9, 2024

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

@peabee
Copy link
Contributor Author

peabee commented May 16, 2024

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

@peabee peabee reopened this May 16, 2024
@dimkr
Copy link
Contributor

dimkr commented May 16, 2024

return FALSE;

#if HAVE_SYS_INOTIFY_H && GTK_CHECK_VERSION(3,0,0)
			return FALSE;
#else
			return;
#endif

@peabee
Copy link
Contributor Author

peabee commented May 17, 2024

Should return; return a value as per #161 ?

@dimkr
Copy link
Contributor

dimkr commented May 17, 2024

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

gtkdialog/src/signals.c

Lines 1139 to 1148 in 6e46ac6

#if HAVE_SYS_INOTIFY_H && GTK_CHECK_VERSION(3,0,0)
gboolean on_any_widget_auto_refresh_event(GIOChannel *channel,
GIOCondition condition, gpointer data)
#elif HAVE_SYS_INOTIFY_H
void on_any_widget_auto_refresh_event(gpointer data, gint source,
GdkInputCondition condition)
#else
void on_any_widget_auto_refresh_event(GFileMonitor *monitor, GFile *file,
GFile *other_file, GFileMonitorEvent event_type, variable *var)
#endif

@peabee
Copy link
Contributor Author

peabee commented May 17, 2024

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
Copy link
Contributor

dimkr commented May 17, 2024

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
Copy link
Contributor Author

peabee commented May 17, 2024

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
Copy link

01micko commented May 18, 2024

@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
Copy link
Contributor Author

peabee commented May 18, 2024

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
Copy link

01micko commented May 18, 2024

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
Copy link
Contributor

dimkr commented May 18, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants