Opened 3 years ago

Closed 6 months ago

#66119 closed defect (fixed)

gnucash @4.11_1: gnc-main-window.c:80:10: fatal error: 'gtkmacintegration/gtkosxapplication.h' file not found

Reported by: JDLH (Jim DeLaHunt) Owned by: drkp (Dan Ports)
Priority: Normal Milestone:
Component: ports Version: 2.8.0
Keywords: Cc: fondacio, mascguy (Christopher Nielsen)
Port: gnucash

Description (last modified by JDLH (Jim DeLaHunt))

When I try to port install gnucash, the building phase consistently fails when building gnc-main-window.c with the message, "fatal error: 'gtkmacintegration/gtkosxapplication.h' file not found". The indicated line reads, #include <gtkmacintegration/gtkosxapplication.h>. But that include file seems to exist. Another file, binreloc.c, has the same #include line, but builds without a problem.

I have attached the main.log file for the failing build. The relevant failure part is (line breaks added for clarity):

:info:build [ 34%] Building C object gnucash/gnome-utils/CMakeFiles/gnc-gnome-utils.dir/gnc-main-window.c.o
:info:build cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports
  _gnome_gnucash/gnucash/work/build/gnucash/gnome-utils 
&& /usr/bin/clang 
  -DG_LOG_DOMAIN=\"gnc.gui\" -DHAVE_CONFIG_H -DHAVE_GUILE22 -DMAC_INTEGRATION -D_GNU_SOURCE -Dgnc_gnome_utils_EXPORTS 
  -I/opt/local/libexec/boost/1.71/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org
    _macports_release_tarballs_ports_gnome_gnucash/gnucash/work/gnucash-4.11/gnucash/gnome-utils 
  -I/opt/local/include/gtkmacintegration-gtk3/gtkmacintegration 
  -I/opt/local/include/libsecret-1 
  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports
    _gnome_gnucash/gnucash/work/build/gnucash/gnome-utils 
  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports
    _gnome_gnucash/gnucash/work/gnucash-4.11/libgnucash/app-utils 
  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports
    _gnome_gnucash/gnucash/work/gnucash-4.11/libgnucash/engine 
  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports
    _gnome_gnucash/gnucash/work/build/common 
  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports
    _gnome_gnucash/gnucash/work/gnucash-4.11/common
  -I/opt/local/include
  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports
    _gnome_gnucash/gnucash/work/gnucash-4.11/borrowed/libc
  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports
    _gnome_gnucash/gnucash/work/build/libgnucash/core-utils
  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports
    _gnome_gnucash/gnucash/work/gnucash-4.11/libgnucash/core-utils
  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports
    _gnome_gnucash/gnucash/work/gnucash-4.11/libgnucash/tax
  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports
    _gnome_gnucash/gnucash/work/gnucash-4.11/bindings/guile
  -I/opt/local/include/guile/2.2 -I/opt/local/include/libxml2
  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports
    _gnome_gnucash/gnucash/work/gnucash-4.11/libgnucash/backend/xml 
  -isystem /opt/local/include/gtk-3.0 -isystem /opt/local/include/gio-unix-2.0 -isystem /opt/local/include/cairo
  -isystem /opt/local/include/pango-1.0 -isystem /opt/local/include/harfbuzz -isystem /opt/local/include/fribidi
  -isystem /opt/local/include/atk-1.0 -isystem /opt/local/include/pixman-1 -isystem /opt/local/include/freetype2
  -isystem /opt/local/include/gdk-pixbuf-2.0 -isystem /opt/local/include/libpng16 -isystem /opt/local/include/glib-2.0
  -isystem /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs
    _ports_gnome_gnucash/gnucash/work/glib-2.0/include
  -Wno-error=deprecated-declarations -Wno-error=parentheses  -Wdeclaration-after-statement -Wno-pointer-sign -Wall
  -Wmissing-prototypes -Wmissing-declarations -Wno-unused -pipe -Os -DNDEBUG
  -I/opt/local/libexec/boost/1.71/include -isystem/opt/local/include
  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports
    _gnome_gnucash/gnucash/work/gnucash-4.11
  -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -arch arm64
  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -mmacosx-version-min=12.0 -fPIC
  -Wno-deprecated-declarations -xobjective-c -std=gnu11 -MD
  -MT gnucash/gnome-utils/CMakeFiles/gnc-gnome-utils.dir/gnc-main-window.c.o
  -MF CMakeFiles/gnc-gnome-utils.dir/gnc-main-window.c.o.d -o CMakeFiles/gnc-gnome-utils.dir/gnc-main-window.c.o
  -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports
    _gnome_gnucash/gnucash/work/gnucash-4.11/gnucash/gnome-utils/gnc-main-window.c
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs
    _ports_gnome_gnucash/gnucash/work/gnucash-4.11/gnucash/gnome-utils/gnc-main-window.c:80:10: 
    fatal error: 'gtkmacintegration/gtkosxapplication.h' file not found
