|
|
Home » Developing U++ » U++ Developers corner » theide with libclang
|
|
Re: theide with libclang [message #58972 is a reply to message #58969] |
Mon, 03 October 2022 11:30   |
Tom1
Messages: 1303 Registered: March 2007
|
Ultimate Contributor |
|
|
mirek wrote on Mon, 03 October 2022 11:34Tom1 wrote on Mon, 03 October 2022 10:05Mirek,
I installed and had success with libclang-11! It does not crash with LCLANG flag.
* /home/tom/out/uppsrc/CLANG.Blitz.Gui.Lclang.Shared/ide 03.10.2022 11:02:44, user: tom
11:02:44:268 INFO GuiMainFn_(): Version: 16466 (64 bit) (wchar32) (CLANG) (C++14) (Gtk) Compiled: 10/03/2022 10:55:02
Without the flag it goes with libclang-14 and crashes:
* /home/tom/out/uppsrc/CLANG.Blitz.Gui.Shared/ide 03.10.2022 10:59:52, user: tom
10:59:52:892 INFO libclang path:/usr/lib/llvm-14/lib/libclang.so
10:59:52:893 INFO GuiMainFn_(): Version: 16466 (64 bit) (wchar32) (CLANG) (C++14) (Gtk) Compiled: 10/03/2022 10:59:10
****************** PANIC: Invalid memory access!
Best regards,
Tom
Can you try to LCLANG with libclang-14? (by changing build method paths)
Anyway, if this is holds true, it would be both great and sort of bad - there will be a lot of work fixing install process for clang, even maybe ide/Builders. Hopefully the community will help with that...
Mirek
Yes, this was my first test today and it failed. That's why I decided to try libclang-11 in the first place.
BR,
Tom
|
|
|
Re: theide with libclang [message #58973 is a reply to message #58971] |
Mon, 03 October 2022 11:35   |
Tom1
Messages: 1303 Registered: March 2007
|
Ultimate Contributor |
|
|
[quote title=mirek wrote on Mon, 03 October 2022 11:48]Tom1 wrote on Mon, 03 October 2022 10:05Mirek,
I installed and had success with libclang-11! It does not crash with LCLANG flag.
* /home/tom/out/uppsrc/CLANG.Blitz.Gui.Lclang.Shared/ide 03.10.2022 11:02:44, user: tom
11:02:44:268 INFO GuiMainFn_(): Version: 16466 (64 bit) (wchar32) (CLANG) (C++14) (Gtk) Compiled: 10/03/2022 10:55:02
What about dynamically loaded libclang-11?
Mirek
Yes, libclang-11 works without crash when loading dynamically as well:
* /home/tom/out/uppsrc/CLANG.Blitz.Gui.Shared/ide 03.10.2022 12:33:52, user: tom
12:33:52:324 INFO libclang path:/usr/lib/llvm-11/lib/libclang.so
12:33:52:324 INFO GuiMainFn_(): Version: 16466 (64 bit) (wchar32) (CLANG) (C++14) (Gtk) Compiled: 10/03/2022 10:59:10
BR,
Tom
|
|
|
Re: theide with libclang [message #58974 is a reply to message #58973] |
Mon, 03 October 2022 11:45   |
Tom1
Messages: 1303 Registered: March 2007
|
Ultimate Contributor |
|
|
Mirek,
Further on: libclang-11, libclang-12 and libclang-13 do not crash when loading dynamically. It's just libclang-14 that crashes here.
BR,
Tom
|
|
|
|
Re: theide with libclang [message #58978 is a reply to message #58970] |
Mon, 03 October 2022 15:51   |
Lance
Messages: 656 Registered: March 2007
|
Contributor |
|
|
mirek wrote on Mon, 03 October 2022 04:37Lance wrote on Mon, 03 October 2022 00:58
I was able to do some screen shots of supposed calling stack, hopefully it means something to you.
You do not need to do it this way (if you are debugging with theide): There is a menu item in Debug that copies backtrace of all threads to clipboard.
Mirek
I see. Thanks.
----------------------------------
Thread: 1
futex_wait (private=0, expected=2, futex_word=0x555556869ca8 <Upp::sHeapLock2+8>) at ../sysdeps/nptl/futex-internal.h:146
./nptl/lowlevellock.c:49
----------------------------------
Thread: 2
../sysdeps/unix/sysv/linux/poll.c:29
----------------------------------
Thread: 3
../sysdeps/unix/sysv/linux/poll.c:29
----------------------------------
Thread: 4
./nptl/futex-internal.c:57
./nptl/futex-internal.c:87
./nptl/futex-internal.c:139
----------------------------------
Thread: 5
./nptl/futex-internal.c:57
./nptl/futex-internal.c:87
./nptl/futex-internal.c:139
----------------------------------
Thread: 6
./nptl/futex-internal.c:57
./nptl/futex-internal.c:87
./nptl/futex-internal.c:139
----------------------------------
Thread: 7
./nptl/futex-internal.c:57
./nptl/futex-internal.c:87
./nptl/futex-internal.c:139
----------------------------------
Thread: 8
./nptl/futex-internal.c:57
./nptl/futex-internal.c:87
./nptl/futex-internal.c:139
----------------------------------
Thread: 9
./nptl/futex-internal.c:57
./nptl/futex-internal.c:87
./nptl/futex-internal.c:139
----------------------------------
Thread: 10
./nptl/futex-internal.c:57
./nptl/futex-internal.c:87
./nptl/futex-internal.c:139
----------------------------------
Thread: 11
./nptl/futex-internal.c:57
./nptl/futex-internal.c:87
./nptl/futex-internal.c:139
----------------------------------
Thread: 12
./nptl/futex-internal.c:57
./nptl/futex-internal.c:87
./nptl/futex-internal.c:139
----------------------------------
Thread: 13
./nptl/futex-internal.c:57
./nptl/futex-internal.c:87
./nptl/futex-internal.c:139
----------------------------------
Thread: 15
syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
----------------------------------
Thread: 17
../sysdeps/unix/sysv/linux/poll.c:29
----------------------------------
Thread: 18
./nptl/futex-internal.c:57
./nptl/futex-internal.c:87
./nptl/futex-internal.c:139
----------------------------------
Thread: 19
./nptl/futex-internal.c:57
./nptl/futex-internal.c:87
./nptl/futex-internal.c:139
----------------------------------
Thread: 20
/lib/x86_64-linux-gnu/libclang-14.so.13
----------------------------------
Thread: 21
futex_wait (private=0, expected=2, futex_word=0x555556869ca8 <Upp::sHeapLock2+8>) at ../sysdeps/nptl/futex-internal.h:146
./nptl/lowlevellock.c:49
----------------------------------
Thread: 22
Upp::BlkHeap<Upp::HugeHeapDetail, 4096>::DbgFreeFill (p=<error reading variable: Cannot access memory at address 0x7fffc5fed1b8>, size=<error reading variable: Cannot access memory at address 0x7fffc5fed1b0>) at /home/lance/upp.src/uppsrc/Core/HeapImp.h:93
----------------------------------
Thread: 23
./nptl/futex-internal.c:57
./nptl/futex-internal.c:87
./nptl/futex-internal.c:139
----------------------------------
Thread: 24
./nptl/futex-internal.c:57
./nptl/futex-internal.c:87
./nptl/futex-internal.c:139
----------------------------------
Thread: 25
futex_wait (private=0, expected=2, futex_word=0x5555568d01d8 <Upp::sGLock+8>) at ../sysdeps/nptl/futex-internal.h:146
./nptl/lowlevellock.c:49
----------------------------------
Thread: 29
futex_wait (private=0, expected=2, futex_word=0x555556869ca8 <Upp::sHeapLock2+8>) at ../sysdeps/nptl/futex-internal.h:146
./nptl/lowlevellock.c:49
----------------------------------
Thread: 31
futex_wait (private=0, expected=2, futex_word=0x555556869ca8 <Upp::sHeapLock2+8>) at ../sysdeps/nptl/futex-internal.h:146
./nptl/lowlevellock.c:49
----------------------------------
Thread: 32
futex_wait (private=0, expected=2, futex_word=0x555556869ca8 <Upp::sHeapLock2+8>) at ../sysdeps/nptl/futex-internal.h:146
./nptl/lowlevellock.c:49
|
|
|
Re: theide with libclang [message #58979 is a reply to message #58978] |
Mon, 03 October 2022 23:20   |
 |
Klugier
Messages: 1099 Registered: September 2012 Location: Poland, Kraków
|
Senior Contributor |
|
|
Hello,
I just installed Ubuntu 22.04.01 (LTS) and I managed to reproduce the problem. After opening project, the crash happen after 4-5 seconds of running indexer. Thanks to --noclang option I managed to build TheIDE under debug mode. Here is the screenshot from the crash and callstack:

It seems that it crashes when calling clang_getCursorPrettyPrinted in ClangCursorInfo::RawId() method:
force_inline
String ClangCursorInfo::RawId()
{
if(!hasraw_id) {
raw_id = FetchString(clang_getCursorPrettyPrinted(cursor, pp_id)); // Last call in TheIDE code base before crash...
hasraw_id = true;
}
return raw_id;
}
-----
I have 14.0.0-1ubuntu1, on Manajaro I have 14.0.6 and there is no crash.
-----
Once change the line to:
raw_id = FetchString(clang_getCursorPrettyPrinted(cursor, nullptr));
Fixed the problem, however I am not sure what is this code doing, so there is a chance that it will break something...
Klugier
U++ - one framework to rule them all.
[Updated on: Mon, 03 October 2022 23:50] Report message to a moderator
|
|
|
|
Re: theide with libclang [message #58993 is a reply to message #58992] |
Sat, 08 October 2022 21:29   |
Lance
Messages: 656 Registered: March 2007
|
Contributor |
|
|
Mirek:
No more crashes after the line is commented out. I have tested with both llvm-14 and llvm-15.
For some reason, neither llvm-14 nor llvm-15 generate some symlinks that should be in exist for ide to properly load libclang dynamically.
I have
and
but not
Also, I believe I also need to manually create
sudo ln -s /usr/lib/llvm-15/lib/libclang.so.1 /usr/lib/llvm-15/lib/libclang.so
As we cannot control how llvm installation creates symlinks, for smoother user experience, should we alter the detecting logic to accommodate this situation?
Regards,
Lance
BTW, the speed when built in release mode is quite good.
[Updated on: Sat, 08 October 2022 21:57] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
Re: theide with libclang [message #59070 is a reply to message #59023] |
Wed, 26 October 2022 16:00   |
Lance
Messages: 656 Registered: March 2007
|
Contributor |
|
|
Not sure if this problem is unique to me: on Ubuntu 22.10+UPP.16512 (and some other recent versions),
"Find..." function cannot be used. Ctrl+F, type in string to search, won't work.
Another problem. Add new help topic will crash TheIDE. For a test,
* open "examples/AddressBook", navigate to "AddressBook.cpp" if not already in it.
* In the class "AddressBook", click any member variable or function to add cocumentation [a cyan square to the left of the function/variable line];
* in the popup menu, choose "New reference topic"
* in the "New Topic" dialog, in the Template field, change it to "Reference-en_us (in uppsrc)"
* Click "OK" button
The ide crash with invalid memory access.
I am sorry. I know Mirek has been tirelessly working on integrating libclang to theide. Not criticizing, not meaning to distract, just trying to bring awareness.
|
|
|
Re: theide with libclang [message #59071 is a reply to message #59070] |
Wed, 26 October 2022 22:07   |
 |
mirek
Messages: 14257 Registered: November 2005
|
Ultimate Member |
|
|
Lance wrote on Wed, 26 October 2022 16:00Not sure if this problem is unique to me: on Ubuntu 22.10+UPP.16512 (and some other recent versions),
"Find..." function cannot be used. Ctrl+F, type in string to search, won't work.
Another problem. Add new help topic will crash TheIDE. For a test,
* open "examples/AddressBook", navigate to "AddressBook.cpp" if not already in it.
* In the class "AddressBook", click any member variable or function to add cocumentation [a cyan square to the left of the function/variable line];
* in the popup menu, choose "New reference topic"
* in the "New Topic" dialog, in the Template field, change it to "Reference-en_us (in uppsrc)"
* Click "OK" button
The ide crash with invalid memory access.
I am sorry. I know Mirek has been tirelessly working on integrating libclang to theide. Not criticizing, not meaning to distract, just trying to bring awareness.
Bug reports are always welcome!
|
|
|
|
Goto Forum:
Current Time: Sat May 10 11:33:59 CEST 2025
Total time taken to generate the page: 0.07891 seconds
|
|
|