Skip to content

Help: Fails to install man files generated by sphinx 4.0.x

When trying to build cmake-3.20.2 from source I encountered a problem during installation, man files couldn't be found.

It turns out that sphinx 4.0.x changes behaviour where to put generated man files. previously it puts them directly in ${CMAKE_BINARY_DIR}/Utilities/Sphinx/man/*.${number} but now it puts them in ${CMAKE_BINARY_DIR}/Utilities/Sphinx/man/${number}/*.${number}

This is a proposed patch

--- cmake-3.20.2/Utilities/Sphinx/conf.py.in.orig	2021-05-14 06:58:07.532703600 +0100
+++ cmake-3.20.2/Utilities/Sphinx/conf.py.in	2021-05-14 06:58:14.226149200 +0100
@@ -53,6 +53,7 @@
     except Exception as e:
         sys.stderr.write("ERROR: %s\n" % str(e))
 man_show_urls = False
+man_make_section_directory = False
 
 html_show_sourcelink = True
 html_static_path = ['@conf_path@/static']

To keep the old behaviour, or

--- cmake-3.20.2/Utilities/Sphinx/CMakeLists.txt.orig	2021-05-14 05:44:51.912981600 +0100
+++ cmake-3.20.2/Utilities/Sphinx/CMakeLists.txt	2021-05-14 05:45:16.414656200 +0100
@@ -186,7 +186,7 @@
       endif()
       if(NOT skip)
         CMake_OPTIONAL_COMPONENT(sphinx-man)
-        install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/${name}.${sec}
+        install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/${sec}/${name}.${sec}
                 DESTINATION ${CMAKE_MAN_DIR}/man${sec}
                 ${COMPONENT})
       endif()

To adapt to the new behavior. or both (man_make_section_directory = True + adjusting path)

Edited by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information