GNU bug report logs - #25358
Cross Compiling fails because of help2man

Previous Next

Package: sed;

Reported by: Vishal Biswas <vshlbiswas <at> ymail.com>

Date: Wed, 4 Jan 2017 18:10:02 UTC

Severity: normal

Tags: fixed

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25358 in the body.
You can then email your comments to 25358 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-sed <at> gnu.org:
bug#25358; Package sed. (Wed, 04 Jan 2017 18:10:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Vishal Biswas <vshlbiswas <at> ymail.com>:
New bug report received and forwarded. Copy sent to bug-sed <at> gnu.org. (Wed, 04 Jan 2017 18:10:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Vishal Biswas <vshlbiswas <at> ymail.com>
To: bug-sed <at> gnu.org
Subject: Cross Compiling fails because of help2man
Date: Wed, 04 Jan 2017 22:18:31 +0530
[Message part 1 (text/plain, inline)]
GNU sed 4.3 cannot be successfully cross compiled because the Makefile tries to 
run help2man even if cross compiling.

	  GEN      doc/sed.1
	help2man: can't get `--help' info from sed/sed
	make[2]: *** [Makefile:5775: doc/sed.1] Error 126
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-sed <at> gnu.org:
bug#25358; Package sed. (Wed, 04 Jan 2017 23:23:01 GMT) Full text and rfc822 format available.

Message #8 received at 25358 <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Vishal Biswas <vshlbiswas <at> ymail.com>, 25358 <at> debbugs.gnu.org
Subject: Re: bug#25358: Cross Compiling fails because of help2man
Date: Wed, 4 Jan 2017 18:22:51 -0500
Hello Vishal,

On 01/04/2017 11:48 AM, Vishal Biswas wrote:
> GNU sed 4.3 cannot be successfully cross compiled because the Makefile tries to 
> run help2man even if cross compiling.

Thank you for reporting this, it is a bug in the build system.

As a temporary work-around (if one is needed):
first, the cross-copmiled binary is already successfully built when the
help2man error is encountered. Not sure if this is sufficient for you or
not. The binary file is 'sed/sed'.

second,
the 'doc/sed.1' file is already pre-built and included in the
'sed-4.3.tar.xz' file, So running
    touch doc/sed.1 ; make
should 'just work' and complete the build successfully.

> 	  GEN      doc/sed.1
> 	help2man: can't get `--help' info from sed/sed
> 	make[2]: *** [Makefile:5775: doc/sed.1] Error 126

The bug in the build system is that 'doc/sed.1' depends on the binary
'sed/sed', even if 'sed.1' already exists in the tarball and there's no
need to re-generate it.

Jim,
I can think of two ways around this:

1. make 'doc/sed.1' depend on 'sed/sed.c' and 'doc/sed.x' instead
   of the binary 'sed/sed'. The assumption is that if the C
   source hasn't changed, there's no need to update the man page.

2. make the building of 'doc/sed.1' conditional, depending on wether
   it is being built from '.git' (then regenerate it) or from
   a tarball (then it already exists).
   something like:

      AM_CONDITIONAL([BUILD_FROM_GIT], [test -d "$srcdir/.git"])

   and then in 'doc/local.mk':

      if BUILD_FROM_GIT
         doc/sed.1: sed/sed$(EXEEXT) .version $(srcdir)/doc/sed.x
                    ...
      endif



What do you think ?

regards,
 - assaf








Information forwarded to bug-sed <at> gnu.org:
bug#25358; Package sed. (Thu, 05 Jan 2017 16:42:02 GMT) Full text and rfc822 format available.

Message #11 received at 25358 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Assaf Gordon <assafgordon <at> gmail.com>
Cc: Vishal Biswas <vshlbiswas <at> ymail.com>, 25358 <at> debbugs.gnu.org
Subject: Re: bug#25358: Cross Compiling fails because of help2man
Date: Thu, 5 Jan 2017 17:41:24 +0100
On Thu, Jan 5, 2017 at 12:22 AM, Assaf Gordon <assafgordon <at> gmail.com> wrote:
> Hello Vishal,
>
> On 01/04/2017 11:48 AM, Vishal Biswas wrote:
>> GNU sed 4.3 cannot be successfully cross compiled because the Makefile tries to
>> run help2man even if cross compiling.
>
> Thank you for reporting this, it is a bug in the build system.
>
> As a temporary work-around (if one is needed):
> first, the cross-copmiled binary is already successfully built when the
> help2man error is encountered. Not sure if this is sufficient for you or
> not. The binary file is 'sed/sed'.
>
> second,
> the 'doc/sed.1' file is already pre-built and included in the
> 'sed-4.3.tar.xz' file, So running
>     touch doc/sed.1 ; make
> should 'just work' and complete the build successfully.
>
>>         GEN      doc/sed.1
>>       help2man: can't get `--help' info from sed/sed
>>       make[2]: *** [Makefile:5775: doc/sed.1] Error 126
>
> The bug in the build system is that 'doc/sed.1' depends on the binary
> 'sed/sed', even if 'sed.1' already exists in the tarball and there's no
> need to re-generate it.
>
> Jim,
> I can think of two ways around this:
>
> 1. make 'doc/sed.1' depend on 'sed/sed.c' and 'doc/sed.x' instead
>    of the binary 'sed/sed'. The assumption is that if the C
>    source hasn't changed, there's no need to update the man page.

Hi Assaf,
Thanks for investigating.

I'm pretty sure we must retain the dependency, at least when not
cross-compiling. If we were to attempt to remove that dependency, I
believe that would leave a race condition where help2man may attempt
to run the binary before it is built.

> 2. make the building of 'doc/sed.1' conditional, depending on wether
>    it is being built from '.git' (then regenerate it) or from
>    a tarball (then it already exists).
>    something like:
>
>       AM_CONDITIONAL([BUILD_FROM_GIT], [test -d "$srcdir/.git"])
>
>    and then in 'doc/local.mk':
>
>       if BUILD_FROM_GIT
>          doc/sed.1: sed/sed$(EXEEXT) .version $(srcdir)/doc/sed.x
>                     ...
>       endif

Even when building from a tarball, we should leave as many build rules
as we can. How about removing the dependency only when
cross-compiling, e.g., via: `if CROSS_COMPILING ...`. This should have
the advantage of working also when cross-compiling from a git clone'd
working directory.




Information forwarded to bug-sed <at> gnu.org:
bug#25358; Package sed. (Fri, 06 Jan 2017 00:45:02 GMT) Full text and rfc822 format available.

Message #14 received at 25358 <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Jim Meyering <jim <at> meyering.net>
Cc: Vishal Biswas <vshlbiswas <at> ymail.com>, 25358 <at> debbugs.gnu.org
Subject: Re: bug#25358: Cross Compiling fails because of help2man
Date: Thu, 5 Jan 2017 19:44:28 -0500
Hello Jim and all,

> On Jan 5, 2017, at 11:41, Jim Meyering <jim <at> meyering.net> wrote:
> 
>> 1. make 'doc/sed.1' depend on 'sed/sed.c' and 'doc/sed.x' 
> I'm pretty sure we must retain the dependency, at least when not
> cross-compiling. If we were to attempt to remove that dependency, I
> believe that would leave a race condition where help2man may attempt
> to run the binary before it is built.

GNU Make has a good solution for it with its "order-only-prerequisites"
(which ensure proper order but ignore timestamp of the dependency):

 https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html

Too bad it's not portable...

> 
>> 2. make the building of 'doc/sed.1' conditional, depending on wether
>>   it is being built from '.git' (then regenerate it)
> 
> Even when building from a tarball, we should leave as many build rules
> as we can.

We do already distribute 'doc/sed.1' in the tarball, and currently always rebuild it,
I wonder if it's worth making an exception in this case?

For example in coreutils I think man pages are skipped if there's no perl. Doing the same in sed will allow building it on system without perl (BTW this was the cause for bug #25367 - it was a system with non-working perl).

If we do go with only skipping for cross-compilation,
does this suffice for 'configure.ac' ?

    AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])

