Home » Community » U++ community news and announcements » 2022.3rc5
Re: 2022.3rc5 [message #59568 is a reply to message #59567] |
Tue, 07 February 2023 00:16   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
Oblivion wrote on Mon, 06 February 2023 23:34Hello Mirek,
It didn't work but I've got a more detailed error -instead of plain nullptr- by using clang_parseTranslationUnit2() function, which returns an enum, defined in CxErrorCode.h):
/**
* An AST deserialization error has occurred.
*/
CXError_ASTReadError = 4
I'll dig deeper, but if this gives you any hints, please let me know.
Best regards,
Oblivion
https://groups.google.com/g/llvm-dev/c/Jh0bUJz7PHw?pli=1
Based on this, maybe you could try to pass the filename instead of "nullptr" in the call and remove it from commandline? Not the same error, but could be related.
|
|
|
Re: 2022.3rc5 [message #59576 is a reply to message #59568] |
Wed, 08 February 2023 17:55   |
Oblivion
Messages: 1204 Registered: August 2007
|
Senior Contributor |
|
|
Hello Mirek,
I've stripped the code, and wrote the below test:
struct Clang {
CXIndex index = nullptr;
CXTranslationUnit tu = nullptr;
Clang()
{
MemoryIgnoreLeaksBlock __;
index = clang_createIndex(0, 0);
}
void Parse()
{
Vector<const char*> args = {
"-std=c++14",
"-xc++",
"-I/usr/include/llvm",
"-I/usr/include/c++",
"-I/usr/include/c++/12.2.1",
"-I/usr/include/c++/12.2.1/x86_64-pc-linux-gnu",
"-I/usr/include/c++/12.2.1/backward",
"-I/usr/lib/clang/15.0.7/include",
"-I/usr/include"
"-I/usr/local/include",
};
tu = clang_parseTranslationUnit(
index,
"/home/user/test.cpp",
args,
args.GetCount(),
nullptr,
0,
CXTranslationUnit_None
);
}
~Clang()
{
MemoryIgnoreLeaksBlock __;
if(tu) clang_disposeTranslationUnit(tu);
clang_disposeIndex(index);
}
CONSOLE_APP_MAIN
{
StdLogSetup(LOG_COUT);
Clang().Parse();
}
This works. clang_parseTranslationUnit() returns a translation unit handle every single time. (And the handle can be successfully used to traverse the AST.
However, the same code applied to TheIDE's Clang::Parse() method, with hard coded paths as is above,
clang_parseTranslationUnit() still fails to return a translation unit every single time.
I've tried both dynamic loading and static linking (LCLANG), tested both the above code & TheIDe on Linux 6.1.9/Clang 14 & 15
At this point I am almost sure that this is not a user-side problem, because I have installed vanilla ArchLinux on both a real hardware and on a VM (on windows machine), yet I get the same failure... Could this be a process env issue? Any ideas?
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Wed, 08 February 2023 17:57] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
Re: 2022.3rc5 [message #59594 is a reply to message #59593] |
Fri, 10 February 2023 23:44   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
Oblivion wrote on Fri, 10 February 2023 21:45Quote:Tried something like putting something like this at the start of theide GUI_APP_MAIN?
GUI_APP_MAIN {
#ifdef PLATFORM_POSIX
SetEnv("LC_TYPE", "en_US.UTF8")
#endif
I've already tried this, but it doesn't work. Also, after thinking about it, I am not sure this is a good idea. LC_CTYPE variable should be set by OS user, not by TheIDE. (Unless there is a clang specific config option to set). In the meantime I'll use the desktop file to set it for TheIDE...
Best regards,
Oblivion
U++ does not care about LC_TYPE, so does not TheIDE. If anything, TheIDE needs it en_us utf8...
Global constructor then (INITBLOCK) then?
Mirek
|
|
|
|
|
|
Goto Forum:
Current Time: Tue Apr 29 05:47:47 CEST 2025
Total time taken to generate the page: 0.03788 seconds
|