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

Unexpected termination 11 on Alpine #204

Closed
hugoromo opened this issue Mar 15, 2024 · 5 comments
Closed

Unexpected termination 11 on Alpine #204

hugoromo opened this issue Mar 15, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@hugoromo
Copy link

Error when trying to setup whatsapp:

Unexpected termination 11
Callstack:
Segmentation fault

Environment:

  • Version: latest source
  • OS / distro: Alpine
@hugoromo hugoromo added the bug Something isn't working label Mar 15, 2024
@d99kris
Copy link
Owner

d99kris commented Mar 16, 2024

Hi @hugoromo - thanks for reporting an issue. Could you please try run the setup with extra verbose logging:
nchat -ee -s
and share the log content of ~/.nchat/log.txt?

@hugoromo
Copy link
Author

hugoromo commented Mar 16, 2024

Hi! Here are the logs after running with those arguments:

2024-03-16 21:20:11.910 | INFO  | starting nchat v4.40  (main.cpp:239)
2024-03-16 21:20:14.929 | ERROR | failed dlopen /usr/local/bin/../lib/libwmchat.so  (main.cpp:74)
2024-03-16 21:20:14.929 | ERROR | dlerror Error relocating /usr/local/bin/../lib/libwmchat.so: sqlite3_set_clientdata: initial-exec TLS resolves to dynamic definition in /usr/local/bin/../lib/libwmchat.so  (main.cpp:78)
Unexpected termination 11
Callstack:

@d99kris
Copy link
Owner

d99kris commented Mar 17, 2024

Thanks! It appears initial-exec TLS resolves to dynamic definition can be worked around by disabling HAS_DYNAMICLOAD (which avoids using dlopen):

mkdir -p build && cd build
cmake -DHAS_DYNAMICLOAD=OFF .. && make -s

However, we then encounter another crash during startup:

Thread 2 "nchat" received signal SIGSEGV, Segmentation fault.
[Switching to LWP 9226]
0x0000fffff67db708 in runtime.argv_index (argv=0x80000001, i=-159307743) at /usr/lib/go/src/runtime/runtime1.go:63
63              return *(**byte)(add(unsafe.Pointer(argv), uintptr(i)*goarch.PtrSize))
(gdb) bt
#0  0x0000fffff67db708 in runtime.argv_index (argv=0x80000001, i=-159307743) at /usr/lib/go/src/runtime/runtime1.go:63
#1  runtime.sysargs (argc=-159307744, argv=0x80000001) at /usr/lib/go/src/runtime/os_linux.go:236
#2  0x0000fffff67eff5c in runtime.args (c=-159307744, v=0x80000001) at /usr/lib/go/src/runtime/runtime1.go:69
#3  0x0000fffff6813b68 in runtime.args (c=-159307744, v=0x80000001) at <autogenerated>:1
#4  0x0000fffff680f4dc in runtime.rt0_go () at /usr/lib/go/src/runtime/asm_arm64.s:84

This is due to an incompatibility between Go and musl w.r.t. c-shared library usage (which nchat uses to link Go library whatsmeow for WhatsApp support).

The linked issue has been open since 2015, so it appears that neither the Go nor the Musl projects are very interested in fixing it. Based on this I'll probably need to consider musl support out-of-scope for nchat's whatsapp feature.

I'll leave this issue open for a while and see if I can add some musl detection to provide a more user-friendly error message.

@hugoromo
Copy link
Author

Too bad if that means dropping support for WhatsApp. I might just stop using that service anyway.. Cheers!

@d99kris
Copy link
Owner

d99kris commented Mar 24, 2024

In above commit I've added a warning when trying to set up whatsapp on non-glibc systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants