FS#79683 - [libunwind] add cxx_exceptions support

Attached to Project: Arch Linux
Opened by REmorin (REmorin) - Wednesday, 13 September 2023, 22:28 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:26 GMT
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To Felix Yan (felixonmars)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
libunwind so-files (specifically, `liunwind.so.8.0.1`) lack the symbols (called `cxx_exceptions` upstream) needed for some usecases.
In my case I can't compile a program with a sanitizer using `clang -rtlib=compiler-rt -unwindlib=libunwind` because it needs `_Unwind_Backtrace` and `_Unwind_GetIP` which the so-file doesn't have. (https://github.com/llvm/llvm-project/issues/65796#issuecomment-1716486460) This situation is especially worse on Arch, because a few distros have llvm-libunwind which can provide it. (The AUR package is bad and not up to date.)
But, there is an easy soulution, which, btw, Debian and Alpine use:
Pass `--enable-cxx-exceptions` to `./configure` during buildtime. Works for every version: `1.6.2`, `1.7.2`, `1.5.0`.
See https://github.com/libunwind/libunwind/issues/615#issuecomment-1718085148 for details.

Additional info:
* package version(s): 1.6.2-2
* config and/or log files etc.: see "steps to reproduce" and links.
* link to upstream bug report, if any: https://github.com/libunwind/libunwind/issues/615 (not really a bug/issue report, just a question at this point about the distros situation and the default behavior; plus I dunno how long it'll take them to reply, they don't seem to reply very fast/often)

Steps to reproduce:
* `strings /usr/lib/libunwind.so.8.0.1 | grep '_Unwind'`
* grep: exit 1
This task depends upon

Closed by  Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:26 GMT
Reason for closing:  Moved
Additional comments about closing:  https://gitlab.archlinux.org/archlinux/p ackaging/packages/libunwind/issues/1
Comment by REmorin (REmorin) - Wednesday, 13 September 2023, 22:33 GMT
Forgot to mention: this may apply to `lib32-libunwind`, too. (The lib32/ so-file lacks the symbols as well.)
Comment by Toolybird (Toolybird) - Wednesday, 13 September 2023, 22:52 GMT
> Is there any reason cxx_exceptions aren't activated by default?

Upstream possibly doesn't enable it by default due to this comment in `configure.ac'

"# C++ exception handling doesn't work too well on x86"
Comment by REmorin (REmorin) - Tuesday, 19 September 2023, 14:27 GMT
The upstream closed the issue, deciding not to make the cxx_exceptions enabled by default and giving the choice to the distros to enable them.

https://github.com/libunwind/libunwind/issues/615#issuecomment-1721622057

> Upstream possibly doesn't enable it by default due to this comment in `configure.ac'

Didn't find it in the file you mentioned (in the libunwind repo). Did you mean `configure.ac` in Void Linux source repo?
Actually, nevermind (about the configure.ac and "not working well on x86"), as I understood, they didn't enable cxx_exceptions by default just not to provide the alternatives for these symbols in libgcc, because some distros might not want them and some developers might not need them.

But they didn't say there's something bad about enabling them, they just said it's up to the distros themselves.
And considering Debian and Alpine decided to enable them, I don't see any reason not to enable them in Arch.

Also, Arch really needs cxx_exceptions, because it doesn't have `llvm-libunwind` package in the repos to provide them. (Again, the AUR package is outdated and not a very good option.)
Finally, since Arch is considered to be a distro for advanced users and developers, I don't see how developer's points really apply to Arch; I agree that distros for normies might not want to enable them, but it's normal for Arch to have a large number of C/C++ developers, a part of whom prefers to not use gcc entirely (including the toolchain; using `clang -rtlib=compiler-rt -unwindlib=libunwind`), and they need cxx_exceptions in libunwind for that, or otherwise they are gonna get a linking error.
Comment by loqs (loqs) - Tuesday, 19 September 2023, 14:57 GMT

Loading...