:info:build #include <gtkmacintegration/gtkosxapplication.h>
:info:build          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build 1 error generated.

Earlier, the following module builds successfully. It also includes the same header file (line breaks added for clarity):

:info:build [  5%] Building C object libgnucash/core-utils/CMakeFiles/gnc-core-utils.dir/binreloc.c.o
:info:build cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports
  _gnome_gnucash/gnucash/work/build/libgnucash/core-utils 
&& /usr/bin/clang 
  -DG_LOG_DOMAIN=\"gnc.core-utils\" -DHAVE_CONFIG_H -DHAVE_GUILE22 -DMAC_INTEGRATION -D_GNU_SOURCE -Dgnc_core_utils_EXPORTS 
  -I/opt/local/libexec/boost/1.71/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org
    _macports_release_tarballs_ports_gnome_gnucash/gnucash/work/gnucash-4.11/common 
  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports
    _gnome_gnucash/gnucash/work/build/common 
  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports
    _gnome_gnucash/gnucash/work/build/libgnucash/core-utils 
  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports
    _gnome_gnucash/gnucash/work/gnucash-4.11/libgnucash/core-utils -I/opt/local/include/glib-2.0 
  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports
    _gnome_gnucash/gnucash/work/glib-2.0/include 
  -I/opt/local/include/gtkmacintegration-gtk3/gtkmacintegration 
  -I/opt/local/include/gtk-3.0 -I/opt/local/include/gio-unix-2.0 -I/opt/local/include/cairo -I/opt/local/include/pango-1.0 
  -I/opt/local/include/harfbuzz -I/opt/local/include/fribidi -I/opt/local/include/atk-1.0 -I/opt/local/include/pixman-1 
  -I/opt/local/include/freetype2 -I/opt/local/include/gdk-pixbuf-2.0 -I/opt/local/include/libpng16 
  -Wno-error=deprecated-declarations -Wno-error=parentheses  -Wdeclaration-after-statement -Wno-pointer-sign -Wall 
  -Wmissing-prototypes -Wmissing-declarations -Wno-unused -pipe -Os -DNDEBUG -I/opt/local/libexec/boost/1.71/include 
  -isystem/opt/local/include 
  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports
    _gnome_gnucash/gnucash/work/gnucash-4.11 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -arch arm64 
  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -mmacosx-version-min=12.0 -fPIC -xobjective-c 
  -std=gnu11 -MD -MT libgnucash/core-utils/CMakeFiles/gnc-core-utils.dir/binreloc.c.o 
  -MF CMakeFiles/gnc-core-utils.dir/binreloc.c.o.d -o CMakeFiles/gnc-core-utils.dir/binreloc.c.o 
  -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_
    gnome_gnucash/gnucash/work/gnucash-4.11/libgnucash/core-utils/binreloc.c

I believe that there are only three modules which include this header file. One is compiled successfully, one triggers the above error, and one is not yet attempted. (Line breaks inserted in paths for legibility.)

 % grep -Frn "gtkmacintegration/gtkosxapplication.h" $(port work gnucash) | head -5 
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org
  _macports_release_tarballs_ports_gnome_gnucash/gnucash/work/gnucash-4.11/
  libgnucash/core-utils/binreloc.c:48:#include <gtkmacintegration/gtkosxapplication.h>
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org
  _macports_release_tarballs_ports_gnome_gnucash/gnucash/work/gnucash-4.11/
  gnucash/gnome/window-reconcile.c:62:#include <gtkmacintegration/gtkosxapplication.h>
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org
  _macports_release_tarballs_ports_gnome_gnucash/gnucash/work/gnucash-4.11/
  gnucash/gnome-utils/gnc-main-window.c:80:#include <gtkmacintegration/gtkosxapplication.h>

