[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: broken build environment - explanation and fix
From: |
Jose E. Marchesi |
Subject: |
Re: broken build environment - explanation and fix |
Date: |
Sun, 19 Feb 2023 16:24:52 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> Arsen Arsenović wrote:
>> IIRC, the JITTER executable is not built in the cross case from
>> dists. Do you know if this still work with this dependency added?
>> (i.e. run distcheck and build a cross-compiled poke from the new dist)
>
> Good point. When cross-compiling, the JITTER (= jitter/bin/jitter)
> executable does get built, but it cannot be executed:
>
> make[3]: Entering directory '/POKE/poke/build-arm64/libpoke'
> /POKE/poke/build-arm64/jitter/bin/jitter ../../libpoke/pvm.jitter --output . \
> && { test . = ../../libpoke \
> || { mv pvm-vm.h ../../libpoke/pvm-vm.h \
> && mv pvm-vm1.c ../../libpoke/pvm-vm1.c \
> && mv pvm-vm2.c ../../libpoke/pvm-vm2.c; \
> }; \
> } \
> || { rm -f pvm-vm.h pvm-vm1.c pvm-vm2.c; false; }
> /bin/bash: line 1: /POKE/poke/build-arm64/jitter/bin/jitter: cannot execute
> binary file: Exec format error
> make[3]: *** [Makefile:3572: generate-vm-files] Error 1
>
> So, with the patch I proposed yesterday, the ability to cross-compile
> would get lost. Here's a revised patch. It emits a
> warning: not regenerating pvm-vm.h, pvm-vm[12].c since we are
> cross-compiling
> instead.
>
> The warning is justified, because if pvm-vm.h, pvm-vm[12].c are outdated
> (like it was for me yesterday) we would not know, and the build might
> continue but produce broken binaries.
>
> New proposed patch is attached.
OK for master and maint/poke-3.
Thanks.
>
>>From 6f7e335ff266f9211afb6f4d63d6b76d60091844 Mon Sep 17 00:00:00 2001
> From: Bruno Haible <bruno@clisp.org>
> Date: Sun, 19 Feb 2023 00:59:28 +0100
> Subject: [PATCH] build: Regenerate pvm-vm.h, pvm-vm1.c, pvm-vm2.c when jitter
> has changed.
>
> * libpoke/Makefile.am (generate-vm-files): When cross-compiling, don't fail,
> just emit a warning.
> (pvm-vm.h): Depend also on $(JITTER).
> ---
> libpoke/Makefile.am | 27 +++++++++++++++++----------
> 1 file changed, 17 insertions(+), 10 deletions(-)
>
> diff --git a/libpoke/Makefile.am b/libpoke/Makefile.am
> index 7e256cf7..a16049c2 100644
> --- a/libpoke/Makefile.am
> +++ b/libpoke/Makefile.am
> @@ -225,19 +225,26 @@ MAINTAINERCLEANFILES += $(srcdir)/pvm-vm.h
> $(srcdir)/pvm-vm1.c $(srcdir)/pvm-vm2
> # <https://lists.gnu.org/archive/html/bug-make/2020-09/msg00008.html>, so
> that
> # it works also in parallel 'make'.
> generate-vm-files:
> - $(JITTER) $(srcdir)/pvm.jitter --output $(builddir) \
> - && { test $(builddir) = $(srcdir) \
> - || { mv pvm-vm.h $(srcdir)/pvm-vm.h \
> - && mv pvm-vm1.c $(srcdir)/pvm-vm1.c \
> - && mv pvm-vm2.c $(srcdir)/pvm-vm2.c; \
> - }; \
> - } \
> - || { rm -f pvm-vm.h pvm-vm1.c pvm-vm2.c; false; }
> + if $(JITTER) --help >/dev/null 2>/dev/null; then \
> + $(JITTER) $(srcdir)/pvm.jitter --output $(builddir) \
> + && { test $(builddir) = $(srcdir) \
> + || { mv pvm-vm.h $(srcdir)/pvm-vm.h \
> + && mv pvm-vm1.c $(srcdir)/pvm-vm1.c \
> + && mv pvm-vm2.c $(srcdir)/pvm-vm2.c; \
> + }; \
> + } \
> + || { rm -f pvm-vm.h pvm-vm1.c pvm-vm2.c; false; }; \
> + else \
> + echo "warning: not regenerating pvm-vm.h, pvm-vm[12].c since we are
> cross-compiling" 1>&2; \
> + fi
> .PHONY: generate-vm-files
> # The above rule will generate files with time-stamp order
> # pvm.jitter <= pvm-vm.h <= pvm-vm1.c <= pvm-vm2.c
> -pvm-vm.h: pvm.jitter
> - @{ test -f $(srcdir)/pvm-vm.h && test ! $(srcdir)/pvm-vm.h -ot
> $(srcdir)/pvm.jitter; } || $(MAKE) generate-vm-files
> +pvm-vm.h: pvm.jitter $(JITTER)
> + @{ test -f $(srcdir)/pvm-vm.h \
> + && test ! $(srcdir)/pvm-vm.h -ot $(srcdir)/pvm.jitter \
> + && test ! $(srcdir)/pvm-vm.h -ot $(JITTER); \
> + } || $(MAKE) generate-vm-files
> pvm-vm1.c: pvm-vm.h
> @{ test -f $(srcdir)/pvm-vm1.c && test ! $(srcdir)/pvm-vm1.c -ot
> $(srcdir)/pvm-vm.h; } || $(MAKE) generate-vm-files
> pvm-vm2.c: pvm-vm1.c