Working on the CppSharp port and during the parsing of one of the include files I get this error:
Generating bindings for Common (CSharp)
Error parsing 'AnonTypes.h, AnotherUnit.h, CSharp.h, CSharpTemplates.h'
/boot/system/develop/headers/c++/mutex(823,10): error : thread-local storage is not supported for the current target [/boot/home/workspace/dotnet/CppSharp/tests/dotnet/CSharp/CSharp.Gen.csproj]
Now a bit of context, CppSharp generates the bindings for C# out of the definition available in the provided headers. It uses a custom build of LLVM (specifically from this commit.
To summarize, it uses LLVM to parse the C++ headers, build an AST and generate the C# binding out of it.
This is a vanilla LLVM (well, more properly a subset of it) without any Haiku related patches applied.
It seems that it does not support TLS and when it parses one of the headers above it fails to parse mutex here:
/// @cond undocumented
# ifdef _GLIBCXX_HAVE_TLS
// If TLS is available use thread-local state for the type-erased callable
// that is being run by std::call_once in the current thread.
extern __thread void* __once_callable;
extern __thread void (*__once_call)();
_GLIBCXX_HAVE_TLS
is defined in c++/x86_64-unknown-haiku/bits/c++config.h and I can’t undefine it of course.
I had a look at the LLVM patchset for v17 on haikuports including the preview for v18 here.
As a side note, I don’t see the TLS patch in the v18 patchset. Is this intentional? @davidkaroly @korli
Coming back to CppSharp, I also applied this specific patch and recompiled LLVM (well, let CppSharp do it) but nothing changes, I get the very same error.
I hope I gave enough info to help me. Am I missing something on the LLVM side?
Is there a way to override the definition of _GLIBCXX_HAVE_TLS?