FS#78032 - [clang] Usage of _GLIBCXX_ASSERTIONS makes clangd extremely unstable
Attached to Project:
Arch Linux
Opened by Aaron Barany (akb825) - Wednesday, 29 March 2023, 01:22 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:18 GMT
Opened by Aaron Barany (akb825) - Wednesday, 29 March 2023, 01:22 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:18 GMT
|
Details
Description:
The default Arch compile flags enable _GLIBCXX_ASSERTIONS, which causes clangd to be extremely unstable. This in turn makes IDEs (such as Qt Creator) and plugins that rely on clangd have many essential features borderline unusable. This is very common for unmatched parentheses or brackets, which typically happens when writing code while clangd processes the files while in the middle of typing. In practice this causes dozens of crashes each day, and the application using clangd may simply give up and disable many of its features if it detects that it crashed too much. I rebuilt clang adding the following to CXXFLAGS: "-Wp,-U_GLIBCXX_ASSERTIONS". After applying this modification the consistent crashing no longer occurs. While the ideal solution would be to fix the assertions upstream, these Arch-specific build options result the user experience is significantly inferior to the default build of clang or the builds typically found in other distributions. To at least have the usability on Arch to be on par with other systems, I request that "-Wp,-U_GLIBCXX_ASSERTIONS" be added to the CXXFLAGS for the clang package to disable these assertions for this package. Additional info: * package version: 15.0.7-2 Steps to reproduce: 1. Open a C or C++ file in a program that utilizes clangd, such as Qt Creator. 2. Edit a function with an unterminated open parenthesis. For example, an unclosed assert( 3. Notice that clangd will crash until the parentheses are closed. Many features, including code completion and semantic highlighting, will be unavailable in the meantime. If it crashes enough times in a short period the clangd features will be disabled, using a fallback that only has partial functionality. |
This task depends upon
Closed by Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:18 GMT
Reason for closing: Moved
Additional comments about closing: https://gitlab.archlinux.org/archlinux/p ackaging/packages/clang/issues/3
Saturday, 25 November 2023, 20:18 GMT
Reason for closing: Moved
Additional comments about closing: https://gitlab.archlinux.org/archlinux/p ackaging/packages/clang/issues/3
...which was originally "borrowed" from Fedora [1]. FWIW Fedora compile clang with _GLIBCXX_ASSERTIONS enabled. Just sayin..
[1] https://src.fedoraproject.org/rpms/redhat-rpm-config/blob/rawhide/f/buildflags.md
1. Fedora is effectively a testing ground for RedHat Enterprise Linux.
2. Applying it by default should help increase safety for any applications that might be security-critical.
I won't argue against the decision for the usage of this flag by default in Arch, it certainly is a bug to trigger the assertions. However, in some cases (either situations like this where the program is extremely unstable, or for performance-critical applications) it may make sense to selectively disable it.
Either way, I have created an upstream bug report: https://github.com/clangd/clangd/issues/1559 Hopefully this will be fixed so disabling assertions won't be needed, but it would at least be very helpful as a stopgap. The constant crashing has been rather disruptive in my own day to day work at least.