GNU bug report logs - #52330
Different processor architecture on Apple M1 CPU

Previous Next

Package: coreutils;

Reported by: Jakub Sokołowski <jakub <at> status.im>

Date: Mon, 6 Dec 2021 15:03:02 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

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 52330 in the body.
You can then email your comments to 52330 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#52330; Package coreutils. (Mon, 06 Dec 2021 15:03:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jakub Sokołowski <jakub <at> status.im>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Mon, 06 Dec 2021 15:03:02 GMT) Full text and rfc822 format available.

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

From: Jakub Sokołowski <jakub <at> status.im>
To: bug-coreutils <at> gnu.org
Subject: Different processor architecture on Apple M1 CPU
Date: Mon, 6 Dec 2021 15:53:10 +0100
[Message part 1 (text/plain, inline)]
I've identified an issue with GNU Coreutils uname utility. Specifically
with the value it returns for the processor type/architecture(-p). When
used on a MacOS with M1 arm64 processor the returned value is amr64, but
the default uname utility on MacOS returns arm.

This issue has caused build issues with SQLite and SQLCipher packages when
trying to build them on 4th generation Mac Mini inside of a Nix shell which
uses GNU Coreutils. It wails with:

[nix-shell:~/repos/sqlite]$ ./configure
checking build system type... Invalid configuration
`arm64-apple-darwin20.6.0': machine `arm64-apple' not recognized
configure: error:
/nix/store/ppzr8yab3s3883skd0da5i4ylzpksk9l-bash-5.1-p8/bin/bash
./config.sub arm64-apple-darwin20.6.0 failed

I've tried to get to the bottom of this issue when trying to get our iOS
builds to work on arm64:
https://github.com/status-im/status-react/issues/12799

And initially I thought this was specific to Nix, so I opened an issue for
it:
https://github.com/NixOS/nixpkgs/issues/147914

But as suggested there the issue appears to be in GNU Coreutils.
I also tried fixing the build in SQLCipher by updating their `config.sub`
and `config.guess` scripts, but the PR was rejected:
https://github.com/sqlcipher/sqlcipher/pull/414

I've also opened a thread on SQLite forum about this issue:
https://www.sqlite.org/forum/forumpost/f0875bea54

But not sure if they would want to update their `config.sub` and
`config.guess` either.

