Skip to contentSkip to conversation

Kernel build failed ...SPHINX extension error

DISCUSSION Bhaskar Chowdhury 4 participants 8 messages Apr 8, 2020 – Aug 12, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hey Jon,

What might caused it ...please take a peek ..

Apr 08 16:48:40 Running Sphinx v3.0.0
Apr 08 16:48:41   CC      arch/x86/events/intel/p6.o
Apr 08 16:48:41   CC      kernel/sched/completion.o
Apr 08 16:48:41   CC      kernel/power/snapshot.o
Apr 08 16:48:42   CC      arch/x86/events/intel/pt.o
Apr 08 16:48:42   CC      kernel/sched/cpupri.o
Apr 08 16:48:43   CC      kernel/power/swap.o
Apr 08 16:48:43   CC [M]  arch/x86/events/intel/rapl.o
Apr 08 16:48:43   CC      kernel/sched/cpudeadline.o
Apr 08 16:48:44   CC [M]  arch/x86/events/intel/uncore.o
Apr 08 16:48:44   CC      kernel/sched/topology.o
Apr 08 16:48:44   CC      kernel/power/user.o
Apr 08 16:48:45   CC      kernel/power/autosleep.o
Apr 08 16:48:45   CC      kernel/power/wakelock.o
Apr 08 16:48:46   CC [M]  arch/x86/events/intel/uncore_nhmex.o
Apr 08 16:48:46   CC      kernel/sched/stop_task.o

Extension error:
Could not import extension cdomain (exception: cannot import name 'c_funcptr_sig_re' from 'sphinx.domains.c' (/usr/lib/python3.8/site-packages/sphinx/domains/c.py))

Apr 08 16:48:46 enabling CJK for LaTeX builder
Apr 08 16:48:46   CC      kernel/power/poweroff.o

make[1]: *** [Documentation/Makefile:81: htmldocs] Error 2
make: *** [Makefile:1549: htmldocs] Error 2
make: *** Waiting for unfinished jobs....

and the build aborted due to this ...

~Bhaskar

maintainer
#1 lore raw
Quoted 9 lines · On Wed, 8 Apr 2020 17:07:05 +0530 Bhaskar Chowdhury <[email protected]>…

Extension error:
Could not import extension cdomain (exception: cannot import name 'c_funcptr_sig_re' from 'sphinx.domains.c' (/usr/lib/python3.8/site-packages/sphinx/domains/c.py))

Apr 08 16:48:46 enabling CJK for LaTeX builder
Apr 08 16:48:46   CC      kernel/power/poweroff.o

make[1]: *** [Documentation/Makefile:81: htmldocs] Error 2
make: *** [Makefile:1549: htmldocs] Error 2
make: *** Waiting for unfinished jobs....

This is weird, to say the least. But I think the "python3.8" in the message above says everything you need to know. If you're running with an unreleased version of Python, it's not entirely surprising that you might run into trouble with a complex package.

jon

#2 lore raw
Quoted 13 lines · Jonathan Corbet
Quoted 9 lines · On Wed, 8 Apr 2020 17:07:05 +0530 Bhaskar Chowdhury <[email protected]>…

Extension error:
Could not import extension cdomain (exception: cannot import name 'c_funcptr_sig_re' from 'sphinx.domains.c' (/usr/lib/python3.8/site-packages/sphinx/domains/c.py))

Apr 08 16:48:46 enabling CJK for LaTeX builder
Apr 08 16:48:46   CC      kernel/power/poweroff.o

make[1]: *** [Documentation/Makefile:81: htmldocs] Error 2
make: *** [Makefile:1549: htmldocs] Error 2
make: *** Waiting for unfinished jobs....

Quoted 6 lines

This is weird, to say the least. But I think the "python3.8" in the message above says everything you need to know. If you're running with an unreleased version of Python, it's not entirely surprising that you might run into trouble with a complex package.

jon

Thank you Jon...will investigate more and keep your suggestion in mind.

~Bhaskar

#3 lore raw

Documentation: build failure with sphinx >= 3.0.0: exception: cannot import name 'c_funcptr_sig_re' from 'sphinx.domains.c' (was: Re: Kernel build failed ...SPHINX extension error)

