Summary: | KDevelop crashes when adding wxWidgets | ||
---|---|---|---|
Product: | [Applications] kdevelop | Reporter: | Bruno Cabral <cabral.brc> |
Component: | Language Support: CPP (Clang-based) | Assignee: | kdevelop-bugs-null |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | igorkuo |
Priority: | NOR | ||
Version First Reported In: | 5.12.230801 | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
main.cpp with #include wx.h and CMakeLists.txt with wxWidgets package configured
gdb ~/backtrace.txt KCrash Report |
Found a solution, need to set the command-line arguments in the project configuration "Language Support > C/C++ Parser > C++ profile > change to Custom > -pthread -lwx_qtu_xrc-3.2 -lwx_qtu_html-3.2 -lwx_qtu_qa-3.2 -lwx_qtu_core-3.2 -lwx_baseu_xml-3.2 -lwx_baseu_net-3.2 -lwx_baseu-3.2" Hi, The solution "change command-line arguments" worked on Biglinux (Manjaro), but not on Ubuntu. On Ubuntu the AppImage works fine (https://www.appimagehub.com/p/1222215/), but not the one from repo (sudo apt install kdevelop) Hi, Ubuntu Snap (5.11) does not work either. Created attachment 161813 [details]
gdb ~/backtrace.txt
I was able to get "gdb ~/backtrace.txt"
Created attachment 161817 [details]
KCrash Report
If the 1157th line of the file kdevelop/plugins/clang/duchain/builder.cpp in your KDevelop version is the following: decl->setBitWidth(clang_getFieldDeclBitWidth(cursor)); then this crash duplicates Bug 438249. In the comments to that bug report you can find what kind of code causes the crash (value dependent bit width, e.g. ` size_type length : (sizeof(size_type)*CHAR_BIT - 1);`), a workaround patch for KDevelop and a libclang fix. The fix is available in Clang 17, but you can ask your distro maintainers to patch an older version of Clang in the repository (the patch should apply cleanly to older Clang versions). As for the original wxWidgets bug report, KDevelop shouldn't crash even if command-line arguments in the project configuration are incorrect. So if the backtrace was different, you can attach it to this bug as well. I upgraded to Ubuntu 23.04 and installed KDevelop from apt, now it is working |
Created attachment 161765 [details] main.cpp with #include wx.h and CMakeLists.txt with wxWidgets package configured Have wxWidgets installed. ``` $ wx-config --cxxflags --libs -I/usr/lib/wx/include/gtk3-unicode-3.2 -I/usr/include/wx-3.2 -DWXUSINGDLL -D__WXGTK3__ -D__WXGTK__ -pthread -pthread -lwx_gtk3u_xrc-3.2 -lwx_gtk3u_html-3.2 -lwx_gtk3u_qa-3.2 -lwx_gtk3u_core-3.2 -lwx_baseu_xml-3.2 -lwx_baseu_net-3.2 -lwx_baseu-3.2 ``` Create a new project from template "Terminal" (hello world with cmake). Add to main.cpp the widgets header ``` #include <wx/wx.h> ``` Add wxWidgets package to the CMakeLists.txt ``` find_package(wxWidgets REQUIRED) include(${wxWidgets_USE_FILE}) ``` Saving CMakeLists.txt trigger KDevelop to start cmake reconfiguration and during the "Background parser", KDevelop crashes. If one removes the `#include`, the reconfiguration does not crash, but adding it back and reconfiguring will crash. If one has the `#include`, but not the `find_package()` and reconfigures, KDevelop does not crash. Only when both are present is that KDevelop crashes, and only during auto-reconfigure (the crash happens during the "Background parser"). It also crashes if the CMakeLists.txt uses `wx-config`, but as before, only if there is `#include` in the code. ``` # wx-config-qt or wx-config execute_process(COMMAND wx-config-qt --cxxflags RESULT_VARIABLE CMD_RES OUTPUT_VARIABLE wx_CFLAGS ERROR_VARIABLE ERR_VAR OUTPUT_STRIP_TRAILING_WHITESPACE) separate_arguments(wx_CFLAGS) message("wx_CFLAGS ${wx_CFLAGS}") # wx-config-qt or wx-config execute_process(COMMAND wx-config-qt --libs RESULT_VARIABLE CMD_RES OUTPUT_VARIABLE wx_LIBS ERROR_VARIABLE ERR_VAR OUTPUT_STRIP_TRAILING_WHITESPACE) message("wx_LIBS ${wx_LIBS}") target_compile_options(${PROJECT_NAME} PUBLIC ${wx_CFLAGS}) target_link_libraries(${PROJECT_NAME} ${wx_LIBS}) ``` Tested on Ubuntu and Biglinux (Manjaro). Tested with wxWidgets-qt and wxWidgets-gtk3. ``` $ wx-config-qt --cxxflags --libs -I/usr/lib/wx/include/qt-unicode-3.2 -I/usr/include/wx-3.2 -DWXUSINGDLL -D__WXQT__ -DQT_CORE_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_TESTLIB_LIB -DQT_CORE_LIB -pthread -pthread -lwx_qtu_xrc-3.2 -lwx_qtu_html-3.2 -lwx_qtu_qa-3.2 -lwx_qtu_core-3.2 -lwx_baseu_xml-3.2 -lwx_baseu_net-3.2 -lwx_baseu-3.2 ``` Building from the command line it compiles fine.