Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
COMMON_FLAGS march=native
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
leonchik1976
Guru
Guru


Joined: 24 Jan 2010
Posts: 337

PostPosted: Tue Dec 13, 2022 12:26 pm    Post subject: COMMON_FLAGS march=native Reply with quote

I have gentoo installed in Parallels Desktop VM on my mac studio M1 Max, and i have a lot of issues when i set "-march=native:

COMMON_FLAGS="-march=native -O2 -pipe -fomit-frame-pointer"

how can i know, what should i put instead so it will suitable for this CPU?
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3918

PostPosted: Tue Dec 13, 2022 12:40 pm    Post subject: Reply with quote

What kind of virtualized cpu does Parallels assign to your vm?
Safest is to omit -march= or set it to
Code:

-march=x86-64

You can also run
Code:

gcc -march=native -E -v - </dev/null 2>&1 | grep cc1

to see as what arch GCC recognizes the virt cpu.
_________________
:)


Last edited by alamahant on Tue Dec 13, 2022 12:47 pm; edited 1 time in total
Back to top
View user's profile Send private message
leonchik1976
Guru
Guru


Joined: 24 Jan 2010
Posts: 337

PostPosted: Tue Dec 13, 2022 12:43 pm    Post subject: Reply with quote

alamahant wrote:
What kind of virtualized cpu does Parallels assign to your vm?
Safest is to omit -march= or set it to
Code:

-march=x86-64


Apple M1 Max
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3918

PostPosted: Tue Dec 13, 2022 12:48 pm    Post subject: Reply with quote

Plz check it with
Code:

gcc -march=native -E -v - </dev/null 2>&1 | grep cc1


_________________
:)
Back to top
View user's profile Send private message
leonchik1976
Guru
Guru


Joined: 24 Jan 2010
Posts: 337

PostPosted: Tue Dec 13, 2022 12:49 pm    Post subject: Reply with quote

alamahant wrote:
Plz check it with
Code:

gcc -march=native -E -v - </dev/null 2>&1 | grep cc1



# gcc -march=native -E -v - </dev/null 2>&1 | grep cc1
/usr/libexec/gcc/aarch64-unknown-linux-gnu/12/cc1 -E -quiet -v - -mlittle-endian -mabi=lp64 -march=armv8-a+crypto+crc+lse+rcpc+rdma+dotprod+fp16fml+sb+ssbs+flagm+pauth -dumpbase -


so what from this should i put in COMMON_FLAGS? the whole line as is?
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3918

PostPosted: Tue Dec 13, 2022 12:52 pm    Post subject: Reply with quote

Better just omit -march=
_________________
:)
Back to top
View user's profile Send private message
leonchik1976
Guru
Guru


Joined: 24 Jan 2010
Posts: 337

PostPosted: Tue Dec 13, 2022 12:53 pm    Post subject: Reply with quote

alamahant wrote:
Better just omit -march=

what do you mean?
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3918

PostPosted: Tue Dec 13, 2022 12:57 pm    Post subject: Reply with quote

In COMMON_FLAGS do not include anything "-march=xxxx"
_________________
:)
Back to top
View user's profile Send private message
leonchik1976
Guru
Guru


Joined: 24 Jan 2010
Posts: 337

PostPosted: Tue Dec 13, 2022 12:58 pm    Post subject: Reply with quote

alamahant wrote:
In COMMON_FLAGS do not include anything "-march=xxxx"


so i confused a little bit - if it will grab what it needs without -march=native, why it's required :-)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54600
Location: 56N 3W

PostPosted: Tue Dec 13, 2022 1:00 pm    Post subject: Reply with quote

leonchik1976,

The M1 is an aarch64 CPU. That's 64 bit ARM.
The
Code:
-mlittle-endian -mabi=lp64 -march=armv8-a+crypto+crc+lse+rcpc+rdma+dotprod+fp16fml+sb+ssbs+flagm+pauth -dumpbase -
is what gcc uses for -march=native.

