ModernCppStarter icon indicating copy to clipboard operation
ModernCppStarter copied to clipboard

`cmake --build build/docs --target GenerateDocs` not working

Open mscofield0 opened this issue 3 years ago • 17 comments

Happens on both Ubuntu WSL and Windows:

cmake --build build/docs --target GenerateDocs
[0/2] Re-checking globbed directories...
[1/1] cd /mnt/c/Users/u26i76/Projects/ModernCppStarterOrig...26i76/Projects/ModernCppStarterOriginal/build/docs/doxygen
FAILED: CMakeFiles/GenerateDocs
cd .../build/docs && /usr/bin/cmake -E make_directory .../build/docs/doxygen && .../.cache/CPM/m.css/ce3daea984872362c3a8ed1c3d8956adbc400a88/documentation/doxygen.py .../build/docs/conf.py && echo Docs\ written\ to:\ .../build/docs/doxygen
Warning: libgs not found
Traceback (most recent call last):
  File ".../.cache/CPM/m.css/ce3daea984872362c3a8ed1c3d8956adbc400a88/documentation/doxygen.py", line 3857, in <module>
    subprocess.run(["doxygen", doxyfile], cwd=os.path.dirname(doxyfile), check=True)
  File "/usr/lib/python3.8/subprocess.py", line 489, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'doxygen'
ninja: build stopped: subcommand failed.

mscofield0 avatar May 07 '21 12:05 mscofield0

Do you have the dependencies Doxygen, jinja2 and Pygments installed on your system? Check out the documentation workflow to see an example how to setup the dependencies on a Mac.

TheLartians avatar May 08 '21 18:05 TheLartians

I do have those installed, yes.

mscofield0 avatar May 10 '21 07:05 mscofield0

I am having the same problem.

When running cmake --build build/doc --target GenerateDocs, I get the following:

Traceback (most recent call last):
  File "/home/host/user/MyProject/build/doc/_deps/m.css-src/documentation/doxygen.py", line 47, in <module>
    from jinja2 import Environment, FileSystemLoader
ModuleNotFoundError: No module named 'jinja2'
CMakeFiles/GenerateDocs.dir/build.make:70: recipe for target 'CMakeFiles/GenerateDocs' failed
make[3]: *** [CMakeFiles/GenerateDocs] Error 1
CMakeFiles/Makefile2:149: recipe for target 'CMakeFiles/GenerateDocs.dir/all' failed
make[2]: *** [CMakeFiles/GenerateDocs.dir/all] Error 2
CMakeFiles/Makefile2:156: recipe for target 'CMakeFiles/GenerateDocs.dir/rule' failed
make[1]: *** [CMakeFiles/GenerateDocs.dir/rule] Error 2
Makefile:170: recipe for target 'GenerateDocs' failed
make: *** [GenerateDocs] Error 2

However, if I manually launch python from the command line and run

from jinja2 import Environment, FileSystemLoader

I don't get any error.

giacomo-b avatar Aug 30 '21 16:08 giacomo-b

Anyone else has the same error? I tried on multiple machines (and OS) with no luck.

giacomo-b avatar Sep 29 '21 14:09 giacomo-b

@giacomo-b could you run pip install jinja2 pygments and see if the error persists? (maybe also pip3 install ... etc depending on the system configuration)

TheLartians avatar Oct 02 '21 16:10 TheLartians

Hey @TheLartians thank you for replying. I tried, still no luck though:

$ pip install jinja2 pygments
...
Successfully installed MarkupSafe-1.1.1 jinja2-2.11.3 pygments-2.5.2
$ cmake -S documentation -B build/doc
...
-- Build files have been written to: /PATH/build/doc
$ cmake --build build/doc --target GenerateDocs
Traceback (most recent call last):
  File "/PATH/build/doc/_deps/m.css-src/documentation/doxygen.py", line 3859, in <module>
    run(state, templates=os.path.abspath(args.templates), wildcard=args.wildcard, index_pages=args.index_pages, search_merge_subtrees=not args.search_no_subtree_merging, search_add_lookahead_barriers=not args.search_no_lookahead_barriers, search_merge_prefixes=not args.search_no_prefix_merging)
  File "/PATH/build/doc/_deps/m.css-src/documentation/doxygen.py", line 3688, in run
    extract_metadata(state, file)
  File "/PATH/build/doc/_deps/m.css-src/documentation/doxygen.py", line 2195, in extract_metadata
    if compounddef.attrib['kind'] not in ['namespace', 'group', 'class', 'struct', 'union', 'dir', 'file', 'page']:
