Subject: bug#24069: [PATCH] Re: bug#24069: gcc man page is broken

From: Maxim Cournoyer <[email-masked]>
Date: Sun, 01 Oct 2017 09:39:36 -0400

Hello,

Maxim Cournoyer <[email-masked]> writes:

> "Branson, Joshua A" <[email-masked]> writes:
>
>> I can confirm that this bug still exists.  The man page is broken as described, but info gcc works just fine.
>>
>> Thanks,
>>
>> Joshua
>
> The problem is likely caused by lack of the lack of perl as well as pod2man, as
> suggested by gcc's build log:
>
> echo timestamp > gcc.pod
> perl ../../gcc-7.2.0/gcc/../contrib/texi2pod.pl ../../gcc-7.2.0/gcc/doc/invoke.texi > gcc.pod
> /gnu/store/kpxi8h3669afr9r1bgvaf9ij3y4wdyyn-bash-minimal-4.4.12/bin/bash: perl: command not found
> make[2]: [Makefile:3257: gcc.pod] Error 127 (ignored)
> echo timestamp > doc/gcc.1
> (pod2man --center="GNU" --release="gcc-7.2.0" --date=2017-08-14 --section=1 gcc.pod > doc/gcc.1.T$$ && \
> 	mv -f doc/gcc.1.T$$ doc/gcc.1) || \
> 	(rm -f doc/gcc.1.T$$ && exit 1)
> /gnu/store/kpxi8h3669afr9r1bgvaf9ij3y4wdyyn-bash-minimal-4.4.12/bin/bash: pod2man: command not found
> make[2]: [Makefile:3235: doc/gcc.1] Error 1 (ignored)
>
> I'm currently rebuilding with those two inputs added, will send a patch
> if it fixes the problem.

I believe the attached patch *should* fix it (simply adds perl as a native
input; pod2man apparently comes with perl itself):

>From 17105632d2142c16632c5f05490a7da9a4439cc4 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <[email-masked]>
Date: Sun, 1 Oct 2017 09:27:31 -0400
Subject: [PATCH] gnu: gcc: Fix manual pages.

Fixes bug #24069.

* gnu/packages/gcc.scm (gcc-4.7)[native-inputs]: Add perl.
(gcc-4.9)[native-inputs]: Likewise.
---
 gnu/packages/gcc.scm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 7870d4513..f56c2a0b9 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -42,6 +42,7 @@
   #:use-module (guix build-system trivial)
   #:use-module (guix utils)
   #:use-module (srfi srfi-1)
+  #:use-module (ice-9 match)
   #:use-module (ice-9 regex))
 
 (define %gcc-infrastructure
@@ -155,7 +156,8 @@ where the OS part is overloaded to denote a specific ABI---into GCC
 
       ;; GCC < 5 is one of the few packages that doesn't ship .info files.
       ;; Newer texinfos fail to build the manual, so we use an older one.
-      (native-inputs `(("texinfo" ,texinfo-5)))
+      (native-inputs `(("perl" ,perl)   ;for manpages
+                       ("texinfo" ,texinfo-5)))
 
       (arguments
        `(#:out-of-source? #t
@@ -370,7 +372,9 @@ Go.  It also includes runtime support libraries for these languages.")
                 "14l06m7nvcvb0igkbip58x59w3nq6315k6jcz3wr9ch1rn9d44bc"))
               (patches (search-patches "gcc-arm-bug-71399.patch"
                                        "gcc-libvtv-runpath.patch"))))
-    (native-inputs `(("texinfo" ,texinfo)))))
+    ;; Override inherited texinfo-5 with latest version.
+    (native-inputs `(("perl" ,perl)   ;for manpages
+                     ("texinfo" ,texinfo)))))
 
 (define-public gcc-5
   ;; Note: GCC >= 5 ships with .info files but 'make install' fails to install
-- 
2.14.1

I haven't been able to test it though; when attempting to rebuild gcc, I
get a stack overflow before the build process even starts (seems like a
guix problem -- I'll try to git pull & rebuild):

--8<---------------cut here---------------start------------->8---
./pre-inst-env guix build -K gcc
allocate_stack failed: Cannot allocate memory
Warning: Unwind-only `stack-overflow' exception; skipping pre-unwind handler.
allocate_stack failed: Cannot allocate memory
Warning: Unwind-only `stack-overflow' exception; skipping pre-unwind handler.
allocate_stack failed: Cannot allocate memory
Warning: Unwind-only `stack-overflow' exception; skipping pre-unwind handler.
allocate_stack failed: Cannot allocate memory
Warning: Unwind-only `stack-overflow' exception; skipping pre-unwind handler.
--8<---------------cut here---------------end--------------->8---

Maxim