Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/index.php/Reporting_Bug_Guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#49448 - [doxygen] add -Duse-libclang:BOOL=ON to libclang parsing for C++ projects

Attached to Project: Arch Linux
Opened by Antoine Poliakov (antoinep92) - Monday, 23 May 2016, 14:29 GMT
Last edited by Eli Schwartz (eschwartz) - Friday, 27 July 2018, 16:55 GMT
Task Type Feature Request
Category Packages: Extra
Status Assigned
Assigned To Dan McGee (toofishes)
Levente Polyak (anthraxx)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 7
Private No

Details

Description:
Doxygen's C++ parser is fast but not always correct, especially for complex (heavy template usage) or modern (C++14/17) codes. For this purpose, there is an alternative parser based on LLVM's C++ parser used in the clang compiler, libclang. Because of the dependency on libclang, this option is optional on build.

Could you please consider adding it by:
- adding 'clang' as a dependency to doxygen
- appending '-Duse_libclang:BOOL=ON' to cmake arguments

I know this adds a heavy dependency, but the parsing quality for C++ code is really better with this.

By the way, I noticed 2 minor unrelated issues in the PKGBUILD (probably not worth a specific bugreport):

(1) the current CMake invocation includes '-DQT_QMAKE_EXECUTABLE:FILE=/usr/lib/qt4/bin/qmake' which seems to be obsolete:
CMake Warning:
Manually-specified variables were not used by the project:
QT_QMAKE_EXECUTABLE
=> I think this line can be removed

(2) the dev-dependencies include flex which is already in base-devel, so I think it's not necessary (but does no harm).

Additional info:
* package version(s): 1.8.11-4
* config and/or log files etc.


Steps to reproduce:
set CLANG_ASSISTED_PARSING=yes in a Doxyfile and run doxygen yields:
warning: Tag `CLANG_ASSISTED_PARSING' at line ---- of file `Doxyfile' belongs to an option that was not enabled at compile time.
This task depends upon

Comment by Nick Stone (NickStone8) - Saturday, 30 June 2018, 12:28 GMT
Enabling Doxygen's use of the clang parser would be an enormous benefit. I have tried building Doxygen from source with the Duse_libclang:BOOL=ON option but have never succeeded (despite spending many hours trying to sort the issues). If this could be sorted out by an experienced "builder" I would be extremely grateful.
Comment by loqs (loqs) - Saturday, 30 June 2018, 13:06 GMT
@NickStone8 change line 238 of src/CMakeLists.txt from ( https://github.com/CastXML/CastXML/issues/102#issuecomment-396061989 )
set(CLANG_LIBS libclang clangTooling ${llvm_libs})
to
set(CLANG_LIBS libclang clangTooling LLVM)
add to the make_depends 'clang' 'llvm' and the mentioned option to cmake
Comment by Nick Stone (NickStone8) - Thursday, 05 July 2018, 18:26 GMT
Thank you very much @loqs; I now have a build of Doxygen that supports the “CLANG_ASSISTED_PARSING” option. For the benefit of others, I will add the following notes.

• The “llvm” package must be installed.

• There are 14 “CMakeLists.txt” files in the Doxygen source directory. As “loqs” pointed out, the one to modify is in the /src subdirectory. The change to be made is as described by “loqs”; however the relevant line number is no longer at 238. A search for
“set(CLANG_LIBS libclang clangTooling ${llvm_libs})” will find the correct line to modify.

• Once that change has been made, the instructions to build that worked for me are:
cd <doxygenSourceCodeDirectory>
mkdir build
cd build
cmake -Duse_libclang=ON -G "Unix Makefiles" ..
make
sudo make install
Comment by Eli Schwartz (eschwartz) - Friday, 27 July 2018, 16:55 GMT
adding new maintainer to assignees in the hope that someone more active these days can resolve it :)
Comment by Jakub Klinkovský (lahwaacz) - Friday, 21 May 2021, 08:44 GMT
Until clang is enabled in the main package, I've created an AUR package for this: https://aur.archlinux.org/packages/doxygen-clang/

There is just one gotcha when using the clang parser. Besides enabling CLANG_ASSISTED_PARSING [1] you also need to configure -resource-dir via CLANG_OPTIONS [2], as I found in [3]. The correct path can be found by running "clang -print-resource-dir":

CLANG_OPTIONS = -resource-dir=/usr/lib/clang/11.1.0

[1] https://www.doxygen.nl/manual/config.html#cfg_clang_assisted_parsing
[2] https://www.doxygen.nl/manual/config.html#cfg_clang_options
[3] https://github.com/googleapis/google-cloud-cpp/commit/765e427e07eb53e726d25066e2b65f4b17911b99

Loading...