AttributeError: 'NoneType' object has no attribute 'attrib'
CMakeFiles/GenerateDocs.dir/build.make:70: recipe for target 'CMakeFiles/GenerateDocs' failed
make[3]: *** [CMakeFiles/GenerateDocs] Error 1
CMakeFiles/Makefile2:113: recipe for target 'CMakeFiles/GenerateDocs.dir/all' failed
make[2]: *** [CMakeFiles/GenerateDocs.dir/all] Error 2
CMakeFiles/Makefile2:120: recipe for target 'CMakeFiles/GenerateDocs.dir/rule' failed
make[1]: *** [CMakeFiles/GenerateDocs.dir/rule] Error 2
Makefile:170: recipe for target 'GenerateDocs' failed
make: *** [GenerateDocs] Error 2

giacomo-b avatar Oct 04 '21 22:10 giacomo-b

Could you please check which python version is used:

bash-3.2$ pip --version
pip 21.2.4 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)

bash-3.2$ python2
WARNING: Python 2.7 is not recommended. 
This version is included in macOS for compatibility with legacy software. 
Future versions of macOS will not include Python 2.7. 
Instead, it is recommended that you transition to using 'python3' from within Terminal.

Python 2.7.16 (default, Aug 30 2021, 14:43:11) 
[GCC Apple LLVM 12.0.5 (clang-1205.0.19.59.6) [+internal-os, ptrauth-isa=deploy on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from jinja2 import Environment, FileSystemLoader
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named jinja2
>>> 

ClausKlein avatar Oct 05 '21 05:10 ClausKlein

Hey @TheLartians thank you for replying. I tried, still no luck though:

$ pip install jinja2 pygments
...
Successfully installed MarkupSafe-1.1.1 jinja2-2.11.3 pygments-2.5.2
$ cmake -S documentation -B build/doc
...
-- Build files have been written to: /PATH/build/doc
$ cmake --build build/doc --target GenerateDocs
# ...
make: *** [GenerateDocs] Error 2

oops! I got the same error, but note the warning:

bash-3.2$ pwd
/Users/clausklein/Workspace/cpp/ModernCppStarter
bash-3.2$ cmake --build build/doc --target GenerateDocs
Warning: libgs not found
warning: ignoring unsupported tag 'M_SHOW_UNDOCUMENTED' at line 31, file /Users/clausklein/Workspace/cpp/ModernCppStarter/build/doc/Doxyfile
Doxygen version used: 1.9.2
Searching for include files...
# ...

And it is not possible for me to install libgs:

Collecting libgs
  Using cached libgs-1.1.tar.gz (270 kB)
  Using cached libgs-0.11.tar.gz (272 kB)
ERROR: Cannot install libgs==0.11, libgs==1.1 and libgs==1.2.1 because these package versions have conflicting dependencies.

The conflict is caused by:
    libgs 1.2.1 depends on pandas==0.21.0
    libgs 1.1 depends on pandas==0.21.0
    libgs 0.11 depends on pandas==0.21.0

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies
bash-3.2$ 

ClausKlein avatar Oct 05 '21 05:10 ClausKlein

I'm also having issues with generating documentation. When I run the GenerateDocs target, the doxygen.py file that is referenced in CMake (COMMAND "${m.css_SOURCE_DIR}/documentation/doxygen.py") is simply opened in my default text editor.

I'm using Python 3.8 and also have jinja2 and pygments installed:

PS D:\Repositories> python
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from jinja2 import *
>>> from pygments import *

Update

After further investigation, it seems I'm running into the same issue as @ClausKlein. I upgraded to python 3.10 and re-installed jinja2 and pygments. I then ran the following command manually:

python.exe D:\Repositories\thread-pool\out\build\x64-Release\_deps\m.css-src\documentation\doxygen.py .\conf.py

I then get the following output:

Warning: libgs not found
warning: ignoring unsupported tag 'M_SHOW_UNDOCUMENTED' at line 31, file D:\Repositories\thread-pool\out\build\x64-Release\documentation\Doxyfile
Doxygen version used: 1.9.2 (caa4e3de211fbbef2c3adf58a6bd4c86d0eb7cb8)
// omitted for brevity
D:/Repositories/thread-pool/README.md:83: warning: unable to resolve reference to 'D:/Repositories/thread-pool/CONTRIBUTING.md' for \ref command
D:/Repositories/thread-pool/README.md:91: warning: Illegal command @DeveloperPaul123 as part of a <a>..</a> block
Running plantuml with JAVA...
lookup cache used 62/65536 hits=142 misses=62
finished...
Traceback (most recent call last):
  File "D:\Repositories\thread-pool\out\build\x64-Release\_deps\m.css-src\documentation\doxygen.py", line 3859, in <module>
    run(state, templates=os.path.abspath(args.templates), wildcard=args.wildcard, index_pages=args.index_pages, search_merge_subtrees=not args.search_no_subtree_merging, search_add_lookahead_barriers=not args.search_no_lookahead_barriers, search_merge_prefixes=not args.search_no_prefix_merging)
  File "D:\Repositories\thread-pool\out\build\x64-Release\_deps\m.css-src\documentation\doxygen.py", line 3688, in run
    extract_metadata(state, file)
  File "D:\Repositories\thread-pool\out\build\x64-Release\_deps\m.css-src\documentation\doxygen.py", line 2195, in extract_metadata
    if compounddef.attrib['kind'] not in ['namespace', 'group', 'class', 'struct', 'union', 'dir', 'file', 'page']:
AttributeError: 'NoneType' object has no attribute 'attrib'

I too run into issues when trying to install libgs.

Collecting libgs
  Using cached libgs-1.1.tar.gz (270 kB)
  Preparing metadata (setup.py) ... done
  Using cached libgs-0.11.tar.gz (272 kB)
  Preparing metadata (setup.py) ... done
ERROR: Cannot install libgs==0.11, libgs==1.1 and libgs==1.2.1 because these package versions have conflicting dependencies.

The conflict is caused by:
    libgs 1.2.1 depends on pandas==0.21.0
    libgs 1.1 depends on pandas==0.21.0
    libgs 0.11 depends on pandas==0.21.0

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies

DeveloperPaul123 avatar Oct 29 '21 14:10 DeveloperPaul123

Hm that's strange, it could be that there is some conflict with different versions of python packages installed. Maybe you could try installing the dependencies in a virtual environment?

TheLartians avatar Oct 31 '21 12:10 TheLartians

Possibly, but I stopped pursuing this and instead used an alternative doxygen theme.

DeveloperPaul123 avatar Nov 01 '21 12:11 DeveloperPaul123

I get exactly the same error. Has anyone been able to solve it?

Python 3.10.2 pip 20.3.4

jinja2 and pygments are installed

noctera avatar Feb 22 '22 18:02 noctera

I found a fix: It looks like m.css in documentation/CMakeLists.txt needs to be updated to the latest commit hash like below:

CPMAddPackage("gh:mosra/m.css#42d4a9a48f31f5df6e246c948403b54b50574a2a")

to:

CPMAddPackage("gh:mosra/m.css#a0d292ec311b97fefd21e93cdefb60f88d19ede6")

bongani-m avatar Mar 24 '22 10:03 bongani-m

Has this issue now been resolved?

DeveloperPaul123 avatar Oct 24 '22 13:10 DeveloperPaul123

I found a fix: It looks like m.css in documentation/CMakeLists.txt needs to be updated to the latest commit hash like below:

CPMAddPackage("gh:mosra/m.css#42d4a9a48f31f5df6e246c948403b54b50574a2a")

to:

CPMAddPackage("gh:mosra/m.css#a0d292ec311b97fefd21e93cdefb60f88d19ede6")

Mine is already the same, fresh install

cmake_minimum_required(VERSION 3.14...3.22)

project(GreeterDocs)

# ---- Dependencies ----

include(../cmake/CPM.cmake)

CPMAddPackage("gh:mosra/m.css#a0d292ec311b97fefd21e93cdefb60f88d19ede6")
CPMAddPackage(NAME Greeter SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/..)

Getting the same error as everyone else. Latest pip, python 3.9 etc.

bsodmike avatar Nov 16 '22 13:11 bsodmike

I would prefer to only use stable tags for used packages.

ClausKlein avatar Nov 17 '22 17:11 ClausKlein