gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Building Gforth for Apple's new Arm-based Macs


From: Alexander Shpilkin
Subject: Re: Building Gforth for Apple's new Arm-based Macs
Date: Wed, 20 Jan 2021 19:59:46 +0300
User-agent: Evolution 3.38.3

On Wed, 2021-01-20 at 10:07 -0500, Craig Treleaven wrote:
> 
> I’m running these on an older MacBook Pro (Core i7) which identifies
> thusly:
> 
> $ uname -m
> x86_64
> $ uname -rs
> Darwin 14.5.0
> 
> Running config.guess gives:
> 
> $ ./config.guess
> i386-apple-darwin14.5.0
> 
> If I omit the build flag, configure says (in part):
> 
> ./configure --prefix=/opt/local
> ...
> checking build system type... i386-apple-darwin14.5.0
> checking host system type... i386-apple-darwin14.5.0
> Check for arch/386//gforth.ld (false)
> 
> But it fails testing:
> 
> --- ./test/coretest.out       2013-10-11 17:31:28.000000000 -0400
> ***************
> *** 1,10 ****
> ! redefined {  
> ! 
> ! Floating point exception: 8.
> ! INCORRECT RESULT: { -1 S>D 1 FM/MOD -> 0 -1 }
> ! INCORRECT RESULT: { -2 S>D 1 FM/MOD -> 0 -2 }
> ! INCORRECT RESULT: { 1 S>D -1 FM/MOD -> 0 -1 }
> ! INCORRECT RESULT: { 2 S>D -1 FM/MOD -> 0 -2 }
> ! INCORRECT RESULT: {  7 S>D -3 FM/MOD -> -2 -3 }
> ! INCORRECT RESULT: { -7 S>D  3 FM/MOD -> 2 -3 }
> ! INCORRECT RESULT: { -7 S>D -3 FM/MOD -> -1 2 }
> --- 1,17 ----
> ! redefined {  redefined GDX  YOU SHOULD SEE THE STANDARD GRAPHIC
> CHARACTERS:
> !  !"#$%&'()*+,-./0123456789:;<=>?@
> ! ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`
> ! abcdefghijklmnopqrstuvwxyz{|}~
> ! YOU SHOULD SEE 0-9 SEPARATED BY A SPACE:
> ! 0 1 2 3 4 5 6 7 8 9 
> ! YOU SHOULD SEE 0-9 (WITH NO SPACES):
> ! 0123456789
> ! YOU SHOULD SEE A-G SEPARATED BY A SPACE:
> ! A B C D E F G 
> ! YOU SHOULD SEE 0-5 SEPARATED BY TWO SPACES:
> ! 0  1  2  3  4  5  
> ! YOU SHOULD SEE TWO SEPARATE LINES:
> ! LINE 1
> ! LINE 2
> ! you should see this first. 
> ! you should see this later. 
> make[3]: *** [checkone] Error 1

As Anton Ertl already said, this should not happen and represents build
breakage.  On the other hand, his comments re multiarch detection
notwithstanding, on a i386/x86_64 multiarch machine it should matter
whether your _build_ triple is x86_64-* or i386-*, only whether your
_host_ triple is.

To reiterate, the _build_ setting is there, in theory, to tell
`configure` what machine you’re going to run `make` on, which in the
overwhelming majority of cases should be the same machine `configure`
itself is running on, and thus best left to autodetection.  (In
practice, I believe it is there for symmetry with _host_ and to help
you when `config.guess` fails, i.e. when `configure` can’t tell what
machine it’s running on.)

Regarding these,

> ./configure --prefix=/opt/local --build=x86_64 
> ...
> checking build system type... x86_64-pc-none
> checking host system type... x86_64-pc-none
> Check for arch/amd64//gforth.ld (false)
> 
> [snip]
> 
> ./configure --prefix=/opt/local --build=aarch64 
> 
> [snip]
> 
> If I pass just “-build=arm”, [snip]

it appears to me that you misunderstand what these settings are doing.
(Sorry if I’m guessing wrong.)  Both build and host are _triples_, that
is, of the form CPU-VENDOR-OS (or sometimes CPU-VENDOR-KERNEL-LIBC),
and anything else you can pass in the place of a triple is a convenient
abbreviation (expanded by code in `config.sub`, which, unlike the
Lovecraftian horror that is the generated `configure`, is completely
readable).  In particular, it is a convenient abbreviation that does
not depend on the machine you’re using (i.e. `config.sub` does not
invoke or otherwise touch `config.guess`).

Thus e.g. setting host to `arm` does not mean "build for an ARM version
of whatever OS I am currently using", it means "build for a generic ARM
environment" or, depending on context, "build for a freestanding, OS-
less ARM environment", which is almost certainly not what you want. 
That anything even works on macOS when you set build to x86_64 (without
further qualification) is, as far as I can tell, mostly due to a
coincidence of matching defaults.  (The presence of `x86_64-pc-none` in
the output is a clue.)

-- 
Good luck,
Alex

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]