[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: coreutils 8.30 "bootstap"
From: |
Bernhard Voelker |
Subject: |
Re: coreutils 8.30 "bootstap" |
Date: |
Wed, 15 Aug 2018 00:58:50 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
On 08/10/2018 08:58 AM, Gabor Z. Papp wrote:
> * Bernhard Voelker <address@hidden>:
>> Building in a separate builddir shouldn't be a problem.
>> Do you have a reproducer?
>
> unpack coreutils src to topdir/coreutils-8.30
> mkdir topdir/build
> cd topdir/build
> topdir/coreutils-8.30/configure
> make
okay, I think the problem isn't the VPATH build, but the detection
of whether you're cross-compiling or not.
In 'man/local.mk':
## Use the distributed man pages if cross compiling or lack perl
if CROSS_COMPILING
run_help2man = $(SHELL) $(srcdir)/man/dummy-man
else
## Graceful degradation for systems lacking perl.
if HAVE_PERL
run_help2man = $(PERL) -- $(srcdir)/man/help2man
else
run_help2man = $(SHELL) $(srcdir)/man/dummy-man
endif
endif
and CROSS_COMPILING is set in 'configure.ac':
AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
but it seems automake doesn't provide the right value for "$cross_compiling"
for you when cross-compiling from x86_64 to i686.
BTW: CROSS_COMPILING is also used to determine whether to use
the just-built 'src/ginstall' or 'install' of the build host,
so I'm wondering if you'd fall into the same trap later on?
If yes, then I suggest - with my limited autotool foo - to enhance
the configure-time check with:
----8<----
diff --git a/configure.ac b/configure.ac
index 669e9d1f2..f5534d654 100644
--- a/configure.ac
+++ b/configure.ac
@@ -617,7 +617,15 @@ AC_SUBST([EXTRA_MANS])
AM_SUBST_NOTMAKE([EXTRA_MANS])
AC_SUBST([built_programs], [$optional_bin_progs])
-AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
+AC_MSG_CHECKING([whether built binary fails to run on this host
(cross-compiling?)])
+AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
+[cu_cross_compiling=no],
+[# Assume we are cross-compiling if this trivial program fails.
+cu_cross_compiling=yes],
+[cu_cross_compiling=yes])
+AM_CONDITIONAL([CROSS_COMPILING],
+ [test "$cross_compiling" = yes || test "$cu_cross_compiling" = yes])
+AC_MSG_RESULT([$cu_cross_compiling])
############################################################################
---->8----
For your coreutils-8.30 working tree, the following might be a workaround:
it checks whether the just-built 'true' binary is executable, and falls back
to 'dummy-man'.
----8<----
diff --git a/man/local.mk b/man/local.mk
index 05d44012d..e674bd125 100644
--- a/man/local.mk
+++ b/man/local.mk
@@ -181,6 +181,11 @@ endif
test) prog='['; argv='[';; \
*) prog=$$name; argv=$$prog;; \
esac; \
+## Double-check whether the built binaries are executable on the build host
+## as the above CROSS_COMPILING condition might have been wrong in some cases.
+ run_help2man="$(run_help2man)"; \
+ $(abs_top_builddir)/src/true$(EXEEXT) 2>/dev/null \
+ || run_help2man="$(srcdir)/man/dummy-man"; \
## Note the use of $$t/$*, rather than just '$*' as in other packages.
## That is necessary to avoid failures for programs that are also shell
## built-in functions like echo, false, printf, pwd.
@@ -192,7 +197,7 @@ endif
$$argv$(EXEEXT)) \
&& : $${SOURCE_DATE_EPOCH=`cat $(srcdir)/.timestamp 2>/dev/null || :`} \
&& : $${TZ=UTC0} && export TZ \
- && export SOURCE_DATE_EPOCH && $(run_help2man) \
+ && export SOURCE_DATE_EPOCH && $${run_help2man} \
--source='$(PACKAGE_STRING)' \
--include=$(srcdir)/man/$$name.x \
--output=$$t/$$name.1 \
---->8----
P.S. I couldn't test the cross-compilation path here.
Have a nice day,
Berny
to check the executable-ity