! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Cannot compile extension with latest glib (2.62.3)
Status:
RESOLVED: WORKSFORME

Comments

Description Martin Larralde 2019-12-07 13:37:18 CET
Hi!

I've been developing and maintaining an extension for Thunar (https://github.com/althonos/thunar-torrent-property), but I can't get it to compile anymore with the newest glib. 

The code won't compile because of a missing `glib_autoptr_clear_ThunarxPropertyPage` function, which is needed when using the `G_DECLARE_FINAL_TYPE` macro to subclass the `ThunarxPropertyPage` type. From what I've tracked, Thunarx code is missing `G_DEFINE_AUTOPTR_CLEANUP_FUNC(ThunarxPropertyPage, g_object_unref)`.
Comment 1 alexxcons editbugs 2019-12-07 21:02:12 CET
Thanks for reporting !

I have only glibc 2.29 here (debian  bullseye), so I cannot reproduce the bug.

Patches would be very welcome !
Comment 2 Andre Miranda editbugs 2019-12-08 23:03:59 CET
Works for me, Arch Linux with glib 2.62.3.
Are you using clang instead of gcc? Please give more info about your build environment.
Comment 3 Martin Larralde 2019-12-11 09:27:00 CET
(In reply to alexxcons from comment #1)

> Patches would be very welcome !

I managed to get it to work by editing the Thunarx code, i'll add a patch.

(In reply to Andre Miranda from comment #2)

> Are you using clang instead of gcc? Please give more info about your build
> environment.

I'm building with GCC 9.2.0, GLib 2.62.3, Gtk+ 3.24.13.

> Works for me, Arch Linux with glib 2.62.3.

When compiling the extension I wrote (mentioned above), I get the following compilation errors from GCC (not all of them included, only the first error):

```
/home/althonos/Code/thunar-torrent-property/src/torrent-page.h: In function ‘glib_autoptr_clear_TorrentPage’:
/usr/include/glib-2.0/glib/gmacros.h:1028:49: error: ‘glib_autoptr_clear_ThunarxPropertyPage’ undeclared (first use in this function); did you mean ‘glib_autoptr_clear_TorrentPage’?
 1028 | #define _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) glib_autoptr_clear_##TypeName
      |                                                 ^~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gmacros.h:1045:18: note: in definition of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’
 1045 |     { if (_ptr) (cleanup) ((ParentName *) _ptr); }                                                              \
      |                  ^~~~~~~
/usr/include/glib-2.0/glib/gmacros.h:1056:65: note: in expansion of macro ‘_GLIB_AUTOPTR_CLEAR_FUNC_NAME’
 1056 |   _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(ModuleObjName, ParentName, _GLIB_AUTOPTR_CLEAR_FUNC_NAME(ParentName))
      |                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/gobject/gtype.h:1408:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CHAINUP’
 1408 |   _GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, ParentName)                                               \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/althonos/Code/thunar-torrent-property/src/torrent-page.h:11:1: note: in expansion of macro ‘G_DECLARE_FINAL_TYPE’
   11 | G_DECLARE_FINAL_TYPE(TorrentPage, torrent_page, TORRENT, PAGE, ThunarxPropertyPage);
      | ^~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gmacros.h:1028:49: note: each undeclared identifier is reported only once for each function it appears in
 1028 | #define _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) glib_autoptr_clear_##TypeName
      |                                                 ^~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gmacros.h:1045:18: note: in definition of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’
 1045 |     { if (_ptr) (cleanup) ((ParentName *) _ptr); }                                                              \
      |                  ^~~~~~~
/usr/include/glib-2.0/glib/gmacros.h:1056:65: note: in expansion of macro ‘_GLIB_AUTOPTR_CLEAR_FUNC_NAME’
 1056 |   _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(ModuleObjName, ParentName, _GLIB_AUTOPTR_CLEAR_FUNC_NAME(ParentName))
      |                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/gobject/gtype.h:1408:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CHAINUP’
 1408 |   _GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, ParentName)                                               \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/althonos/Code/thunar-torrent-property/src/torrent-page.h:11:1: note: in expansion of macro ‘G_DECLARE_FINAL_TYPE’
   11 | G_DECLARE_FINAL_TYPE(TorrentPage, torrent_page, TORRENT, PAGE, ThunarxPropertyPage);
```
Comment 4 Martin Larralde 2019-12-11 10:42:40 CET
Created attachment 9304 
Patch to add autoptr cleanup support.
Comment 5 Martin Larralde 2019-12-11 11:03:58 CET
Comment on attachment 9304 
Patch to add autoptr cleanup support.

This patch adds a declaration of autoptr cleanup for every class defined in the thunarx library using the `G_DEFINE_AUTOPTR_CLEANUP_FUNC`. This allows the `G_DECLARE_FINAL_TYPE` macro to be used with Thunarx classes as parents.
Comment 6 alexxcons editbugs 2019-12-15 23:43:34 CET
Created attachment 9312 
patch

Thank you for the patch! Seems to have no negative side effects as far as I can tell.

Ok if I use your name/email from bugzilla for authorship, like attached ? (Best build patches with git format-patch)

The attached patch in addition bumps the glib dependency (and some minor styling fixes) .. fine like that ?

G_DEFINE_AUTOPTR_CLEANUP_FUNC() is only defined in glib 2.44.
The thunar 4.14 branch lists glib 2.42 as dependency. Should be fine to push as well for the stable branch .. even debian stretch already ships glib 2.50.3
Comment 7 alexxcons editbugs 2019-12-15 23:58:01 CET
Eh, just noticed that I have glib 2.62.3. (and that I checked the glibc version before, not the glib version :P )

So my setup: glib 2.62.3, GCC 9.2.1, 3.24.12
Just cloned and build "thunar-torrent-property" ... build runs fine here without the patch.
Maybe you are using some special flags for compile ?
Comment 8 alexxcons editbugs 2020-05-11 00:50:21 CEST
Still a problem for you to build  without the patch ?
Can you try on some other environment, since I guess the environment is to blame.
Builds fine for me and Andreldm without the patch.
Comment 9 alexxcons editbugs 2020-05-25 23:41:46 CEST
Closed, since build runs fine for me and AndreLDM, and no further reply from reporter.

Bug #16257

Reported by:
Martin Larralde
Reported on: 2019-12-07
Last modified on: 2020-05-25

People

Assignee:
alexxcons
CC List:
2 users

Version

Attachments

Patch to add autoptr cleanup support. (8.65 KB, patch)
2019-12-11 10:42 CET , Martin Larralde
no flags
patch (10.06 KB, patch)
2019-12-15 23:43 CET , alexxcons
no flags

Additional information