Is this something that can be fixed in GNU Coreutils?
[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#52330; Package coreutils. (Mon, 06 Dec 2021 22:42:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jakub Sokołowski <jakub <at> status.im>
Cc: 52330 <at> debbugs.gnu.org
Subject: Re: bug#52330: Different processor architecture on Apple M1 CPU
Date: Mon, 6 Dec 2021 14:41:28 -0800
[Message part 1 (text/plain, inline)]
On 12/6/21 06:53, Jakub Sokołowski via GNU coreutils Bug Reports wrote:
> I've identified an issue with GNU Coreutils uname utility. Specifically
> with the value it returns for the processor type/architecture(-p). When
> used on a MacOS with M1 arm64 processor the returned value is amr64, but
> the default uname utility on MacOS returns arm.

Does the attached patch fix things for you? Unfortunately I don't have 
access to macOS to test it.
[0001-uname-port-to-recent-macOS.patch (text/x-patch, attachment)]

Added tag(s) patch. Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Mon, 06 Dec 2021 22:42:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-coreutils <at> gnu.org:
bug#52330; Package coreutils. (Tue, 07 Dec 2021 12:04:02 GMT) Full text and rfc822 format available.

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

From: Jakub Sokołowski <jakub <at> status.im>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 52330 <at> debbugs.gnu.org
Subject: Re: bug#52330: Different processor architecture on Apple M1 CPU
Date: Tue, 7 Dec 2021 13:03:08 +0100
[Message part 1 (text/plain, inline)]
Thanks for that. I tried building it on an M1 host using this Nix
derivation adding the patch:


{ pkgs ? import <nixpkgs> { } }:

pkgs.coreutils.overrideAttrs (old: rec {
  patches = old.patches ++ [
    (pkgs.fetchurl {
      url = "
https://lists.gnu.org/archive/html/bug-coreutils/2021-12/txtVcwvzjfMQw.txt";
      sha256 = "0friadh90hdl4h7zzg032nyzrf5x1m0p0k5z8hxzfz53c1dg3i6s";
    })
  ];
})

But it failed during compilation with:

src/uname.c:170:41: error: unknown type name 'MAYBE_UNUSED'
print_element_env (char const *element, MAYBE_UNUSED char const *envvar)
                                        ^
1 error generated.

On Mon, Dec 6, 2021 at 11:41 PM Paul Eggert <eggert <at> cs.ucla.edu> wrote:

> On 12/6/21 06:53, Jakub Sokołowski via GNU coreutils Bug Reports wrote:
> > I've identified an issue with GNU Coreutils uname utility. Specifically
> > with the value it returns for the processor type/architecture(-p). When
> > used on a MacOS with M1 arm64 processor the returned value is amr64, but
> > the default uname utility on MacOS returns arm.
>
> Does the attached patch fix things for you? Unfortunately I don't have
> access to macOS to test it.



-- 
Jakub Grzegorz Sokołowski
Head of Infrastructure at Status
Status.im: jakubgs.eth <https://join.status.im/u/jakubgs.eth>
[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#52330; Package coreutils. (Tue, 07 Dec 2021 19:17:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jakub Sokołowski <jakub <at> status.im>
Cc: 52330 <at> debbugs.gnu.org
Subject: Re: bug#52330: Different processor architecture on Apple M1 CPU
Date: Tue, 7 Dec 2021 11:16:46 -0800
On 12/7/21 04:03, Jakub Sokołowski wrote:
> src/uname.c:170:41: error: unknown type name 'MAYBE_UNUSED'

I suspect you applied the patch to coreutils 9.0, which doesn't work. 
The patch needs to be applied to bleeding-edge coreutils built from Git 
<https://git.savannah.gnu.org/cgit/coreutils.git>.

To save you the work of building from Git, I generated a tarball that 
you should be able to just run './configure; make; src/uname -p' on:

https://www.cs.ucla.edu/~eggert/coreutils-9.0.37-202be.tar.xz

Please give it a try.




Information forwarded to bug-coreutils <at> gnu.org:
bug#52330; Package coreutils. (Tue, 07 Dec 2021 19:51:02 GMT) Full text and rfc822 format available.

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

From: Jakub Sokołowski <jakub <at> status.im>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 52330 <at> debbugs.gnu.org
Subject: Re: bug#52330: Different processor architecture on Apple M1 CPU
Date: Tue, 7 Dec 2021 20:50:35 +0100
[Message part 1 (text/plain, inline)]
Oh, you're right:

[nix-shell:~/coreutils-9.0.37-202be]$ ./src/uname -p
arm

[nix-shell:~/coreutils-9.0.37-202be]$ ./src/uname -m
arm64

Now it works the same as the default uname utility!


On Tue, Dec 7, 2021 at 8:16 PM Paul Eggert <eggert <at> cs.ucla.edu> wrote:

> On 12/7/21 04:03, Jakub Sokołowski wrote:
> > src/uname.c:170:41: error: unknown type name 'MAYBE_UNUSED'
>
> I suspect you applied the patch to coreutils 9.0, which doesn't work.
> The patch needs to be applied to bleeding-edge coreutils built from Git
> <https://git.savannah.gnu.org/cgit/coreutils.git>.
>
> To save you the work of building from Git, I generated a tarball that
> you should be able to just run './configure; make; src/uname -p' on:
>
> https://www.cs.ucla.edu/~eggert/coreutils-9.0.37-202be.tar.xz
>
> Please give it a try.
>


-- 
Jakub Grzegorz Sokołowski
Head of Infrastructure at Status
Status.im: jakubgs.eth <https://join.status.im/u/jakubgs.eth>
[Message part 2 (text/html, inline)]

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Tue, 07 Dec 2021 22:02:01 GMT) Full text and rfc822 format available.

Notification sent to Jakub Sokołowski <jakub <at> status.im>:
bug acknowledged by developer. (Tue, 07 Dec 2021 22:02:01 GMT) Full text and rfc822 format available.

Message #24 received at 52330-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jakub Sokołowski <jakub <at> status.im>
Cc: 52330-done <at> debbugs.gnu.org
Subject: Re: bug#52330: Different processor architecture on Apple M1 CPU
Date: Tue, 7 Dec 2021 14:01:38 -0800
Thanks for checking. I installed the patch and am closing the bug report.




Information forwarded to bug-coreutils <at> gnu.org:
bug#52330; Package coreutils. (Tue, 07 Dec 2021 23:35:02 GMT) Full text and rfc822 format available.

Message #27 received at 52330-done <at> debbugs.gnu.org (full text, mbox):

From: Jakub Sokołowski <jakub <at> status.im>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 52330-done <at> debbugs.gnu.org
Subject: Re: bug#52330: Different processor architecture on Apple M1 CPU
Date: Wed, 8 Dec 2021 00:33:43 +0100
[Message part 1 (text/plain, inline)]
That's amazing. Thank You for the fast response. Paron my eagerness, but
when is a new release planned for? I guess not before 2022?

On Tue, Dec 7, 2021 at 11:01 PM Paul Eggert <eggert <at> cs.ucla.edu> wrote:

> Thanks for checking. I installed the patch and am closing the bug report.
>


-- 
Jakub Grzegorz Sokołowski
Head of Infrastructure at Status
Status.im: jakubgs.eth <https://join.status.im/u/jakubgs.eth>
[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#52330; Package coreutils. (Tue, 07 Dec 2021 23:47:02 GMT) Full text and rfc822 format available.

Message #30 received at 52330-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jakub Sokołowski <jakub <at> status.im>
Cc: 52330-done <at> debbugs.gnu.org
Subject: Re: bug#52330: Different processor architecture on Apple M1 CPU
Date: Tue, 7 Dec 2021 15:46:42 -0800
On 12/7/21 15:33, Jakub Sokołowski via GNU coreutils Bug Reports wrote:
> when is a new release planned for? I guess not before 2022?

No current plans as far as I know.




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

This bug report was last modified 2 years and 73 days ago.

Previous Next


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