breathe-doc / breathe

ReStructuredText and Sphinx bridge to Doxygen
https://breathe-doc.org
Other
751 stars 198 forks source link

Exception in get_display_string while running sphinx-build #537

Open johnmcfarlane opened 4 years ago

johnmcfarlane commented 4 years ago

Describe the bug I'm trying to convert a project from Doxygen to Doxygen/Breathe/Sphinx and cannot get past an exception being thrown on invocation of sphinx-build:

AttributeError: 'str' object has no attribute 'get_display_string'

No other information is given although there are numerous warnings related to parsing of C++ code and apparent confusion over files from different directories with the same filename:

Running Sphinx v3.0.4
loading translations [en]... done
making output directory... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 581 source files that are out of date
updating environment: [new config] 581 added, 0 changed, 0 removed
/tmp/repro/build/source/file/__impl_2duplex__integer_2rounding_8h.rst:4: WARNING: doxygenfile: Found multiple matches for file "rounding.h                                                                         
/tmp/repro/build/source/file/__impl_2elastic__integer_2limits_8h.rst:4: WARNING: doxygenfile: Found multiple matches for file "limits.h
/tmp/repro/build/source/file/__impl_2num__traits_2rounding_8h.rst:4: WARNING: doxygenfile: Found multiple matches for file "rounding.h
/tmp/repro/build/source/file/__impl_2number_2rounding_8h.rst:4: WARNING: doxygenfile: Found multiple matches for file "rounding.h
/tmp/repro/build/source/file/__impl_2rounding_8h.rst:4: WARNING: doxygenfile: Found multiple matches for file "rounding.h
/tmp/repro/build/source/file/__impl_2scaled__integer_2fraction_8h.rst:4: WARNING: doxygenfile: Found multiple matches for file "fraction.h
/tmp/repro/build/source/file/__impl_2scaled__integer_2math_8h.rst:4: WARNING: doxygenfile: Found multiple matches for file "math.h
/tmp/repro/build/source/file/__impl_2scaled__integer_2num__traits_8h.rst:4: WARNING: doxygenfile: Found multiple matches for file "num_traits.h
/tmp/repro/build/source/file/__impl_2static__integer_8h.rst:4: WARNING: doxygenfile: Found multiple matches for file "static_integer.h
/tmp/repro/build/source/file/adopt__digits_8h.rst:4: WARNING: Duplicate declaration, cnl
/tmp/repro/build/source/file/adopt__signedness_8h.rst:4: WARNING: Duplicate declaration, cnl
/tmp/repro/build/source/file/adopt__width_8h.rst:4: WARNING: Duplicate declaration, cnl
/tmp/repro/build/source/file/assert__same_8h.rst:4: WARNING: Duplicate declaration, cnl
/tmp/repro/build/source/file/bit_8h.rst:4: WARNING: Duplicate declaration, cnl
/tmp/repro/build/source/file/boost_8multiprecision_8h.rst:4: WARNING: Invalid C++ declaration: Expected end of definition. [error at 114]
  constexpr auto operator() (_bmp::number< _bmp::cpp_int_backend< NumBits, NumBits, SignType >> const &input) const -> decltype(input.backend())
  ------------------------------------------------------------------------------------------------------------------^

Exception occurred:
  File "/home/john/.local/lib/python3.8/site-packages/sphinx/util/cfamily.py", line 111, in <lambda>
    return self._stringify(lambda ast: ast.get_display_string())
AttributeError: 'str' object has no attribute 'get_display_string'

To Reproduce Steps to reproduce the behavior on Ubuntu 20.04:

$ git clone https://github.com/johnmcfarlane/cnl.git -b sphinx-repro
$ mkdir build && cd build
$ ../cnl/doc/generate.sh

You can see the output in a CI job here.

Expected behavior I'm still at the exploratory phase where I require Sphinx to generate HTML for all of the code in my project. I'd expect to find a file, gh-pages/index.html, which contains links to the APIs in my library. It's hard to say how I'll achieve that until I can get output for all of those APIs.

Your project Project: CNL

Screenshots N/A

Environment info

Additional context When run locally, here's the traceback for the sphinx-build command. And here is the full output including the doxygen and breathe-apidoc commands as well.

I think that it should be possible to reproduce the error without invoking breathe-apidoc but it's not entirely clear what is causing the exception: there are several warnings.

jakobandersen commented 4 years ago

As posted in the Sphinx issue, the actual crash is because of Sphinx. The duplicate filenames I guess is Breathe-related. The trailing return types should be working in the upcoming Sphinx v3.1.

johnmcfarlane commented 4 years ago

After removing the ,<3.1 from line 18 of setup.py, I was able to get past the reported error. The next fatal error (following the same repro steps) is:

breathe.file_state_cache.MTimeError: Cannot find file: /home/john/ws/revision/generate/xml/cpp/types/add_cv.xml

This is caused by a tag file which pulls in a large number of references to external pages. Here is the new traceback.

LMK if I should open a new Sphinx issue. Thanks!