It sure looks to me like I have this header installed:

% ls -l /opt/local/include/gtkmacintegration-gtk3/gtkmacintegration/gtkosxapplication.h
-rw-r--r--  1 root  wheel  6498 26 Jul 08:50 /opt/local/include/gtkmacintegration-gtk3/gtkmacintegration/gtkosxapplication.h

Expected behaviour: port install gnucash completes without error, and gnucash is installed.

Attachments (1)

main_default-build 2022-10-29T1612.log (1.9 MB) - added by JDLH (Jim DeLaHunt) 3 years ago.
main.log showing "file not found" error

Download all attachments as: .zip

Change History (18)

Changed 3 years ago by JDLH (Jim DeLaHunt)

main.log showing "file not found" error

comment:1 Changed 3 years ago by JDLH (Jim DeLaHunt)

Description: modified (diff)

comment:2 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

binreloc.c only includes gtkmacintegration/gtkosxapplication.h if ENABLE_BINRELOC is defined. I don't see it defined on the command line. It might be defined in an include file, I'm not sure, but if not, that would explain why this file can compile even though gtkmacintegration/gtkosxapplication.h is not found.

gnc-main-window.c fails to compile for the reason stated: it can't find gtkmacintegration/gtkosxapplication.h. For it to be found, the directory containing it would need to be specified as an include path via a -I or -isystem flag. The only flag I see is -I/opt/local/include/gtkmacintegration-gtk3/gtkmacintegration. As you said, the file is actually located at /opt/local/include/gtkmacintegration-gtk3/gtkmacintegration/gtkosxapplication.h so that include path is incorrect. The correct include path would be -I/opt/local/include/gtkmacintegration-gtk3.

comment:3 Changed 3 years ago by JDLH (Jim DeLaHunt)

Thank you, Ryan.

It appears that port gtk-osx-application-common-gtk3 supplies that header file:

% port contents gtk-osx-application-common-gtk3  | grep "include.*gtkmacintegration" 
  /opt/local/include/gtkmacintegration-gtk3/gtkmacintegration/gtkosxapplication.h

And it seems that gnucash does not depend on gtk-osx-application-common-gtk3:

% port rdeps gnucash | grep gtk-osx-application-common-gtk3
%

And the buildbots appears to be able to build gnucash: https://ports.macports.org/port/gnucash/details/ . So perhaps they do not have gtk-osx-application-common-gtk3 present when they build gnucash.

My next step is to deactivate port gtk-osx-application-common-gtk3 and try again.

comment:4 Changed 3 years ago by JDLH (Jim DeLaHunt)

Some other ports which I had installed turned out to depend on port gtk-osx-application-common-gtk3, so I ended up deactivating them all:

% sudo port deactivate gtk-osx-application-common-gtk3 gtk-osx-application-gtk3 goffice gspell darktable inkscape inkscape-app

With that, port gnucash happily built.

So, it appears that port gtk-osx-application-common-gtk3 appears to trigger a bug in port gnucash. How to proceed? I can think of a few ways:

  1. In the gnucash Portfile, mark gtk-osx-application-common-gtk3 as a conflicting port.
  2. Figure out the nature of the interaction, and make gnucash can ignore gtk-osx-application-common-gtk3's presence.
  3. Figure out that gnucash is better off with gtk-osx-application-common-gtk3, figure out how to make the include path be -I/opt/local/include/gtkmacintegration-gtk3 so that #include <gtkmacintegration/gtkosxapplication.h> works, and add gtk-osx-application-common-gtk3 as a dependency.
  4. Maybe something else which I have not thought of.

Diagnosing this may require help from upstream. I am on the mailing list already, so I'm willing to try.

comment:5 Changed 3 years ago by JDLH (Jim DeLaHunt)