In that case, perhaps it's worth adding a test for perl and skipping if it doesn't exist ?

I'm expecting more system will ship without perl as time goes by...

regards,
 - assaf







Information forwarded to bug-sed <at> gnu.org:
bug#25358; Package sed. (Fri, 06 Jan 2017 16:00:02 GMT) Full text and rfc822 format available.

Message #17 received at 25358 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Assaf Gordon <assafgordon <at> gmail.com>
Cc: Vishal Biswas <vshlbiswas <at> ymail.com>, 25358 <at> debbugs.gnu.org
Subject: Re: bug#25358: Cross Compiling fails because of help2man
Date: Fri, 6 Jan 2017 16:58:51 +0100
On Fri, Jan 6, 2017 at 1:44 AM, Assaf Gordon <assafgordon <at> gmail.com> wrote:
> Hello Jim and all,
>
>> On Jan 5, 2017, at 11:41, Jim Meyering <jim <at> meyering.net> wrote:
>>
>>> 1. make 'doc/sed.1' depend on 'sed/sed.c' and 'doc/sed.x'
>> I'm pretty sure we must retain the dependency, at least when not
>> cross-compiling. If we were to attempt to remove that dependency, I
>> believe that would leave a race condition where help2man may attempt
>> to run the binary before it is built.
>
> GNU Make has a good solution for it with its "order-only-prerequisites"
> (which ensure proper order but ignore timestamp of the dependency):
>
>  https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html
>
> Too bad it's not portable...

