matusnovak / doxybook2

Doxygen XML to Markdown (or JSON)

Home Page:https://matusnovak.github.io/doxybook2/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception at Renderer.cpp

amirmasoudabdol opened this issue · comments

I'm seeing this issue on macOS 11.0 (Intel). I saw a related closed issue, but that didn't help. I'm using vcpkg 2020.06.15-unknownhash, installed using Homebrew.

Rendering...
Parsing docs/xml/namespacefmt.xml
Rendering ../SAMdd/docs/doxygen/Namespaces/namespacefmt.md
Exception at Renderer.cpp:329 Render template 'kind_nonclass' error [json.exception.type_error.305] cannot use operator[] with a string argument with number

Update: I have tried to compile one of the examples, and got the same error. I'm using mkdocs-material config.

Here is the list of packages installed:

argagg:x64-osx                                     0.4.6            A simple C++11 command line argument parser
catch2:x64-osx                                     2.13.1           A modern, header-only test framework for unit te...
dirent:x64-osx                                     1.23.2           Dirent is a C/C++ programming interface that all...
fmt:x64-osx                                        7.1.0            Formatting library for C++. It can be used as a ...
inja:x64-osx                                       3.0.0            Inja - A Template Engine for Modern C++
nlohmann-json:x64-osx                              3.9.1            JSON for Modern C++
rang:x64-osx                                       3.1.0            Colors for your Terminal.

and here is CMake output, I believe everything is linked correctly

cmake -B ./build -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/doxybook2/1.2.3 \
    -DCMAKE_BUILD_TYPE=MinSizeRel \
    -DCMAKE_TOOLCHAIN_FILE=/usr/local/Cellar/vcpkg/2020.11-1/libexec/scripts/buildsystems/vcpkg.cmake
    ..
-- The C compiler identification is AppleClang 12.0.0.12000032
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found nlohmann_json: /usr/local/Cellar/vcpkg/2020.11-1/libexec/installed/x64-osx/share/nlohmann_json/nlohmann_jsonConfig.cmake (found version "3.9.1")
-- Found Rang: /usr/local/Cellar/vcpkg/2020.11-1/libexec/installed/x64-osx/include
-- Found ArgAgg: /usr/local/Cellar/vcpkg/2020.11-1/libexec/installed/x64-osx/include
-- Setting Doxybook version to: v1.2.3
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/amabdol/Downloads/doxybook2/build

Hi @amirmasoudabdol

This seems to be somehow related to a combination of new versions of inja and nlohmann-json. I will have a closer look over the weekend.

Just to be sure, could you send me your XML files, and your command line arguments, that you have used to get that error?

Thanks!

Hi @matusnovak, thanks for looking into this!

I cannot really share my XML files, but as I said I couldn't even generate docs from the example project. If it was necessary, I'll try to strip some of mine down, and share them then. But for now, here is the command line I used:

doxybook2/example/mkdocs-material on  master via 🐍 v2.7.16
❯ doxybook2 --input ../doxygen/xml --output docs

@amirmasoudabdol

It's a bug in the inja dependency, version 3.0.0. It's the following bug: pantor/inja#164

The good news is that it has been fixed in 3.1.0 here: https://github.com/pantor/inja/releases/tag/v3.1.0 but the latest vcpkg still has the outdated version 3.0.0

So, to fix this, either install the inja package with the --head option, or download the 3.1.0 release source and replace the vcpkg/installed/x64-osx/include/inja with the contents of inja-3.1.0.zip -> /inja-3.1.0/include/inja.

Once you do that, the error is gone.

Alternatively, reset the vcpkg to an older version. This is how I do it on GitHub actions to build the releases: https://github.com/matusnovak/doxybook2/blob/master/.github/workflows/build.yml#L58-L65

Thanks! Copying the updated inja to the installed packages folder fixed the problem.

PS. I didn't manage to install inja using --head. I think there is some dependency issue with nlohmann-json that vcpkg was nagging about.

Yeah, there seems to be an issue with inja 3.1.0 in which it tries to install include/nlohmann/json.hpp file, but it already exists. Vcpkg prevents it from overwriting it.

It's the following bug: pantor/inja#175

Once that is solved and vcpkg updated then installing with --head will be working.

In the meantime, manually replacing the header files is the only option.

The problem with installing inja via --head and getting an error due to nlohmann-json has been solved in here: pantor/inja#177

So the solution to this issue is to install inja via vcpkg install inja --head. At the time of writing this comment, vcpkg has not been updated with the latest version of inja, so the --head option during installation is needed.

I have also added this into the "Known problems" section in the Readme.