Unfortunately, "built" is not the same thing as "runs correctly". I ran the gnucash built by MacPorts. The new book wizard appeared. I cancelled out of the wizard, and gnucash immediately crashed.

Here is part of the macOS crash log:

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               gnucash [6689]
Path:                  /opt/local/bin/gnucash
Identifier:            gnucash
Version:               ???
Code Type:             ARM-64 (Native)
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2022-11-03 00:50:40.3062 -0700
OS Version:            macOS 12.6.1 (21G217)
Report Version:        12
Anonymous UUID:        24504914-FB8A-2238-F0C6-2F8B05578BC0

Sleep/Wake UUID:       C22A1264-AA9B-4DB2-8EC1-88A33EA68F2A

Time Awake Since Boot: 260000 seconds
Time Since Wake:       6028 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGBUS)
Exception Codes:       KERN_PROTECTION_FAILURE at 0x000000019138e794
Exception Codes:       0x0000000000000002, 0x000000019138e794
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace SIGNAL, Code 10 Bus error: 10
Terminating Process:   exc handler [6689]

VM Region Info: 0x19138e794 is in 0x19137e000-0x19155a000;  bytes after start: 67476  bytes before end: 1882219
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      __TEXT                      1910da000-19137e000    [ 2704K] r-x/r-x SM=COW  ...ioToolboxCore
--->  __TEXT                      19137e000-19155a000    [ 1904K] r-x/r-x SM=COW  ...ns/A/CoreText
      __TEXT                      19155a000-191c7e000    [ 7312K] r-x/r-x SM=COW  ...s/A/CoreAudio

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib               	       0x18fa0b788 dataSegmentsContain(objc_class*) + 128
1   libobjc.A.dylib               	       0x18fa0b72c dataSegmentsContain(objc_class*) + 36
2   libobjc.A.dylib               	       0x18fa02ec8 lookUpImpOrForward + 764
3   libobjc.A.dylib               	       0x18fa028e4 _objc_msgSend_uncached + 68
4   libgdk-3.0.dylib              	       0x10117cefc _gdk_quartz_window_did_become_main + 100
5   CoreFoundation                	       0x18fc3d468 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 28
6   CoreFoundation                	       0x18fce1bb8 ___CFXRegistrationPost_block_invoke + 52
7   CoreFoundation                	       0x18fce1b24 _CFXRegistrationPost + 456
8   CoreFoundation                	       0x18fc0c0f8 _CFXNotificationPost + 732
9   Foundation                    	       0x190ad1c28 -[NSNotificationCenter postNotificationName:object:userInfo:] + 96
10  AppKit                        	       0x1928e34f8 -[NSWindow _changeKeyAndMainLimitedOK:] + 1100
11  AppKit                        	       0x1928e2ed0 -[NSWindow _makeKeyRegardlessOfVisibility] + 88
12  AppKit                        	       0x1928d8b88 -[NSWindow makeKeyAndOrderFront:] + 48
13  libgdk-3.0.dylib              	       0x10117cfcc _gdk_quartz_window_did_resign_main + 140
14  libgdk-3.0.dylib              	       0x10117d99c gdk_window_quartz_hide + 224
15  libgdk-3.0.dylib              	       0x10116394c gdk_window_hide + 392
16  libgdk-3.0.dylib              	       0x10116819c gdk_window_withdraw + 112
17  libgtk-3.0.dylib              	       0x101bb2c7c gtk_window_unmap + 120
18  libgobject-2.0.0.dylib        	       0x101248898 g_closure_invoke + 212
19  libgobject-2.0.0.dylib        	       0x10125d498 signal_emit_unlocked_R + 876
20  libgobject-2.0.0.dylib        	       0x10125e20c g_signal_emit_valist + 1604
21  libgobject-2.0.0.dylib        	       0x10125e778 g_signal_emit + 28
22  libgtk-3.0.dylib              	       0x101b9386c gtk_widget_unmap + 184
23  libgtk-3.0.dylib              	       0x101bb2958 gtk_window_hide + 80
24  libgobject-2.0.0.dylib        	       0x101248898 g_closure_invoke + 212
25  libgobject-2.0.0.dylib        	       0x10125d498 signal_emit_unlocked_R + 876
26  libgobject-2.0.0.dylib        	       0x10125e20c g_signal_emit_valist + 1604
27  libgobject-2.0.0.dylib        	       0x10125e778 g_signal_emit + 28
28  libgtk-3.0.dylib              	       0x101b940d4 gtk_widget_hide + 248
29  libgtk-3.0.dylib              	       0x101ba2a24 gtk_widget_dispose + 60
30  libgtk-3.0.dylib              	       0x101bb1f10 gtk_window_dispose + 88
31  libgobject-2.0.0.dylib        	       0x10124d608 g_object_run_dispose + 68
32  libgnc-gnome.dylib            	       0x100f28e98 on_cancel + 44
33  libgobject-2.0.0.dylib        	       0x101248aa4 _g_closure_invoke_va + 224
34  libgobject-2.0.0.dylib        	       0x10125df20 g_signal_emit_valist + 856
35  libgobject-2.0.0.dylib        	       0x10125e778 g_signal_emit + 28
36  libgtk-3.0.dylib              	       0x1019609d4 on_assistant_cancel + 36
37  libgobject-2.0.0.dylib        	       0x101248aa4 _g_closure_invoke_va + 224
38  libgobject-2.0.0.dylib        	       0x10125df20 g_signal_emit_valist + 856
39  libgobject-2.0.0.dylib        	       0x10125e778 g_signal_emit + 28
40  libgtk-3.0.dylib              	       0x101975b54 gtk_button_do_release + 68
41  libgtk-3.0.dylib              	       0x1019756cc gtk_real_button_released + 208
42  libgobject-2.0.0.dylib        	       0x101248aa4 _g_closure_invoke_va + 224
43  libgobject-2.0.0.dylib        	       0x10125df20 g_signal_emit_valist + 856
44  libgobject-2.0.0.dylib        	       0x10125e778 g_signal_emit + 28
45  libgtk-3.0.dylib              	       0x101975c24 multipress_released_cb + 48
46  libgtk-3.0.dylib              	       0x101bdc190 _gtk_marshal_VOID__INT_DOUBLE_DOUBLEv + 80
47  libgobject-2.0.0.dylib        	       0x101248aa4 _g_closure_invoke_va + 224
48  libgobject-2.0.0.dylib        	       0x10125df20 g_signal_emit_valist + 856
49  libgobject-2.0.0.dylib        	       0x10125e778 g_signal_emit + 28
50  libgtk-3.0.dylib              	       0x101a2a3ac gtk_gesture_multi_press_end + 128
51  libgobject-2.0.0.dylib        	       0x10124bb74 g_cclosure_marshal_VOID__BOXEDv + 124
52  libgobject-2.0.0.dylib        	       0x101248aa4 _g_closure_invoke_va + 224
53  libgobject-2.0.0.dylib        	       0x10125df20 g_signal_emit_valist + 856
54  libgobject-2.0.0.dylib        	       0x10125e778 g_signal_emit + 28
55  libgtk-3.0.dylib              	       0x101a28ef0 _gtk_gesture_set_recognized + 92
56  libgtk-3.0.dylib              	       0x101a26e1c _gtk_gesture_check_recognized + 68
57  libgtk-3.0.dylib              	       0x101a28764 gtk_gesture_handle_event + 268
58  libgtk-3.0.dylib              	       0x101a2bc64 gtk_gesture_single_handle_event + 364
59  libgtk-3.0.dylib              	       0x1019f66fc gtk_event_controller_handle_event + 124
60  libgtk-3.0.dylib              	       0x101b97db0 _gtk_widget_run_controllers + 124
61  libgtk-3.0.dylib              	       0x101bd786c _gtk_marshal_BOOLEAN__BOXEDv + 124
62  libgobject-2.0.0.dylib        	       0x101248aa4 _g_closure_invoke_va + 224
63  libgobject-2.0.0.dylib        	       0x10125df20 g_signal_emit_valist + 856
64  libgobject-2.0.0.dylib        	       0x10125e778 g_signal_emit + 28
65  libgtk-3.0.dylib              	       0x101b979e0 gtk_widget_event_internal + 300
66  libgtk-3.0.dylib              	       0x101a6e0e0 propagate_event + 388
67  libgtk-3.0.dylib              	       0x101a6d530 gtk_main_do_event + 1132
68  libgdk-3.0.dylib              	       0x1011541cc _gdk_event_emit + 64
69  libgdk-3.0.dylib              	       0x10117961c gdk_event_dispatch + 52
70  libglib-2.0.0.dylib           	       0x100b2dfe0 g_main_context_dispatch + 240
71  libglib-2.0.0.dylib           	       0x100b2e2fc g_main_context_iterate + 432
72  libglib-2.0.0.dylib           	       0x100b2e5f4 g_main_loop_run + 288
73  libgtk-3.0.dylib              	       0x101a6cf60 gtk_main + 92
74  libgnc-gnome-utils.dylib      	       0x10107adac gnc_ui_start_event_loop + 88
75  gnucash                       	       0x1002f6138 scm_run_gnucash(void*, int, char**) + 736
76  libguile-2.2.1.dylib          	       0x1008ba38c invoke_main_func + 44
77  libguile-2.2.1.dylib          	       0x10089d1d4 c_body + 24
78  libguile-2.2.1.dylib          	       0x1009102ac vm_regular_engine + 1376
79  libguile-2.2.1.dylib          	       0x10090ee54 scm_call_n + 428
80  libguile-2.2.1.dylib          	       0x10090c274 catch + 504
81  libguile-2.2.1.dylib          	       0x10089d14c scm_i_with_continuation_barrier + 136
82  libguile-2.2.1.dylib          	       0x10089d1ac scm_c_with_continuation_barrier + 60
83  libguile-2.2.1.dylib          	       0x10090bde4 with_guile + 76
84  libgc.1.dylib                 	       0x1005fa840 GC_call_with_stack_base + 36
85  libguile-2.2.1.dylib          	       0x100909fc0 scm_with_guile + 44
86  libguile-2.2.1.dylib          	       0x1008ba34c scm_boot_guile + 80
87  gnucash                       	       0x1002f5df4 Gnucash::Gnucash::start(int, char**) + 448
88  gnucash                       	       0x1002f6364 main + 100
89  dyld                          	       0x10053d08c start + 520
...[rest of crash report elided]...