Indeed.

>>> 2. make the building of 'doc/sed.1' conditional, depending on wether
>>>   it is being built from '.git' (then regenerate it)
>>
>> Even when building from a tarball, we should leave as many build rules
>> as we can.
>
> We do already distribute 'doc/sed.1' in the tarball, and currently always rebuild it,
> I wonder if it's worth making an exception in this case?

I don't feel strongly about this either way. You're welcome to make the call.

> For example in coreutils I think man pages are skipped if there's no perl. Doing the same in sed will allow building it on system without perl (BTW this was the cause for bug #25367 - it was a system with non-working perl).
>
> If we do go with only skipping for cross-compilation,
> does this suffice for 'configure.ac' ?
>
>     AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])

Since that's all coreutils does, I presume it will work for us.

> In that case, perhaps it's worth adding a test for perl and skipping if it doesn't exist ?
>
> I'm expecting more system will ship without perl as time goes by...

This seems worthwhile.




Information forwarded to bug-sed <at> gnu.org:
bug#25358; Package sed. (Sun, 08 Jan 2017 04:24:02 GMT) Full text and rfc822 format available.

Message #20 received at 25358 <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Jim Meyering <jim <at> meyering.net>
Cc: Vishal Biswas <vshlbiswas <at> ymail.com>, 25358 <at> debbugs.gnu.org
Subject: Re: bug#25358: Cross Compiling fails because of help2man
Date: Sat, 7 Jan 2017 23:23:22 -0500
[Message part 1 (text/plain, inline)]
Hello,

> On Jan 6, 2017, at 10:58, Jim Meyering <jim <at> meyering.net> wrote:
> 
> On Fri, Jan 6, 2017 at 1:44 AM, Assaf Gordon <assafgordon <at> gmail.com> wrote:
>> 
>> We do already distribute 'doc/sed.1' in the tarball, and currently always rebuild it,
>> I wonder if it's worth making an exception in this case?
> 
> I don't feel strongly about this either way. You're welcome to make the call.
> 
>>    AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
> 
> Since that's all coreutils does, I presume it will work for us.
> 
>> In that case, perhaps it's worth adding a test for perl and skipping if it doesn't exist ?
> 
> This seems worthwhile.

The attach suggested patch adds all three cases to 'configure.ac',
and 'doc/sed.1' is build conditionally.

It leaves one case un-handled: cross-compilation directly from git.
If this is needed, then either 'sed' can be first built natively (and 'doc/sed.1' will be created),
or we can add a special case and create a stub doc/sed.1 file.

Comments welcomed,
  - assaf

[0001-build-skip-building-man-page-if-needed.patch (application/octet-stream, attachment)]
[Message part 3 (text/plain, inline)]





Information forwarded to bug-sed <at> gnu.org:
bug#25358; Package sed. (Mon, 09 Jan 2017 14:25:02 GMT) Full text and rfc822 format available.

Message #23 received at 25358 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Assaf Gordon <assafgordon <at> gmail.com>
Cc: Vishal Biswas <vshlbiswas <at> ymail.com>, 25358 <at> debbugs.gnu.org
Subject: Re: bug#25358: Cross Compiling fails because of help2man
Date: Mon, 9 Jan 2017 15:23:50 +0100
On Sun, Jan 8, 2017 at 5:23 AM, Assaf Gordon <assafgordon <at> gmail.com> wrote:
> Hello,
>
>> On Jan 6, 2017, at 10:58, Jim Meyering <jim <at> meyering.net> wrote:
>>
>> On Fri, Jan 6, 2017 at 1:44 AM, Assaf Gordon <assafgordon <at> gmail.com> wrote:
>>>
>>> We do already distribute 'doc/sed.1' in the tarball, and currently always rebuild it,
>>> I wonder if it's worth making an exception in this case?
>>
>> I don't feel strongly about this either way. You're welcome to make the call.
>>
>>>    AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
>>
>> Since that's all coreutils does, I presume it will work for us.
>>
>>> In that case, perhaps it's worth adding a test for perl and skipping if it doesn't exist ?
>>
>> This seems worthwhile.
>
> The attach suggested patch adds all three cases to 'configure.ac',
> and 'doc/sed.1' is build conditionally.
>
> It leaves one case un-handled: cross-compilation directly from git.
> If this is needed, then either 'sed' can be first built natively (and 'doc/sed.1' will be created),
> or we can add a special case and create a stub doc/sed.1 file.

