[C++] Clang Parsing - STL Headers

Discuss how to use DoxyPress
Post Reply
rgufwkcwrixbliscgi
Posts: 2
Joined: Thu Oct 22 2020 3:56 pm

[C++] Clang Parsing - STL Headers

Post by rgufwkcwrixbliscgi »

Hi,

I'm trying to use DoxyPress to generate documentation for a local project. But for some reason when I activate Clang Parsing I keep getting erros like these:

fatal error: 'map' file not found
fatal error: 'string' file not found
fatal error: 'chrono' file not found

From stl include headers. My options I configured like these:

{
"clang": {
"clang-compilation-path": "C:/folder_where_compile_commands.json_is_located",
"clang-dialect": "-std=c++17",
"clang-flags": [
""
],
"clang-parsing": true,
"clang-use-headers": true
},

removed extra settings for readability

}

Any ideas? Thanks for the help!

barbara
Posts: 201
Joined: Sat Apr 04 2015 2:32 am

Re: [C++] Clang Parsing - STL Headers

Post by barbara »

Can you let us know the following information:

1) What platform are you running on
2) If you are using Windows are you using MSVC or MinGW
3) Did you use a prebuilt version of DoxyPress or build from source
4) What version of DoxyPress are you using

This error is indicating the C++ standard library headers can not be found on your system. You specified that a previously created compilation database should be used. Did you generate one? You may want to open the compilation database and see where it is looking for the C++ headers.

You also checked the box to "use supplied headers" but you did not supply them. You should either use the compilation database or the clang flags, not both. Try un-checking the "use supplied headers" and see if that makes a difference.

Barbara

rgufwkcwrixbliscgi
Posts: 2
Joined: Thu Oct 22 2020 3:56 pm

Re: [C++] Clang Parsing - STL Headers

Post by rgufwkcwrixbliscgi »

Hi,

Thanks for the reply. Here's the extra info:

- Running on windows with MSVC (but using clang-cl to compile the project)
- I'm using a prebuild version from DoxyPress 1.4.0

I generated the compilation database by adding the following line to my CMakeLists.txt:

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

Here's a snipet of the file contents:

{
"directory": "C:/folder/build/x64-Release",
"command": "C:\\PROGRA~1\\LLVM\\bin\\clang-cl.exe /nologo -TP -IC:\\folder\\common -IC:\\folder\\util -m64 -fdiagnostics-absolute-paths /DWIN32 /D_WINDOWS /W4 /GR /EHsc /MD /O2 /Ob2 /DNDEBUG /bigobj -std:c++17 /FoCMakeFiles\\folder.dir\\common\\base.cpp.obj /FdTARGET_COMPILE_PDB -c C:\\folder\\base.cpp",
"file": "C:\\folder.cpp"
},

I doesn't indicate where to locate the c++ headers on it.
From the help I thought the "Use supplied headers" meant DoxyPress would use it's internal include folder to process the C++ headers. Anyways I tried with compilation path empty, uncheck "Use supplied headers" and setting clang flags - didn't work. Tried with compillation flag filled, "Use supplied headers" unchecked and clang flags. Also didn't work.
I downloaded libcxxx-11.0.0.src and set it as clang flags (-Ic:/libcxx-11.0.0.src/include) and I got this error:

Reading C:/Extras/Research/TennisProject/git/tenisapp/VideoDetection/pre/caffeengine.cpp
Error: C:/Users/LP/Downloads/libcxx-11.0.0.src/include\cstddef:44:15: fatal error: 'stddef.h' file not found

In file included from C:\folder\file.cpp:2:
In file included from C:/libcxx-11.0.0.src/include\filesystem:233:
C:/libcxx-11.0.0.src/include\cstddef:44:15: fatal error: 'stddef.h' file not found
#include_next <stddef.h>
^~~~~~~~~~

** DoxyPress aborted

Any suggestions?
Thanks!

barbara
Posts: 201
Joined: Sat Apr 04 2015 2:32 am

Re: [C++] Clang Parsing - STL Headers

Post by barbara »

Sorry about the delay in responding.

Code: Select all

- Running on windows with MSVC (but using clang-cl to compile the project)
- I'm using a prebuild version from DoxyPress 1.4.0
Windows has some odd support for clang and the vendor is very much aware of the issues. The problem is how to located the C++ Standard library files and it turns out this is not as simple as people anticipated. We have actually spoken to some of the key developers at Google. Please keep in mind this is not something we can correct in DoxyPress. We are making the right calls into clang and path searching is just too hard on some systems.

The best approach and the one I use on Windows is to hard set the path. We have documented this information for a MinGW standard library. Please have a look here: https://www.copperspice.com/docs/doxypress/parsing.html

Code: Select all

// windows 64 bit
-Ic:/MinGW_64_7.3/lib/gcc/x86_64-w64-mingw32/7.3.0/include//c++/x86_64-w64-mingw32/
-Ic:/MinGW_64_7.3/lib/gcc/x86_64-w64-mingw32/7.3.0/include/c++/
From the help I thought the "Use supplied headers" meant DoxyPress would use it's internal include folder to process the C++ headers.
The "internal include folder" are headers for clang 10, not the C++ standard library. There is no C++ standard library shipped with DoxyPress. We would have no idea what version to install and if we did, it could conflict with your compiler.

When you check the "use supplied headers" you also need to add the clang flags. These are the normal flags passed when compiling directly with clang. The problem you have encountered is MSVC specific. We are in the process right now of talking with key developers at Microsoft since they may have a potential issue. Thankfully we have some relationship with the company as we are part of their testing suite.
libcxxx-11.0.0.src
Installing this source only gave you a C++ standard library, not a C standard library. Both are actually needed. The missing 'stddef.h' is a C file that the C++ standard library needs to include. As an alternative I would suggest installing MinGW. We have a link to the files used in our CI.

https://www.copperspice.com/documentation-mingw.html

Thanks for your patience while we work this out.

Barbara

ansel
Posts: 99
Joined: Fri Apr 10 2015 8:23 am

Re: [C++] Clang Parsing - STL Headers

Post by ansel »

We have verified that everything works correctly on Linux, as well as Windows using MinGW. We have been able to reproduce this behavior if you are using MSVC. We have contacted the Microsoft compiler team for assistance in this matter, but their current suggestions have not worked. We still have some other avenues to pursue, thanks for your patience.
Ansel Sermersheim
CopperSpice Cofounder

Post Reply