comment:6 Changed 3 years ago by kencu (Ken)

Jim, it looks like upstream offers gnucash 4.12, but only for Intel, as a prebuilt binary.

https://www.gnucash.org/download.phtml

I might suggest to try that, and see if it crashes too. Probably it doesn't, or there would be noise about it upstream.

If it works, and the one in macports crashes, then it's either an arm64 thing, the fact that macports' version is slightly out-of-date, or something in the extensive set of gnome supporting ports that is out of date, patched wrong, not working right with arm64 macs yet, etc, etc, etc, etc, etc

comment:7 Changed 3 years ago by JDLH (Jim DeLaHunt)

Thank you, Ken. I have gnucash 4.11 from upstream, as a prebuilt binary. It does not crash.

There is evidence that upstream expects gnucash to compile on arm64.

  1. Their [macOS/Quarts build instructions](https://wiki.gnucash.org/wiki/MacOS/Quartz) say, "Apple Silicon is first supported in macOS 11. We have never successfully cross-compiled the Gtk stack so you'll probably need an Apple Silicon Mac to build an Apple Silicon native GnuCash. Note that as of October 2022 WebKitGtk isn't able to find its loadable modules so that reports don't render in GnuCash." That would be a curious thing to say if they had never got GnuCash working at all when compiling on Apple Silicon.
  1. I am attempting to build gnucash from source, following their instructions. One of their developers is helping me in an [email thread "Various failures while building MacOS/Quartz from source"](https://lists.gnucash.org/pipermail/gnucash-devel/2022-November/046373.html). I have not yet got the push-back, "don't try to build on arm64, we know it doesn't work".

It looks like I will need to take up both this crash, and the issue of port gtk-osx-application-common-gtk3 preventing port gnucash from building, with the friendly folks at Gnucash-devel. I think I will wait a bit to see if I can resolve my current thread of building from source first, so that I don't make their list, um, too multi-threaded.

Version 0, edited 3 years ago by JDLH (Jim DeLaHunt) (next)

comment:8 Changed 3 years ago by JDLH (Jim DeLaHunt)

Clues about this bug, from a post "Re: [GNC-dev) Various failures while building MacOS/Quartz from source" to the GnuCash developers list by a knowledgeable developer John Ralls, on Sun, 6 Nov 2022 16:17:23 -0800:

gtkosxapplication is what puts the menus on the menu bar instead of on the window. If you want to build without it you need to hide $PREFIX/lib/pkgconfig/gtk-mac-integration-gtk3.pc.

But that crash hasn't anything to do with gtkosxapplication. I think it's

Try applying https://gitlab.gnome.org/GNOME/gtk-osx/-/blob/master/patches/gtk-3.24.33-quartz-window-transient-for.patch to your gtk3-24.34 build.

The fix in gtk itself is https://gitlab.gnome.org/GNOME/gtk/-/commit/a2c54c739ed08eac6d360cd3a6ae140e1fab556d but that does a bunch of other stuff too. I committed it after Mattias released 3.23.34.

comment:9 Changed 3 years ago by kencu (Ken)

comment:10 Changed 3 years ago by JDLH (Jim DeLaHunt)

I certainly want to try that patch. I can't promise it will be soon, because I have other projects I am juggling.

Basically, I am making notes in this ticket for future reference.

comment:11 Changed 3 years ago by fondacio

Cc: fondacio added

comment:12 Changed 7 months ago by JDLH (Jim DeLaHunt)

I have just observed this bug (I believe) in port gnucash @5.11 .

The GTK version I have installed is gtk3 @3.24.49_1+quartz . 3.24.49 is later than 3.24.33, so the patch referenced above for 3.24.33 might be in the current version of GTK3. And, the URL above for the patch no longer returns content. So it looks like upstream GTK has moved on. I don't know where that leaves me with this bug.

comment:13 Changed 6 months ago by JDLH (Jim DeLaHunt)

I just diagnosed this bug a little more.

Port gnucash @5.11 does indeed seem to have a conflict with port gtk-osx-application-common-gtk3, as noted comment:3 .

But it turns out that Port gnucash is a recursive dependent of port gtk-osx-application-common-gtk3, if gtk3 variant +quartz is installed! Gnucash has a variant [+]docs. The +docs variant adds a dependency on port gnucash-docs. gnucash-docs depends on port yelp, which depends on port libhandy, which depends on port glade, which in variant +quartz depends on port gtk-osx-application-gtk3, which depends on port gtk-osx-application-common-gtk3.

The workaround seems to be:

  1. deactivate port gtk-osx-application-common-gtk3 and everything which depends on it,
  2. install gnucash -docs, which builds gnucash without gnucash-docs,
  3. if you are using gtk3+quartz, install glade +quartz (see explanation of this workaround below),
  4. install gnucash-docs.

Then you are fine until you next need to rebuild gnucash.

By the way, port glade depends on port gtk3. Both ports have +x11 and +quartz variants, and glade needs to have the same variant as gtk3. But +x11 is the default variant for glade, so if you have gtk3+quartz installed, glade (with no variants stated) will fail to build. The workaround for _that_ is to install glade +quartz first, so that when gnucash-docs installs, it will have the correct variant of glade available.

The fixes I listed in comment:4 still seem to be the right ones for this bug.

comment:14 Changed 6 months ago by JDLH (Jim DeLaHunt)

In the log excerpt above, the trigger for the failure seems to be this compiler flag: -I/opt/local/include/gtkmacintegration-gtk3/gtkmacintegration . If it were instead -I/opt/local/include/gtkmacintegration-gtk3, then I suspect the module's statement #include <gtkmacintegration/gtkosxapplication.h> at gnucash/gnome-utils/gnc-main-window.c:80:10 would succeed.

Where does this compiler flag come from? After some digging, I suspect that it is from port gtk-osx-application-common-gtk3 file data/gtk-mac-integration-gtk3.pc.in. It contains:

prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@

Name: gtk-mac-integration-gtk3
Description: Mac menu bar and dock integration for GTK+
Requires: gtk+-3.0
Version: @VERSION@
Libs: -L${libdir} -lgtkmacintegration-gtk3
Cflags: -I${includedir}/gtkmacintegration -DMAC_INTEGRATION

The build process converts this to gtk-mac-integration-gtk3.pc, which contains the following:

prefix=/opt/local
exec_prefix=${prefix}
libdir=/opt/local/lib/gtkmacintegration-gtk3
includedir=/opt/local/include/gtkmacintegration-gtk3

Name: gtk-mac-integration-gtk3
Description: Mac menu bar and dock integration for GTK+
Requires: gtk+-3.0
Version: 3.0.2
Libs: -L${libdir} -lgtkmacintegration-gtk3
Cflags: -I${includedir}/gtkmacintegration -DMAC_INTEGRATION

I suspect that the /gtkmacintegration suffix in the final line is what steers the GnuCash compilation wrong.

It may be that port gtk-osx-application-common-gtk3 should leave the suffix out of this flag. But other ports depend on this port, and I don't know how much work it is to be sure none of them need this flag. Instead, I suspect that an easier fix is to add a directive to the GnuCash portfile, to change the Cflag -I${prefix}/include/gtkmacintegration-gtk3/gtkmacintegration to -I${prefix}/include/gtkmacintegration-gtk3.

comment:15 Changed 6 months ago by JDLH (Jim DeLaHunt)

After a lot of looking at the code, I decided it would be easiest to patch the #include <gtkmacintegration/gtkosxapplication.h> to remove the gtkmacintegration/ prefix from the three affected source files. After a bit of confusion about how include directives propagated from CMake files to the compile commands, I figured out that gnucash/gnome/CMakeLists.txt needed an extra entry in its target_include_directories() statement to get the gtkmacintegration include path to the third source file.

The result is PR 28546 (commit 967364b). It is awaiting evaluation.

comment:16 Changed 6 months ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:17 Changed 6 months ago by Jim DeLaHunt <from+github@…>

Resolution: fixed
Status: assignedclosed

In 92ba307caf7207f0f90a6efa1ad9b761cdb87f1d/macports-ports (master):

gnucash: fix 66119, build failure when +quartz (https://github.com/macports/macports-ports/pull/28546)

  • Fix gnucash @5.11_0 build failure when +quartz (ticket 66119 gtkmacintegration)

Make gnucash compatible with port gtk-osx-application-common-gtk3 (subport of gtk-osx-application).
The errors came because three GnuCash source files had an import like:
#include <gtkmacintegration/gtkosxapplication.h>
but the include path delivered by port gtk-osx-application-common-gtk3 included the
.../gtkmacintegration/ part. The correct import is:
#include <gtkosxapplication.h>
The affected source files are:

  • gnucash/gnome-utils/gnc-main-window.cpp
  • gnucash/gnome/window-reconcile.cpp
  • libgnucash/core-utils/binreloc.c

Also, gnucash/gnome/CMakeLists.txt did not propagate the include path properly.
CMakeLists.txt must contain a directive like:
target_include_directories(... ${GTK_MAC_INCLUDE_DIRS} )
...to pick up the include dirs discovered by ./CMakeLists.txt:464,
pkg_check_modules(GTK_MAC IMPORTED_TARGET gtk-mac-integration-gtk3).

Fixes ticket 66119 "gnucash @4.11_1: gnc-main-window.c:80:10: fatal error: 'gtkmacintegration/
gtkosxapplication.h' file not found" <#66119>.
The problem only occurs when port gtk3 has the +quartz variant, because that causes
the GnuCash sources to compile in optional "MAC_INTEGRATION" code.

Also, no reinplace of if (WIN32 OR APPLE) necessary

The reinplace "s|if (WIN32 OR APPLE)|if (WIN32)|" in
${worksrcpath}/CMakeLists.txt didn't change anything.
The corresponding change was made upstream in
gnucash/commit/1915dfb0cb255fe26dcd7810c96e855defbc747f
on 2020-10-17.

  • Delete obsolete commented-out line from Gnucash portfile.

Closes: #66119

Note: See TracTickets for help on using tickets.