GNU bug report logs - #78377
Cross-Compile - "src/make-prime-list: cannot execute: required file not found"

Previous Next

Package: coreutils;

Reported by: NR <nroycea+gnu <at> gmail.com>

Date: Sun, 11 May 2025 15:44:05 UTC

Severity: normal

Tags: fixed

Merged with 12741

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 78377 in the body.
You can then email your comments to 78377 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-coreutils <at> gnu.org:
bug#78377; Package coreutils. (Sun, 11 May 2025 15:44:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to NR <nroycea+gnu <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sun, 11 May 2025 15:44:05 GMT) Full text and rfc822 format available.

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

From: NR <nroycea+gnu <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: Cross-Compile - "src/make-prime-list: cannot execute: required file
 not found"
Date: Sun, 11 May 2025 10:26:29 -0500
It'd be nice to be able to cross-compile coreutils.

It could be done by detecting if `--host=` is different from the build system.
If it is different, then make the `src/primes.h` target natively
(specifically the `src/make-prime-list` target).

I noticed it was a very old issue (going back to 2012).
My workaround was just to `configure` without any arguments, `make
src/primes.h`, then `configure` again for cross-compiling, and run a
normal `make`.




Information forwarded to bug-coreutils <at> gnu.org:
bug#78377; Package coreutils. (Tue, 13 May 2025 15:15:02 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: NR <nroycea+gnu <at> gmail.com>, 78377 <at> debbugs.gnu.org
Subject: Re: bug#78377: Cross-Compile - "src/make-prime-list: cannot execute:
 required file not found"
Date: Tue, 13 May 2025 16:14:03 +0100
forcemerge 12741 78377
stop

On 11/05/2025 16:26, NR wrote:
> It'd be nice to be able to cross-compile coreutils.
> 
> It could be done by detecting if `--host=` is different from the build system.
> If it is different, then make the `src/primes.h` target natively
> (specifically the `src/make-prime-list` target).
> 
> I noticed it was a very old issue (going back to 2012).
> My workaround was just to `configure` without any arguments, `make
> src/primes.h`, then `configure` again for cross-compiling, and run a
> normal `make`.

Yes this was discussed at https://bugs.gnu.org/12741

The workaround isn't too onerous,
but yes it would be good to clean this up.

cheers,
Pádraig




Information forwarded to bug-coreutils <at> gnu.org:
bug#78377; Package coreutils. (Tue, 13 May 2025 17:02:02 GMT) Full text and rfc822 format available.

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

From: Collin Funk <collin.funk1 <at> gmail.com>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: 78377 <at> debbugs.gnu.org, NR <nroycea+gnu <at> gmail.com>
Subject: Re: bug#78377: Cross-Compile - "src/make-prime-list: cannot
 execute: required file not found"
Date: Tue, 13 May 2025 10:01:31 -0700
Pádraig Brady <P <at> draigBrady.com> writes:

> The workaround isn't too onerous,
> but yes it would be good to clean this up.

Doesn't crc32 in Gnulib handle this using $(BUILD_CC)? I imagine it
should be simple to do the same here. I can have a look later.

Collin




Information forwarded to bug-coreutils <at> gnu.org:
bug#78377; Package coreutils. (Tue, 13 May 2025 17:26:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: bug-coreutils <at> gnu.org
Subject: Re: bug#78377: Cross-Compile - "src/make-prime-list: cannot execute:
 required file not found"
Date: Tue, 13 May 2025 10:24:42 -0700
On 2025-05-13 10:01, Collin Funk wrote:
> Doesn't crc32 in Gnulib handle this using $(BUILD_CC)? I imagine it
> should be simple to do the same here. I can have a look later.

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.




Information forwarded to bug-coreutils <at> gnu.org:
bug#78377; Package coreutils. (Fri, 16 May 2025 05:37:01 GMT) Full text and rfc822 format available.

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

From: Collin Funk <collin.funk1 <at> gmail.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 78377 <at> debbugs.gnu.org
Subject: Re: bug#78377: Cross-Compile - "src/make-prime-list: cannot
 execute: required file not found"
Date: Thu, 15 May 2025 22:36:31 -0700
[Message part 1 (text/plain, inline)]
Hi Paul,

Paul Eggert <eggert <at> cs.ucla.edu> 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.

Collin

[0001-build-allow-make-prime-list-to-build-when-cross-comp.patch (text/x-patch, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#78377; Package coreutils. (Fri, 16 May 2025 12:17:02 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: Collin Funk <collin.funk1 <at> gmail.com>, Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 78377 <at> debbugs.gnu.org
Subject: Re: bug#78377: Cross-Compile - "src/make-prime-list: cannot execute:
 required file not found"
Date: Fri, 16 May 2025 13:15:49 +0100
On 16/05/2025 06:36, Collin Funk wrote:
> Hi Paul,
> 
> Paul Eggert <eggert <at> cs.ucla.edu> 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 \





Information forwarded to bug-coreutils <at> gnu.org:
bug#78377; Package coreutils. (Sat, 17 May 2025 03:22:02 GMT) Full text and rfc822 format available.

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

From: Collin Funk <collin.funk1 <at> gmail.com>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: 78377 <at> debbugs.gnu.org, Paul Eggert <eggert <at> cs.ucla.edu>
Subject: Re: bug#78377: Cross-Compile - "src/make-prime-list: cannot
 execute: required file not found"
Date: Fri, 16 May 2025 20:21:04 -0700
Hi Pádraig,

Pádraig Brady <P <at> draigBrady.com> writes:

> 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.

Yeah, that sounds better. But since it seems Coreutils is the only one
using it I am not in a rush to do it. :)

> Talking about crc, given our crctab.c has expanded recently,
> it probably makes sense to generate that at build time also.

I can have a look at that. Seems fairly simple.

> 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.

Thanks! I forgot to run 'make syntax-check'.

Collin




Forcibly Merged 12741 78377. Request was from Pádraig Brady <P <at> draigBrady.com> to control <at> debbugs.gnu.org. (Sat, 17 May 2025 07:52:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-coreutils <at> gnu.org:
bug#78377; Package coreutils. (Sat, 17 May 2025 08:25:02 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: Collin Funk <collin.funk1 <at> gmail.com>
Cc: 78377 <at> debbugs.gnu.org
Subject: Re: bug#78377: Cross-Compile - "src/make-prime-list: cannot execute:
 required file not found"
Date: Sat, 17 May 2025 09:24:07 +0100
On 17/05/2025 04:21, Collin Funk wrote:
> Hi Pádraig,
> 
> Pádraig Brady <P <at> draigBrady.com> writes:
> 
>> 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.
> 
> Yeah, that sounds better. But since it seems Coreutils is the only one
> using it I am not in a rush to do it. :)
> 
>> Talking about crc, given our crctab.c has expanded recently,
>> it probably makes sense to generate that at build time also.
> 
> I can have a look at that. Seems fairly simple.

Great, much appreciated.

I adjusted the commit message to mention this
was only an issue when building from git,
as we distribute primes.h in tarballs.
I also mentioned this bug number in the commit message.

Pushed.
Marking as done.

thanks!
Pádraig.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 14 Jun 2025 11:24:14 GMT) Full text and rfc822 format available.

This bug report was last modified today.

Previous Next


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