bug#78377: Cross-Compile - "src/make-prime-list: cannot execute: required file not found"
Pádraig Brady <[email protected]>
| Newsgroups | gmane.comp.gnu.core-utils.bugs |
|---|---|
| Message-ID | <[email protected]> |
On 16/05/2025 06:36, Collin Funk wrote: > Hi Paul, > > Paul Eggert <[email protected]> writes: > >> Yes, that should work, so long as the build host isn't a Microsoft >> Windows platform that would require $(BUILD_EXEEXT). And that should >> be good enough; we don't need the full power of AX_PROG_CC_FOR_BUILD >> from the Autoconf Archive. > > Here is a patch that worked in an x86 docker container with an arm64 > cross compiler. > > Can we just assume that crc will always be used and depend on > build-cc.m4? I guess the more robust way to do things is to do the > following in bootstrap.conf: > > bootstrap_post_import_hook () > { > $gnulib_tool --copy-file m4/build-cc.m4 > } > > Like we do for tests/init.sh. Well given we also need to call gl_BUILD_CC perhaps the best way would be to have a separate build-cc gnulib module and have the crc module depend on that. I'm fine just depending on crc for now though, though I can see a build-cc gnulib module being generally useful. Talking about crc, given our crctab.c has expanded recently, it probably makes sense to generate that at build time also. The patch looks good, and I tested with: make BUILD_CC=clang BUILD_CFLAGS=-m32 V=1 I'll apply later and squash the following in to avoid `make syntax-check` failures, and remove a stale entry from .gitignore. thank you! Pádraig diff --git a/.gitignore b/.gitignore index bafeb2bc5..ba7344994 100644 --- a/.gitignore +++ b/.gitignore @@ -201,7 +201,6 @@ /src/fs-kernel-magic /src/fs-latest-magic.h /src/fs-magic -/src/make-prime-list /src/primes.h /src/single-binary.mk /src/version.c diff --git a/cfg.mk b/cfg.mk index e147d4ae7..fa032f52e 100644 --- a/cfg.mk +++ b/cfg.mk @@ -869,7 +869,7 @@ exclude_file_name_regexp--sc_system_h_headers = \ ^src/((system|copy|chown-core|find-mount-point)\.h|make-prime-list\.c)$$ _src := (false|lbracket|chown-(chgrp|chown) -_src := $(_src)|ls-(dir|ls|vdir)|tac-pipe|uname-(arch|uname)) +_src := $(_src)|ls-(dir|ls|vdir)|make-prime-list|tac-pipe|uname-(arch|uname)) _gl_src = (xdecto.max|cl-strtold) exclude_file_name_regexp--sc_require_config_h_first = \ (^lib/buffer-lcm\.c|gl/lib/$(_gl_src)\.c|src/$(_src)\.c)$$ @@ -921,8 +921,10 @@ exclude_file_name_regexp--sc_prohibit_operator_at_end_of_line = \ exclude_file_name_regexp--sc_error_message_uppercase = ^src/factor\.c$$ exclude_file_name_regexp--sc_prohibit_atoi_atof = ^src/make-prime-list\.c$$ -# Exception here as we don't want __attribute elided on non GCC -exclude_file_name_regexp--sc_prohibit-gl-attributes = ^src/libstdbuf\.c$$ +# Exception here as we don't want __attribute elided on non GCC for stdbuf +# and we don't want to depend on gnulib for make-prime-list +exclude_file_name_regexp--sc_prohibit-gl-attributes = \ + ^src/(make-prime-list|libstdbuf)\.c$$ exclude_file_name_regexp--sc_prohibit_uppercase_id_est = \.diff$$ exclude_file_name_regexp--sc_ensure_dblspace_after_dot_before_id_est = \.diff$$ diff --git a/src/local.mk b/src/local.mk index 833c714e1..68c7db63a 100644 --- a/src/local.mk +++ b/src/local.mk @@ -559,8 +559,8 @@ $(top_srcdir)/src/primes.h: $(top_srcdir)/src/make-prime-list.c $(MKDIR_P) $(top_srcdir)/src/primes-tmp \ && (cd $(top_srcdir)/src/primes-tmp \ && $(BUILD_CC) $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) \ - $(BUILD_LDFLAGS) -o make-prime-list$(EXEEXT) \ - $(abs_top_srcdir)/src/make-prime-list.c) \ + $(BUILD_LDFLAGS) -o make-prime-list$(EXEEXT) \ + $(abs_top_srcdir)/src/make-prime-list.c) \ && rm -f $@ $@-t \ && $(top_srcdir)/src/primes-tmp/make-prime-list$(EXEEXT) \ 5000 > $@-t \