Hi

Quoted 14 lines · Bhaskar Chowdhury
Quoted 13 lines · Jonathan Corbet
Quoted 9 lines · On Wed, 8 Apr 2020 17:07:05 +0530 Bhaskar Chowdhury <[email protected]>…

Extension error:
Could not import extension cdomain (exception: cannot import name 'c_funcptr_sig_re' from 'sphinx.domains.c' (/usr/lib/python3.8/site-packages/sphinx/domains/c.py))

Apr 08 16:48:46 enabling CJK for LaTeX builder
Apr 08 16:48:46   CC      kernel/power/poweroff.o

make[1]: *** [Documentation/Makefile:81: htmldocs] Error 2
make: *** [Makefile:1549: htmldocs] Error 2
make: *** Waiting for unfinished jobs....

Quoted 8 lines
Quoted 6 lines

This is weird, to say the least. But I think the "python3.8" in the message above says everything you need to know. If you're running with an unreleased version of Python, it's not entirely surprising that you might run into trouble with a complex package.

jon

Thank you Jon...will investigate more and keep your suggestion in mind.

The problem is actually related to changes happening in Sphinx 3.0.0. There is the followign issue filled upstream:

https://github.com/sphinx-doc/sphinx/issues/7421

'c_funcptr_sig_re' was removed upstream in sphinx v3.0.0b1 and so the kernel documentation build fails. This is reproducible with a recent sphinx version (in attached case it is 3.2.0):

$ make PYTHON=python3 xmldocs
  SPHINX  xmldocs --> file:///home/build/linux/Documentation/output/xml
make[2]: Nothing to be done for 'xml'.
Running Sphinx v3.2.0

Extension error:
Could not import extension cdomain (exception: cannot import name 'c_funcptr_sig_re' from 'sphinx.domains.c' (/usr/lib/python3/dist-packages/sphinx/domains/c.py)) make[1]: *** [Documentation/Makefile:115: xmldocs] Error 2
make: *** [Makefile:1655: xmldocs] Error 2

Distribution reports related to this issue:
https://bugs.debian.org/963636
https://bugs.archlinux.org/task/66178
https://bugs.archlinux.org/task/66156

Regards,
Salvatore

#4 lore raw

Re: Documentation: build failure with sphinx >= 3.0.0: exception: cannot import name 'c_funcptr_sig_re' from 'sphinx.domains.c'

Hi,

Quoted 44 lines · Salvatore Bonaccorso

Hi

Quoted 14 lines · Bhaskar Chowdhury
Quoted 13 lines · Jonathan Corbet
Quoted 9 lines · On Wed, 8 Apr 2020 17:07:05 +0530 Bhaskar Chowdhury <[email protected]>…

Extension error:
Could not import extension cdomain (exception: cannot import name 'c_funcptr_sig_re' from 'sphinx.domains.c' (/usr/lib/python3.8/site-packages/sphinx/domains/c.py))

Apr 08 16:48:46 enabling CJK for LaTeX builder
Apr 08 16:48:46   CC      kernel/power/poweroff.o

make[1]: *** [Documentation/Makefile:81: htmldocs] Error 2
make: *** [Makefile:1549: htmldocs] Error 2
make: *** Waiting for unfinished jobs....

Quoted 8 lines
Quoted 6 lines

This is weird, to say the least. But I think the "python3.8" in the message above says everything you need to know. If you're running with an unreleased version of Python, it's not entirely surprising that you might run into trouble with a complex package.

jon

Thank you Jon...will investigate more and keep your suggestion in mind.

The problem is actually related to changes happening in Sphinx 3.0.0. There is the followign issue filled upstream:

https://github.com/sphinx-doc/sphinx/issues/7421

'c_funcptr_sig_re' was removed upstream in sphinx v3.0.0b1 and so the kernel documentation build fails. This is reproducible with a recent sphinx version (in attached case it is 3.2.0):

$ make PYTHON=python3 xmldocs
  SPHINX  xmldocs --> file:///home/build/linux/Documentation/output/xml
make[2]: Nothing to be done for 'xml'.
Running Sphinx v3.2.0

Extension error:
Could not import extension cdomain (exception: cannot import name 'c_funcptr_sig_re' from 'sphinx.domains.c' (/usr/lib/python3/dist-packages/sphinx/domains/c.py)) make[1]: *** [Documentation/Makefile:115: xmldocs] Error 2
make: *** [Makefile:1655: xmldocs] Error 2

Quoted 4 lines

Distribution reports related to this issue:
https://bugs.debian.org/963636
https://bugs.archlinux.org/task/66178
https://bugs.archlinux.org/task/66156

As a workaround to make the documentation build again (but known that parts of the documentation will be broken), we could drop the cdomain extension.

Regards,
Salvatore

From 9e81028c7e5f8f33f67a768b9c306536fd8e688f Mon Sep 17 00:00:00 2001
From: Salvatore Bonaccorso <[email protected]>
Date: Wed, 12 Aug 2020 09:11:51 +0200
Subject: [PATCH] Documentation: Drop use of 'cdomain' sphinx extension module

'c_funcptr_sig_re' was removed upstream in sphinx v3.0.0b1 and so the kernel documentation build fails sphinx 3.x.

As a (temporary) workaround to make the documentation build, the 'cdomain' sphinx extension can be removed from the Documentation build configuration file, although some parts using the feature will be broken.

https://github.com/sphinx-doc/sphinx/issues/7421 describes the workaround.

---
 Documentation/conf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/conf.py +1 -1
index c503188880d9..b5b2be8eec22 100644
@@ -36,7 +36,7 @@ needs_sphinx = '1.3'
 # Add any Sphinx extension module names here, as strings. They can be
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
 # ones.
-extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'cdomain',
+extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include',
               'kfigure', 'sphinx.ext.ifconfig', 'automarkup',
               'maintainers_include', 'sphinx.ext.autosectionlabel' ]
 
Signature · 1 line
2.28.0
#5 lore raw

Re: Documentation: build failure with sphinx >= 3.0.0: exception: cannot import name 'c_funcptr_sig_re' from 'sphinx.domains.c'

Am 12.08.20 um 09:30 schrieb Salvatore Bonaccorso:
[..]

Quoted 24 lines
Quoted 19 lines

The problem is actually related to changes happening in Sphinx 3.0.0. There is the followign issue filled upstream:

https://github.com/sphinx-doc/sphinx/issues/7421

'c_funcptr_sig_re' was removed upstream in sphinx v3.0.0b1 and so the kernel documentation build fails. This is reproducible with a recent sphinx version (in attached case it is 3.2.0):

$ make PYTHON=python3 xmldocs
   SPHINX  xmldocs --> file:///home/build/linux/Documentation/output/xml
make[2]: Nothing to be done for 'xml'.
Running Sphinx v3.2.0

Extension error:
Could not import extension cdomain (exception: cannot import name 'c_funcptr_sig_re' from 'sphinx.domains.c' (/usr/lib/python3/dist-packages/sphinx/domains/c.py)) make[1]: *** [Documentation/Makefile:115: xmldocs] Error 2
make: *** [Makefile:1655: xmldocs] Error 2

Quoted 4 lines

Distribution reports related to this issue:
https://bugs.debian.org/963636
https://bugs.archlinux.org/task/66178
https://bugs.archlinux.org/task/66156

Quoted 6 lines

As a workaround to make the documentation build again (but known that parts of the documentation will be broken), we could drop the cdomain extension.

Regards,
Salvatore

@jon, do you have time to implement a patch?
.. sorry, I'am in a hurry :o

In the linked github issue you find also a patch that fixes a cdomain.py. I tested the patch (shee below) in the linux kernel.

For me it works.

BTW: The patch of Documentation/sphinx/requirements.txt was only nedded for a test.

-- Markus --

---

Documentation/sphinx/cdomain.py +20 -1
index cbac8e608dc4..65e15d48891e 100644
@@ -31,16 +31,35 @@ u"""
        arguments types of function-like macros.
 
 """
+import re
 
 from docutils import nodes
 from docutils.parsers.rst import directives
 
 import sphinx
 from sphinx import addnodes
-from sphinx.domains.c import c_funcptr_sig_re, c_sig_re
 from sphinx.domains.c import CObject as Base_CObject
 from sphinx.domains.c import CDomain as Base_CDomain
 
+# C&P from commit https://github.com/return42/linuxdoc/commit/48f09de2
+# fixes https://github.com/sphinx-doc/sphinx/commit/0f49e30c51b5cc5055cda5b4b294c2dd9d1df573#r38750737
+
+# pylint: disable=invalid-name
+c_sig_re = re.compile(
+    r'''^([^(]*?)          # return type
+        ([\w:.]+)  \s*     # thing name (colon allowed for C++)
+        (?: \((.*)\) )?    # optionally arguments
+        (\s+const)? $      # const specifier
+    ''', re.VERBOSE)
+
+c_funcptr_sig_re = re.compile(
+    r'''^([^(]+?)          # return type
+        (\( [^()]+ \)) \s* # name in parentheses
+        \( (.*) \)         # arguments
+        (\s+const)? $      # const specifier
+    ''', re.VERBOSE)
+# pylint: enable=invalid-name
+
 __version__  = '1.0'
 
 # Get Sphinx version
Documentation/sphinx/requirements.txt +1 -1
index 489f6626de67..f7486fd7ec85 100644
@@ -1,3 +1,3 @@
 docutils
-Sphinx==2.4.4
+Sphinx==3.2.0
 sphinx_rtd_theme
#6 lore raw

Re: Documentation: build failure with sphinx >= 3.0.0: exception: cannot import name 'c_funcptr_sig_re' from 'sphinx.domains.c'

Am 12.08.20 um 10:21 schrieb Markus Heiser:

Quoted 34 lines

Am 12.08.20 um 09:30 schrieb Salvatore Bonaccorso:
[..]

Quoted 24 lines
Quoted 19 lines

The problem is actually related to changes happening in Sphinx 3.0.0. There is the followign issue filled upstream:

https://github.com/sphinx-doc/sphinx/issues/7421

'c_funcptr_sig_re' was removed upstream in sphinx v3.0.0b1 and so the kernel documentation build fails. This is reproducible with a recent sphinx version (in attached case it is 3.2.0):

$ make PYTHON=python3 xmldocs
   SPHINX  xmldocs --> file:///home/build/linux/Documentation/output/xml
make[2]: Nothing to be done for 'xml'.
Running Sphinx v3.2.0

Extension error:
Could not import extension cdomain (exception: cannot import name 'c_funcptr_sig_re' from 'sphinx.domains.c' (/usr/lib/python3/dist-packages/sphinx/domains/c.py)) make[1]: *** [Documentation/Makefile:115: xmldocs] Error 2
make: *** [Makefile:1655: xmldocs] Error 2

Quoted 4 lines

Distribution reports related to this issue:
https://bugs.debian.org/963636
https://bugs.archlinux.org/task/66178
https://bugs.archlinux.org/task/66156

Quoted 6 lines

As a workaround to make the documentation build again (but known that parts of the documentation will be broken), we could drop the cdomain extension.

Regards,
Salvatore

Quoted 7 lines

@jon, do you have time to implement a patch?
.. sorry, I'am in a hurry :o

In the linked github issue you find also a patch that fixes a cdomain.py.  I tested the patch (shee below) in the linux kernel.

  For me it works.

Sorry, I have to correct:

a Patch needs more work

sphinx-doc has changed the way how domains are implemented [1].

-- Markus --

[1] https://github.com/sphinx-doc/sphinx/commit/0f49e30c

maintainer
#7 lore raw

Re: Documentation: build failure with sphinx >= 3.0.0: exception: cannot import name 'c_funcptr_sig_re' from 'sphinx.domains.c'

In reply to Markus Heiser
Quoted 2 lines · On Wed, 12 Aug 2020 10:21:40 +0200 Markus Heiser <[email protected]>…

@jon, do you have time to implement a patch?
.. sorry, I'am in a hurry :o

This is on my list ... but life is busy at the moment. I would not be distressed if somebody beat me to it.

jon