Closed kyrre closed 1 month ago
Can you supply the print results of the ctypes.find_library calls in runmac_app at the end of launcher.py?
Like this?
def _run_mac_app():
# this runs the main event loop
# it is required for the GUI to show up
objc = ctypes.cdll.LoadLibrary(ctypes.util.find_library("libobjc"))
ctypes.cdll.LoadLibrary(ctypes.util.find_library("AppKit")) # required
print(ctypes.util.find_library("libobjc"))
print(ctypes.util.find_library("AppKit"))
...
/usr/lib/libobjc.dylib /System/Library/Frameworks/AppKit.framework/AppKit
Thanks for providing the additional information. The values you shared seem to be correct, but we're still working to see if we can replicate this error.
Can you attempt to update _run_map_app
with the following? It seems that there are some unusual behaviors when Java starts up so this tries to work around it. Please let us know if this works.
def _run_mac_app():
# this runs the event loop
# it is required for the GUI to show up
import ctypes
import ctypes.util
from ctypes import c_void_p, c_double, c_uint64, c_int64, c_int32, c_bool, CFUNCTYPE
CoreFoundation = ctypes.cdll.LoadLibrary(ctypes.util.find_library("CoreFoundation"))
def get_function(name, restype, *argtypes):
res = getattr(CoreFoundation, name)
res.argtypes = [arg for arg in argtypes]
res.restype = restype
return res
CFRunLoopTimerCallback = CFUNCTYPE(None, c_void_p, c_void_p)
kCFRunLoopDefaultMode = c_void_p.in_dll(CoreFoundation, "kCFRunLoopDefaultMode")
kCFRunLoopRunFinished = c_int32(1)
NULL = c_void_p(0)
INF_TIME = c_double(1.0e20)
FIRE_ONCE = c_double(0)
kCFAllocatorDefault = NULL
CFRunLoopGetCurrent = get_function("CFRunLoopGetCurrent", c_void_p)
CFRelease = get_function("CFRelease", None, c_void_p)
CFRunLoopTimerCreate = get_function(
"CFRunLoopTimerCreate",
c_void_p,
c_void_p,
c_double,
c_double,
c_uint64,
c_int64,
CFRunLoopTimerCallback,
c_void_p
)
CFRunLoopAddTimer = get_function("CFRunLoopAddTimer", None, c_void_p, c_void_p, c_void_p)
CFRunLoopRunInMode = get_function("CFRunLoopRunInMode", c_int32, c_void_p, c_double, c_bool)
@CFRunLoopTimerCallback
def dummy_timer(timer, info):
# this doesn't need to do anything
# CFRunLoopTimerCreate just needs a valid callback
return
timer = CFRunLoopTimerCreate(kCFAllocatorDefault, INF_TIME, FIRE_ONCE, 0, 0, dummy_timer, NULL)
CFRunLoopAddTimer(CFRunLoopGetCurrent(), timer, kCFRunLoopDefaultMode)
CFRelease(timer)
while CFRunLoopRunInMode(kCFRunLoopDefaultMode, INF_TIME, False) != kCFRunLoopRunFinished:
pass
Sorry for the late reply. Replacing the function with the one you provided fixes it.
While version 1.1.0 works fine the newest version 1.2.0 fails to launch on macOS:
macOS 14.5 ghidra via homebrew (with rebuilt native binaries)
This is where it gets stuck on 1.2.0. Not sure how to debug this further