Thank you. That looks great.

Not sure it's worth it, but adding an "else" block to that "if
BUILD_MAN_PAGE" (with a rule that fails with a diagnostic explaining
why we cannot build sed.1) may avoid some confusion. Otherwise, all
they'll get is a failed build (no rule to make...), and may think it's
a bug and report it.




Information forwarded to bug-sed <at> gnu.org:
bug#25358; Package sed. (Tue, 10 Jan 2017 03:29:01 GMT) Full text and rfc822 format available.

Message #26 received at 25358 <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Jim Meyering <jim <at> meyering.net>
Cc: Vishal Biswas <vshlbiswas <at> ymail.com>, 25358 <at> debbugs.gnu.org
Subject: Re: bug#25358: Cross Compiling fails because of help2man
Date: Mon, 9 Jan 2017 22:28:38 -0500
[Message part 1 (text/plain, inline)]
Hello,

> On Jan 9, 2017, at 09:23, Jim Meyering <jim <at> meyering.net> wrote:
> 
> On Sun, Jan 8, 2017 at 5:23 AM, Assaf Gordon <assafgordon <at> gmail.com> wrote:
>> The attach suggested patch adds all three cases to 'configure.ac',
>> and 'doc/sed.1' is build conditionally.
> 
> Not sure it's worth it, but adding an "else" block to that "if
> BUILD_MAN_PAGE" (with a rule that fails with a diagnostic explaining
> why we cannot build sed.1) may avoid some confusion. Otherwise, all
> they'll get is a failed build (no rule to make...), and may think it's
> a bug and report it.

I think that n the case of building from tarball - it won't fail because 'doc/sed.1' already exists.
But in the other cases there will be an clear failure.

The attach patch handles these cases specifically, and creates a dummy man page instead of failing.

What do you think ?

- assaf


[0001-build-skip-building-man-page-if-needed.patch (application/octet-stream, attachment)]
[Message part 3 (text/plain, inline)]


Information forwarded to bug-sed <at> gnu.org:
bug#25358; Package sed. (Tue, 10 Jan 2017 14:14:02 GMT) Full text and rfc822 format available.

Message #29 received at 25358 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Assaf Gordon <assafgordon <at> gmail.com>
Cc: Vishal Biswas <vshlbiswas <at> ymail.com>, 25358 <at> debbugs.gnu.org
Subject: Re: bug#25358: Cross Compiling fails because of help2man
Date: Tue, 10 Jan 2017 06:12:41 -0800
On Mon, Jan 9, 2017 at 7:28 PM, Assaf Gordon <assafgordon <at> gmail.com> wrote:
> Hello,
>
>> On Jan 9, 2017, at 09:23, Jim Meyering <jim <at> meyering.net> wrote:
>>
>> On Sun, Jan 8, 2017 at 5:23 AM, Assaf Gordon <assafgordon <at> gmail.com> wrote:
>>> The attach suggested patch adds all three cases to 'configure.ac',
>>> and 'doc/sed.1' is build conditionally.
>>
>> Not sure it's worth it, but adding an "else" block to that "if
>> BUILD_MAN_PAGE" (with a rule that fails with a diagnostic explaining
>> why we cannot build sed.1) may avoid some confusion. Otherwise, all
>> they'll get is a failed build (no rule to make...), and may think it's
>> a bug and report it.
>
> I think that n the case of building from tarball - it won't fail because 'doc/sed.1' already exists.
> But in the other cases there will be an clear failure.
>
> The attach patch handles these cases specifically, and creates a dummy man page instead of failing.

Nice solution. Thank you.




Information forwarded to bug-sed <at> gnu.org:
bug#25358; Package sed. (Wed, 11 Jan 2017 01:11:02 GMT) Full text and rfc822 format available.

Message #32 received at 25358 <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Jim Meyering <jim <at> meyering.net>,
 Vishal Biswas <vshlbiswas <at> ymail.com>
Cc: 25358 <at> debbugs.gnu.org
Subject: Re: bug#25358: Cross Compiling fails because of help2man
Date: Tue, 10 Jan 2017 20:10:22 -0500
tag 25358 fixed
close 25358
thanks


Thank you for the review.
Pushed here:
  http://git.savannah.gnu.org/cgit/sed.git/commit/?id=a0a25e3ee35f5071d5f5c2c068cd5d96f1deb3c4


regards,
 - assaf





Added tag(s) fixed. Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 24 Jan 2017 23:33:03 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 25358 <at> debbugs.gnu.org and Vishal Biswas <vshlbiswas <at> ymail.com> Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 24 Jan 2017 23:33:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 22 Feb 2017 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 58 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.