After downloading the 11.20 source, and installing/building dependencies, i've run into a few setbacks.
I modified /Source/Makefile to change references from GTK-2.0 to GTK-3.0.
Afterwards, I run Make, and get the following output, which ends in an error in /Source/base/icon_loader.cpp
I'm not quite sure if there is an error in line 219, or possibly my environment that is causing the error. Any hints would be greatly appreciated, or let me know if I need to provide more info to diagnose.
$make
mkdir -p /tmp/FreeFileSync_x86_64_Make/ffs/src/base/
g++ -std=c++2b -pipe -DWXINTL_NO_GETTEXT_MACRO -I../.. -I../../zenXml -include "zen/i18n.h" -include "zen/warn_static.h" -Wall -Wfatal-errors -Wmissing-include-dirs -Wswitch-enum -Wcast-align -Wnon-virtual-dtor -Wno-unused-function -Wshadow -Wno-maybe-uninitialized -O3 -DNDEBUG `wx-config --cxxflags --debug=no` -pthread `pkg-config --cflags openssl` `pkg-config --cflags libcurl` `pkg-config --cflags libssh2` `pkg-config --cflags gtk+-3.0` -isystem/usr/include/gtk-3.0 `pkg-config --cflags libselinux` -DHAVE_SELINUX -c base/icon_loader.cpp -o /tmp/FreeFileSync_x86_64_Make/ffs/src/base/icon_loader.cpp.o
base/icon_loader.cpp: In function ‘zen::FileIconHolder fff::getFileIcon(const Zstring&, int)’:
base/icon_loader.cpp:219:26: error: expected primary-expression before ‘(’ token
219 | return FileIconHolder(static_cast<GIcon*>(::g_object_ref(gicon)) /*pass ownership*/, maxSize);
| ^
compilation terminated due to -Wfatal-errors.
make: *** [Makefile:123: /tmp/FreeFileSync_x86_64_Make/ffs/src/base/icon_loader.cpp.o] Error 1
Error while building 11.20 on Ubuntu Mate 22.04
- Posts: 1
- Joined: 13 May 2022
- Posts: 306
- Joined: 7 Jan 2018
Summary: Solve libglib2.0 problem in sketchy manner
Date: 2021-09-22
Version: 11.14
Author: bgstack15
Message:
Warning! I have absolutely no idea what I am doing. Check https://freefilesync.org/forum/viewtopic.php?t=8780 for future developments.
In Devuan Ceres, starting in 2021-08 with libglib2.0-0=2.68.3-2 the file icon_loader.cpp fails to compile. By removing the static_cast, this file can compile. The built application throws all sorts of GLib-GObject-CRITICIAL messages but the application operates.
Downgrade to "deb [check-valid-until=no] https://snapshot.debian.org/archive/debian/20210801T144205Z/ unstable main non-free contrib" in /etc/apt/sources.list and install the exact libglib version necessary to compile without this patch.
$ sudo apt-get -V install libglib2.0-0=2.66.8-1 libglib2.0-bin=2.66.8-1 libglib2.0-data=2.66.8-1 libglib2.0-dev=2.66.8-1 libglib2.0-dev-bin=2.66.8-1 libglib2.0-0:i386=2.66.8-1
--- 11.13-0/FreeFileSync/Source/base/icon_loader.cpp 2021-09-22 07:35:40.991208133 -0400
+++ 11.14-0/FreeFileSync/Source/base/icon_loader.cpp 2021-09-22 14:40:10.981215352 -0400
@@ -216,7 +216,7 @@
//the remaining icon types won't block!
assert(GDK_IS_PIXBUF(gicon) || G_IS_THEMED_ICON(gicon) || G_IS_EMBLEMED_ICON(gicon));
- return FileIconHolder(static_cast<GIcon*>(::g_object_ref(gicon)) /*pass ownership*/, maxSize);
+ return FileIconHolder(gicon /*pass ownership*/, maxSize);
}
- Site Admin
- Posts: 7052
- Joined: 9 Dec 2007
I'd be surprised if this doesn't crash.- return FileIconHolder(static_cast<GIcon*>(::g_object_ref(gicon)) /*pass ownership*/, maxSize);
+ return FileIconHolder(gicon /*pass ownership*/, maxSize); bgstack15, 14 May 2022, 19:24
- Posts: 306
- Joined: 7 Jan 2018
It does crash, about 1 in 6 times. Whenever it does crash, I try again and then it usually works. if it ever crashes twice in a row, I'll run it from a terminal and somehow that protects it and then it will never crash.
I bet this is related to that ridiculous gtk3 stuff that was holding up your migration to gtk3 for a while.
I bet this is related to that ridiculous gtk3 stuff that was holding up your migration to gtk3 for a while.
- Site Admin
- Posts: 7052
- Joined: 9 Dec 2007
No, removing "::g_object_ref" is a bug leading to a double-delete.
- Posts: 306
- Joined: 7 Jan 2018
If you have any patches to recommend, please share them! Obviously I have no idea what I'm doing.
- Site Admin
- Posts: 7052
- Joined: 9 Dec 2007
This looks like a weird compiler bug to me. g_object_ref() should be available in GTK 3 just fine.
- Posts: 306
- Joined: 7 Jan 2018
So are you saying that I should modify my patch to leave the ::g_object_ref function call?
- Site Admin
- Posts: 7052
- Joined: 9 Dec 2007
Of course.
- Posts: 306
- Joined: 7 Jan 2018
Zenju, I'm so sorry to bother you about this again. In version 11.21, I am working with what you have done with the icon_loader.cpp logic, and I get this error:
edit: and this is now with g++-12 on Devuan Ceres.
In file included from /usr/include/glib-2.0/gobject/gbinding.h:29,
from /usr/include/glib-2.0/glib-object.h:22,
from /usr/include/glib-2.0/gio/gioenums.h:28,
from /usr/include/glib-2.0/gio/giotypes.h:28,
from /usr/include/glib-2.0/gio/gio.h:26,
from ../../wx+/image_holder.h:11,
from base/icon_loader.h:11:
base/icon_loader.cpp: In function 'zen::FileIconHolder fff::getFileIcon(const Zstring&, int)':
/usr/include/glib-2.0/gobject/gobject.h:541:27: error: expected id-expression before '(' token
541 | #define g_object_ref(Obj) ((glib_typeof (Obj)) (g_object_ref) (Obj))
| ^
base/icon_loader.cpp:219:7: note: in expansion of macro 'g_object_ref'
219 | ::g_object_ref(gicon); //pass ownership
| ^~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
make: *** [Makefile:132: /tmp/FreeFileSync_Make/ffs/src/base/icon_loader.cpp.o] Error 1
make: Leaving directory '/usr/src/freefilesync/11.21-1/FreeFileSync/Source'
- Site Admin
- Posts: 7052
- Joined: 9 Dec 2007
So g_object_ref being a macro instead of a function has been reason for the compilation error.
But why am I not seeing the error during compilation?
My gobject.h has:
This code is never used. Don't know about GLIB_VERSION_MAX_ALLOWED, but __cplusplus is certainly defined. If it is not, then there's something wrong with your c++ build setup.
But why am I not seeing the error during compilation?
My gobject.h has:
#if defined(__GNUC__) && !defined(__cplusplus) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_56
/* Make reference APIs type safe with macros */
#define g_object_ref(Obj) ((__typeof__(Obj)) (g_object_ref) (Obj))
#define g_object_ref_sink(Obj) ((__typeof__(Obj)) (g_object_ref_sink) (Obj))
#endif