Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault on macOS Big Sur with M1 #211

Closed
fynnlyte opened this issue Apr 14, 2021 · 9 comments
Closed

Segmentation fault on macOS Big Sur with M1 #211

fynnlyte opened this issue Apr 14, 2021 · 9 comments

Comments

@fynnlyte
Copy link

I've been trying to get gtimelog running on macOS (M1). After installing needed libraries via brew and using Python 3.9.4, I'm getting the following error on startup:

Unable to configure translations: no locale.bindtextdomain()
Created /Users/me/.local/share/gtimelog
Settings from /Users/me/.config/gtimelog/gtimelogrc migrated to GSettings (org.gtimelog)
[1]    52861 segmentation fault  gtimelog

I've installed these packages via brew:

pygobject3
gtk+3
py3cairo
pango
gobject-introspection
libsoup

As suggested in this issue, I've made the library path available via:

export DYLD_LIBRARY_PATH=/opt/homebrew/lib

Did anyone have more success?

@carlocab
Copy link

In case someone else reads this issue without also reading the linked one (Homebrew/homebrew-core#75020), I strongly recommend against setting DYLD_LIBRARY_PATH for general usage. It's a debugging tool at best, and encountering segfaults when this is set is not surprising. (Not to say that this is the cause of the segfault here.)

@fynnlyte
Copy link
Author

Without setting the DYLD_LIBRARY_PATH, I'm getting this assertion error:

** (process:1578): WARNING **: 20:35:21.047: Failed to load shared library 'libpango-1.0.0.dylib' referenced by the typelib: dlopen(libpango-1.0.0.dylib, 9): image not found
Traceback (most recent call last):
  File "/opt/homebrew/bin/gtimelog", line 5, in <module>
    from gtimelog.main import main
  File "/opt/homebrew/lib/python3.9/site-packages/gtimelog/main.py", line 72, in <module>
    from gi.repository import Gdk, Gio, GLib, GObject, Gtk, Pango, Soup
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
  File "/opt/homebrew/lib/python3.9/site-packages/gi/importer.py", line 144, in load_module
    importlib.import_module('gi.repository.' + dep.split("-")[0])
  File "/opt/homebrew/Cellar/python@3.9/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
  File "/opt/homebrew/lib/python3.9/site-packages/gi/importer.py", line 145, in load_module
    dynamic_module = load_overrides(introspection_module)
  File "/opt/homebrew/lib/python3.9/site-packages/gi/overrides/__init__.py", line 118, in load_overrides
    override_mod = importlib.import_module(override_package_name)
  File "/opt/homebrew/Cellar/python@3.9/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/opt/homebrew/lib/python3.9/site-packages/gi/overrides/Pango.py", line 41, in <module>
    FontDescription = override(FontDescription)
  File "/opt/homebrew/lib/python3.9/site-packages/gi/overrides/__init__.py", line 195, in override
    assert g_type != TYPE_NONE
AssertionError

Previous assertions pass, but it fails for FontDescription.


If I'm setting the DYLD_LIBRARY_PATH and running gtimelog from source, I'm getting this error first:

Typelib files for Secret-1 are not available.

If you're on Ubuntu or another Debian-like distribution, please install
them with

    sudo apt install gir1.2-secret-1

So I did brew install libsecret and only got this error on startup:

Unable to configure translations: no locale.bindtextdomain()

But then still the segfault. I guess this is rather an upstream issue/ M1-specific problem.

@mgedmin
Copy link
Member

mgedmin commented Apr 15, 2021

I don't have a Mac (and I never had one), so I'm afraid I'm not going to be much help here.

I wonder if setting PYTHONFAULTHANDLER=1 would shed any light on the segfault?

The no locale.bindtextdomain() error is not critical; it may mean that some of the translations won't work, but the app itself should run. (I also wonder if brew install gettext or something might make that error go away?)

@fynnlyte
Copy link
Author

I also wonder if brew install gettext or something might make that error go away?

gettext was already installed as a dependency. But perhaps a changed default path also causes an issue here.

I wonder if setting PYTHONFAULTHANDLER=1 would shed any light on the segfault?

Not much:

Fatal Python error: Segmentation fault

Current thread 0x00000001051dbd40 (most recent call first):
  File "/Users/me/Desktop/code/gtimelog/venv/lib/python3.9/site-packages/gi/overrides/Gio.py", line 42 in run
  File "/Users/me/Desktop/code/gtimelog/src/gtimelog/main.py", line 1992 in main
  File "/Users/me/Desktop/code/gtimelog/gtimelog", line 16 in <module>

I don't have a Mac (and I never had one), so I'm afraid I'm not going to be much help here.

No worries, I'll retry once in a while and let you know when it works. In the error Report, I get the following. Doesn't look like anything that gtimelog can do about, rather like an issue the gi bindings.

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

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0xa940421110fc0018 -> 0x0000421110fc0018 (possible pointer authentication failure)
Exception Note:        EXC_CORPSE_NOTIFY

VM Regions Near 0x421110fc0018:
--> commpage (reserved)        1000000000-7000000000   [384.0G] ---/--- SM=NUL  reserved VM address space (unallocated)
    

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x0000000181e80e78 __pthread_kill + 8
1   libsystem_pthread.dylib       	0x0000000181eb2b98 pthread_kill + 292
2   libsystem_c.dylib             	0x0000000181d92e14 raise + 32
3   libsystem_platform.dylib      	0x0000000181efdc44 _sigtramp + 56
4   _gi.cpython-39-darwin.so      	0x0000000105b9c2dc _pygi_invoke_closure_free + 28
5   _gi.cpython-39-darwin.so      	0x0000000105b9c2dc _pygi_invoke_closure_free + 28
6   libglib-2.0.0.dylib           	0x0000000105d3eed8 g_source_callback_unref + 48
7   libglib-2.0.0.dylib           	0x0000000105d38928 g_source_destroy_internal + 124
8   libglib-2.0.0.dylib           	0x0000000105d3c7cc g_main_context_dispatch + 464
9   libglib-2.0.0.dylib           	0x0000000105d3cae0 g_main_context_iterate + 520
10  libglib-2.0.0.dylib           	0x0000000105d3cba0 g_main_context_iteration + 112
11  libgio-2.0.0.dylib            	0x00000001068acdf8 g_application_run + 544
12  libffi.dylib                  	0x000000018ed1c050 ffi_call_SYSV + 80
13  libffi.dylib                  	0x000000018ed249e4 ffi_call_int + 948
14  _gi.cpython-39-darwin.so      	0x0000000105ba5120 pygi_invoke_c_callable + 2248
15  _gi.cpython-39-darwin.so      	0x0000000105b9ac3c pygi_function_cache_invoke + 52
16  org.python.python             	0x0000000104dc76b8 _PyObject_Call + 128
17  org.python.python             	0x0000000104ebdadc _PyEval_EvalFrameDefault + 40452
18  org.python.python             	0x0000000104eb2d30 _PyEval_EvalCode + 436
19  org.python.python             	0x0000000104dc7954 _PyFunction_Vectorcall + 364
20  org.python.python             	0x0000000104ebfc9c call_function + 128
21  org.python.python             	0x0000000104ebd890 _PyEval_EvalFrameDefault + 39864
22  org.python.python             	0x0000000104dc789c _PyFunction_Vectorcall + 180
23  org.python.python             	0x0000000104ebfc9c call_function + 128
24  org.python.python             	0x0000000104ebd930 _PyEval_EvalFrameDefault + 40024
25  org.python.python             	0x0000000104eb2d30 _PyEval_EvalCode + 436
26  org.python.python             	0x0000000104f110b0 run_eval_code_obj + 136
27  org.python.python             	0x0000000104f10fc4 run_mod + 112
28  org.python.python             	0x0000000104f0e6ac pyrun_file + 168
29  org.python.python             	0x0000000104f0dfd0 pyrun_simple_file + 276
30  org.python.python             	0x0000000104f0de7c PyRun_SimpleFileExFlags + 80
31  org.python.python             	0x0000000104f2e120 pymain_run_file + 320
32  org.python.python             	0x0000000104f2d6ec pymain_run_python + 412
33  org.python.python             	0x0000000104f2d50c Py_RunMain + 24
34  org.python.python             	0x0000000104f2eb10 pymain_main + 36
35  org.python.python             	0x0000000104f2ed88 Py_BytesMain + 40
36  libdyld.dylib                 	0x0000000181ed0420 start + 4

@mgedmin
Copy link
Member

mgedmin commented Apr 15, 2021

Yeah, that looks like either a bug in pygobject, or a library mismatch between python, pygobject and/or glib.

@mgedmin mgedmin closed this as completed Apr 15, 2021
@mgedmin
Copy link
Member

mgedmin commented Apr 15, 2021

I remember seeing a native MacOS app inspired by gtimelog, but what was it called... ?

@DocEpsilon
Copy link

DocEpsilon commented Apr 19, 2021

@LyteFM can you try setting DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/lib?

Note: It's fallback, not DYLD_LIBRARY_PATH!

@fynnlyte
Copy link
Author

fynnlyte commented May 6, 2021

Hi,

I've tried it with the fallback path instead. Same segfault error. I'm now on macOS 11.3.1. https://gitlab.gnome.org/GNOME/pygobject/-/issues/417 might be related to the problem of missing libs, but that seems to be solved by the fallback path.

@DocEpsilon
Copy link

As this issue here is closed, I believe you want to follow wether this PR gets merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants