Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 906784 - dev-lang/ghc-9.0.2-r4[doc]: fails to compile with dev-python/sphinx-6.0.0? (UndefinedError("'style' is undefined"))
Summary: dev-lang/ghc-9.0.2-r4[doc]: fails to compile with dev-python/sphinx-6.0.0? (U...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Haskell Language team
URL:
Whiteboard:
Keywords: PATCH, PullRequest
Depends on:
Blocks:
 
Reported: 2023-05-19 14:52 UTC by Andrew Cameron
Modified: 2023-10-14 00:47 UTC (History)
12 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
pqv log (pqv.txt,211 bytes, text/plain)
2023-05-19 14:57 UTC, Andrew Cameron
Details
Info log (info.txt,7.66 KB, text/plain)
2023-05-19 14:57 UTC, Andrew Cameron
Details
Environment (environment,178.00 KB, text/plain)
2023-05-19 14:58 UTC, Andrew Cameron
Details
ebuild build log (build.log.gz,335.14 KB, application/gzip)
2023-05-19 15:07 UTC, Andrew Cameron
Details
patch for building with sphinx-7 (ghc-9.0.2-sphinx-7.patch,597 bytes, patch)
2023-08-05 11:30 UTC, alfwue
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Cameron 2023-05-19 14:52:43 UTC
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [  0%] 9.0.1-notes                                           
Theme error:
An error happened in rendering the page 9.0.1-notes.
Reason: UndefinedError("'style' is undefined")
"inplace/bin/ghc-stage1" -hisuf dyn_hi -osuf  dyn_o -hcsuf dyn_hc -fPIC -dynamic  -H32m -O -optc-mabi=lp64d -opta-mabi=lp64d -optc-march=rv64imafdc_zba_zbb -opta-march=rv64imafdc_zba_zbb -optc-mcpu=sifive-u74 -opta-mcpu=sifive-u74 -optc-mtune=sifive-7-series -opta-mtune=sifive-7-series -optl-Wl,-O1 -optl-Wl,--as-needed -Wall     -hide-all-packages -package-env - -i -iutils/hpc/. -iutils/hpc/dist-install/build -Iutils/hpc/dist-install/build -iutils/hpc/dist-install/build/hpc/autogen -Iutils/hpc/dist-install/build/hpc/autogen     -optP-include -optPutils/hpc/dist-install/build/hpc/autogen/cabal_macros.h -package-id array-0.5.4.0 -package-id base-4.15.1.0 -package-id containers-0.6.4.1 -package-id directory-1.3.6.2 -package-id filepath-1.4.2.1 -package-id hpc-0.6.1.0 -XHaskell2010  -no-user-package-db -rtsopts      -Wnoncanonical-monad-instances  -outputdir utils/hpc/dist-install/build   -c utils/hpc/./HpcParser.hs -o utils/hpc/dist-install/build/HpcParser.dyn_o 
"inplace/bin/ghc-stage1" -hisuf dyn_hi -osuf  dyn_o -hcsuf dyn_hc -fPIC -dynamic  -H32m -O -optc-mabi=lp64d -opta-mabi=lp64d -optc-march=rv64imafdc_zba_zbb -opta-march=rv64imafdc_zba_zbb -optc-mcpu=sifive-u74 -opta-mcpu=sifive-u74 -optc-mtune=sifive-7-series -opta-mtune=sifive-7-series -optl-Wl,-O1 -optl-Wl,--as-needed -Wall     -hide-all-packages -package-env - -i -iutils/hpc/. -iutils/hpc/dist-install/build -Iutils/hpc/dist-install/build -iutils/hpc/dist-install/build/hpc/autogen -Iutils/hpc/dist-install/build/hpc/autogen     -optP-include -optPutils/hpc/dist-install/build/hpc/autogen/cabal_macros.h -package-id array-0.5.4.0 -package-id base-4.15.1.0 -package-id containers-0.6.4.1 -package-id directory-1.3.6.2 -package-id filepath-1.4.2.1 -package-id hpc-0.6.1.0 -XHaskell2010  -no-user-package-db -rtsopts      -Wnoncanonical-monad-instances  -outputdir utils/hpc/dist-install/build   -c utils/hpc/./HpcDraft.hs -o utils/hpc/dist-install/build/HpcDraft.dyn_o 
make[1]: *** [docs/users_guide/ghc.mk:16: docs/users_guide/build-html/users_guide/index.html] Error 2
make[1]: *** Waiting for unfinished jobs....
done
build succeeded, 19 warnings.

The manual pages are in docs/users_guide/build-man.
make: *** [Makefile:128: all] Error 2
 * ERROR: dev-lang/ghc-9.0.2-r4::gentoo failed (compile phase):
 *   emake failed
Comment 1 Andrew Cameron 2023-05-19 14:57:03 UTC
Created attachment 862006 [details]
pqv log
Comment 2 Andrew Cameron 2023-05-19 14:57:42 UTC
Created attachment 862007 [details]
Info log
Comment 3 Andrew Cameron 2023-05-19 14:58:37 UTC
Created attachment 862008 [details]
Environment
Comment 4 Andrew Cameron 2023-05-19 15:07:43 UTC
Created attachment 862010 [details]
ebuild build log
Comment 5 Kobboi 2023-05-22 13:40:50 UTC
Same here, but only with USE=doc, so you can set USE=-doc for a temporary workaround.
Comment 6 Andrew Cameron 2023-05-23 08:54:15 UTC
Thanks It compiled with -doc but that still needs to be fixed
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-05-30 23:33:40 UTC
(In reply to Andrew Cameron from comment #6)
> Thanks It compiled with -doc but that still needs to be fixed

Yes, obviously.
Comment 8 alfwue 2023-08-04 10:34:58 UTC
Maybe this is a solution:
https://github.com/readthedocs/sphinx_rtd_theme/issues/1465
Here someone describes how he fixed it for an other project. Actual fix was
https://paste.xinu.at/JfsPm/

For ghc this would be:
cd ghc-9.0.2
find . -name layout.html |while read i ; do sed -i 's/style\, 1/styles[-1], 1/g' $i ; done

Corresponding diff:
--- a/docs/users_guide/rtd-theme/layout.html	2021-07-06 11:42:06.000000000 +0200
+++ b/docs/users_guide/rtd-theme/layout.html	2023-08-03 19:27:51.863465637 +0200
@@ -64,7 +64,7 @@
   {%- endif %}
 
   {# CSS #}
-  <link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" />
+  <link rel="stylesheet" href="{{ pathto('_static/' + styles[-1], 1) }}" type="text/css" />
   <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" />
   {%- for css in css_files %}
     {%- if css|attr("rel") %}
Comment 9 alfwue 2023-08-05 11:30:41 UTC
Created attachment 867142 [details, diff]
patch for building with sphinx-7

I just followed https://wiki.gentoo.org/wiki/Creating_a_patch to create a patch.
To verify that this is a fix for you:
ebuild /var/db/repos/gentoo/dev-lang/ghc/ghc-9.0.2-r4.ebuild clean unpack
cd /var/tmp/portage/dev-lang/ghc-9.0.2-r4/work/ghc-9.0.2
patch -p1 </tmp/ghc-9.0.2-sphinx-7.patch
cd
ebuild /var/db/repos/gentoo/dev-lang/ghc/ghc-9.0.2-r4.ebuild prepare configure compile

If it is a fix, the the last line should be
>>> Source compiled.
Comment 10 François Valenduc 2023-08-05 13:10:41 UTC
This patch indeed fix the problem, but it is much easier if you use user patches (https://wiki.gentoo.org/wiki//etc/portage/patches) to apply it. You can then use emerge to install the package as usual.
Comment 11 alfwue 2023-08-05 15:15:17 UTC
Thanks for the tip with user patches.
Comment 12 Larry the Git Cow gentoo-dev 2023-10-14 00:47:47 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d53d537ffcafbf92c3d364db95427303ecf6aed1

commit d53d537ffcafbf92c3d364db95427303ecf6aed1
Author:     hololeap <hololeap@protonmail.com>
AuthorDate: 2023-10-08 19:56:47 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-10-14 00:47:05 +0000

    dev-lang/ghc: Use system sphinx-rtd-theme
    
    This allows sphinx-7 to build the GHC user's guide
    
    The upstream rtd-theme that is bundled with GHC has been updated but
    none of our GHC versions contain this fix.
    
    See: https://gitlab.haskell.org/ghc/ghc/-/commit/70526f5bd8886126f49833ef20604a2c6477780a
    Closes: https://bugs.gentoo.org/906784
    Signed-off-by: hololeap <hololeap@protonmail.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-lang/ghc/ghc-9.0.2-r4.ebuild | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f6cdfe59ec13e0d30a22750ebbdd97e7693ab2b5

commit f6cdfe59ec13e0d30a22750ebbdd97e7693ab2b5
Author:     hololeap <hololeap@protonmail.com>
AuthorDate: 2023-10-03 05:03:54 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-10-14 00:46:55 +0000

    dev-lang/ghc: Turn USE=doc off by default
    
    This flag has been turned on by default historically, but has been
    causing problems due to compatibility issues with newer sphinx.
    
    Other packages in dev-lang do not have USE=doc turned on by default.
    
    Bug: https://bugs.gentoo.org/906784
    Signed-off-by: hololeap <hololeap@protonmail.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-lang/ghc/ghc-8.10.6-r3.ebuild | 2 +-
 dev-lang/ghc/ghc-9.0.2-r3.ebuild  | 2 +-
 dev-lang/ghc/ghc-9.0.2-r4.ebuild  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)