Opened 4 years ago

Closed 4 years ago

#60610 closed defect (fixed)

gedit @3.28.1_1: error building +quartz

Reported by: kencu (Ken) Owned by: dbevans (David B. Evans)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: gedit

Description

On 10.15.

info:build                         ^
:info:build gedit/gedit-file-chooser-dialog-osx.c:750:9: warning: incompatible integer to pointer conversion assigning to 'NSWindow *' from 'int' [-Wint-conversion]
:info:build                 nswin = gdk_quartz_window_get_nswindow (win);
:info:build                       ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build 3 warnings and 1 error generated.
:info:build make[2]: *** [gedit/libosx_la-gedit-file-chooser-dialog-osx.lo] Error 1

Attachments (3)

gedit-quartz-fail.log (653.3 KB) - added by kencu (Ken) 4 years ago.
patch-gedit-quartz.diff (869 bytes) - added by kencu (Ken) 4 years ago.
patch-gedit-no-crash-quartz.diff (544 bytes) - added by kencu (Ken) 4 years ago.
stops gedit +quartz from crashing

Download all attachments as: .zip

Change History (12)

Changed 4 years ago by kencu (Ken)

Attachment: gedit-quartz-fail.log added

comment:1 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

gtk3 @3.24.20 defines the function as:

NSWindow *gdk_quartz_window_get_nswindow            (GdkWindow *window)

And gedit @3.28.1 uses it like this:

NSWindow *nswin;
nswin = gdk_quartz_window_get_nswindow (win);

That seems to match.

I think the first errors in the log are more interesting:

:info:build gedit/gedit-app-osx.c:49:3: error: use of undeclared identifier 'NSWindow'
:info:build                 NSWindow *nswin;
:info:build                 ^
:info:build gedit/gedit-app-osx.c:49:13: error: use of undeclared identifier 'nswin'
:info:build                 NSWindow *nswin;
:info:build                           ^
:info:build gedit/gedit-app-osx.c:65:3: error: use of undeclared identifier 'nswin'
:info:build                 nswin = gdk_quartz_window_get_nswindow (win);
:info:build                 ^
:info:build gedit/gedit-app-osx.c:65:11: error: implicit declaration of function 'gdk_quartz_window_get_nswindow' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build                 nswin = gdk_quartz_window_get_nswindow (win);
:info:build                         ^

It looks like gtk3 removed gdk_quartz_window_get_nswindow from the public API, despite the fact that gedit and others are using it. gedit worked around it by re-adding the API. We could apply that patch to the gedit port or update it to a newer version.

comment:2 Changed 4 years ago by kencu (Ken)

I tried the patch. It built gedit +quartz, however, doesn't run:

Process:               gedit [36241]
Path:                  /opt/local/bin/gedit
Identifier:            gedit
Version:               0
Code Type:             X86-64 (Native)
Parent Process:        zsh [36238]
Responsible:           Terminal [31397]
User ID:               501

Date/Time:             2020-06-07 18:40:18.193 -0700
OS Version:            Mac OS X 10.15.5 (19F101)
Report Version:        12
Anonymous UUID:        D9834BC0-8FDB-61B9-48E1-3DB9B7281ED8

Sleep/Wake UUID:       D0C104B5-A5A1-4243-B231-5603FD7B9B57

Time Awake Since Boot: 6400 seconds
Time Since Wake:       1500 seconds

System Integrity Protection: disabled

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

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [36241]

VM Regions Near 0:
--> 
    __TEXT                 0000000109be4000-0000000109beb000 [   28K] r-x/r-x SM=COW  /opt/local/bin/gedit

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_c.dylib             	0x00007fff67885f09 strtol_l + 80
1   libcheckupdate.so             	0x000000011146afd4 parse_page_version + 286
2   libsoup-2.4.1.dylib           	0x00000001114a317f soup_session_process_queue_item + 2132
3   libsoup-2.4.1.dylib           	0x00000001114a7c8e async_run_queue + 173
4   libsoup-2.4.1.dylib           	0x00000001114a7baf idle_run_queue + 27
5   libglib-2.0.0.dylib           	0x000000010aa24cbe g_main_context_dispatch + 258
6   libglib-2.0.0.dylib           	0x000000010aa24fb9 g_main_context_iterate + 426
7   libglib-2.0.0.dylib           	0x000000010aa25011 g_main_context_iteration + 55
8   libgio-2.0.0.dylib            	0x000000010a8653ed g_application_run + 455
9   gedit                         	0x0000000109beadd8 main + 175
10  libdyld.dylib                 	0x00007fff677d6cc9 start + 1

Changed 4 years ago by kencu (Ken)

Attachment: patch-gedit-quartz.diff added

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

The attached patch allows gedit +quartz to run, by disabling the piece of code that triggers the error.

Exactly why it is triggering the error is not yet obvious to me, but at least I know where the error is.

diff --git plugins/checkupdate/gedit-check-update-plugin.c plugins/checkupdate/gedit-check-update-plugin.c
index 3f2c3c3..4625ed4 100644
--- plugins/checkupdate/gedit-check-update-plugin.c
+++ plugins/checkupdate/gedit-check-update-plugin.c
@@ -563,8 +563,9 @@ parse_page_version (SoupSession            *session,
 		    SoupMessage            *msg,
 		    GeditCheckUpdatePlugin *plugin)
 {
-	if (msg->status_code == SOUP_STATUS_OK)
-	{
+//	if (msg->status_code == SOUP_STATUS_OK)
+    if (0)
+    {
 		gchar *version;
 		SoupMessage *msg2;
 

Changed 4 years ago by kencu (Ken)

stops gedit +quartz from crashing

comment:4 Changed 4 years ago by kencu (Ken)

If you try this, it will run -- but for some reason the menus don't immediately work -- a minute or so, possibly related to clicking around a bit? -- and the menus then start working. So that is also weird.

comment:5 Changed 4 years ago by kencu (Ken)

Before anyone spends 10 seconds more on this, we should update our version to the current -- we're quite out of date at present.

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

gedit is up to 3.36.2, and now uses meson -- so that has to all change.

there is a new dependency on a support library called tepl, and that was simple to add a portfile for.

harder is that now gedit assumes darwin builds with quartz only (that's likely a homebrew effect now), and so will need surgery to build with anything other than quartz.

comment:7 Changed 4 years ago by kencu (Ken)

but not impossible, in the end:

$ port -v installed gedit
The following ports are currently installed:
  gedit @3.36.2_0+python36 (active) platform='darwin 10' archs='x86_64' date='2020-06-10T12:52:54-0700'

here's the WIP, which works. <https://github.com/kencu/macports-ports/commits/geditupdate>

comment:8 Changed 4 years ago by kencu (Ken)

Please see this PR, that attempts to fix this issue <https://github.com/macports/macports-ports/pull/7396>

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

Resolution: fixed
Status: assignedclosed

In 1afbae49ba1bc1f8a5e29f8edcc6d5689a43a764/macports-ports (master):

gedit: update to 3.36.2

builds with meson now
requires tepl
fixes quartz build

closes: #60610

Note: See TracTickets for help on using tickets.