Don't use
Code:
-march=x86-64
as gcc will try to output code for amd64 and fail. It will be harmless though.

What problems are you having. gcc should be OK.
clang needs version 15 to understand --march=native on your CPU
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3918

PostPosted: Tue Dec 13, 2022 1:01 pm    Post subject: Reply with quote

The say -march=native does not work with Apple M1.
They also say clang15 does support it.
see
https://stackoverflow.com/questions/65966969/why-does-march-native-not-work-on-apple-m1
etc
_________________
:)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54600
Location: 56N 3W

PostPosted: Tue Dec 13, 2022 1:01 pm    Post subject: Reply with quote

Moved from Installing Gentoo to Gentoo on ARM.

Its one of these
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
leonchik1976
Guru
Guru


Joined: 24 Jan 2010
Posts: 337

PostPosted: Tue Dec 13, 2022 1:02 pm    Post subject: Reply with quote

NeddySeagoon wrote:
leonchik1976,

The M1 is an aarch64 CPU. That's 64 bit ARM.
The
Code:
-mlittle-endian -mabi=lp64 -march=armv8-a+crypto+crc+lse+rcpc+rdma+dotprod+fp16fml+sb+ssbs+flagm+pauth -dumpbase -
is what gcc uses for -march=native.

Don't use
Code:
-march=x86-64
as gcc will try to output code for amd64 and fail. It will be harmless though.

What problems are you having. gcc should be OK.
clang needs version 15 to understand --march=native on your CPU


some packages can't build with -marth=native. for example - www-client/chromium.
but now - i can't even upgrade gcc - https://bugs.gentoo.org/884497
Back to top
View user's profile Send private message
leonchik1976
Guru
Guru


Joined: 24 Jan 2010
Posts: 337

PostPosted: Tue Dec 13, 2022 1:05 pm    Post subject: Reply with quote

i have clang 15
sys-devel/clang-15.0.6
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54600
Location: 56N 3W

PostPosted: Tue Dec 13, 2022 1:34 pm    Post subject: Reply with quote

leonchik1976,

Lets test with
Code:
-march=armv8-a+crypto+crc+lse+rcpc+rdma+dotprod+fp16fml+sb+ssbs+flagm+pauth
which is what gcc detected.

That will be used by both gcc and clang.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
leonchik1976
Guru
Guru


Joined: 24 Jan 2010
Posts: 337

PostPosted: Tue Dec 13, 2022 5:34 pm    Post subject: Reply with quote

NeddySeagoon wrote:
leonchik1976,

Lets test with
Code:
-march=armv8-a+crypto+crc+lse+rcpc+rdma+dotprod+fp16fml+sb+ssbs+flagm+pauth
which is what gcc detected.

That will be used by both gcc and clang.


NeddySeagoon, after replacing -march=native with -march=armv8-a+crypto+crc+lse+rcpc+rdma+dotprod+fp16fml+sb+ssbs+flagm+pauth,
i was able to upgrade gcc without any issue.
so - should, i revert now back to -march=native - or leave it expanded?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54600
Location: 56N 3W

PostPosted: Tue Dec 13, 2022 7:01 pm    Post subject: Reply with quote

leonchik1976,

Leave it as expanded. The expanded form is what gcc claims it would do, so there should be no difference ... but one works.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54600
Location: 56N 3W

PostPosted: Tue Dec 13, 2022 8:38 pm    Post subject: Reply with quote

leonchik1976,

See Gentoo Virtual Machine in the UTM App on Macbook Pro M1 Max for a better fix.
-march infers different things on amd64 and arm64.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
flysideways
Guru
Guru


Joined: 29 Jan 2005
Posts: 496

PostPosted: Wed Dec 14, 2022 2:23 am    Post subject: Reply with quote

https://opensource.apple.com/projects/llvm-clang/

LLVM/Clang are not gpl, but rather a modified Apache. https://llvm.org/LICENSE.txt
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum