Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore -march=native for arm64 architecture #181

Merged
merged 1 commit into from
Jun 9, 2023

Conversation

chocolacula
Copy link
Contributor

@chocolacula chocolacula commented Jun 5, 2023

Flag "-march=native" leads to errors on arm CPU and new compilers, at least clang-15 and above. Without the flag it works on clang 14, 15 and 17. Checked on MacOS with M1 CPU and Linux aarch64. To be honest I cannot find official documentation which mentions it enabled by default but many people say about that in the internet, so I'm not sure about the comment message.

Please let me know if something in the commit is not right.

@genivia-inc
Copy link
Member

Thank you for the feedback. Let me take a look at this.

I've used RE/flex with Android ARM, Raspberry Pi, and MacBook M1 PRO without any issues. I am aware that the arch native switch isn't recommended, but it doesn't do harm either and I ran actually into issues when I omitted it as I could not compile RE/flex (and ugrep) on a RPi Zero ARM7 with gcc. So I worry about this more than having the switch in place.

@chocolacula
Copy link
Contributor Author

chocolacula commented Jun 6, 2023

A bit of clarification:

  • ARM7 is 32bit CPU, branch with -march=native will be chosen
  • I've got errors depending on compiler and it's version

GCC 11 on Ubuntu 22.04 aarch64 has errors:

c++: error: unrecognized command-line option '-mfpu=neon'

AppleClang 12, AppleClang 14, manually compiled Clang 17 has warnings

clang: warning: argument unused during compilation: '-mfpu=neon'

manually compiled Clang 15 on MacOS surprisingly produces errors

clang: error: the clang compiler does not support '-march=native'

It seems warning/error behaviour is not stable for both GCC and Clang of different versions on 64 bit ARM.

@chocolacula
Copy link
Contributor Author

I found similar issues in other repos even with older compiler versions. For example DMOJ/judge-server#303

@genivia-inc
Copy link
Member

I will take a look. I only have a Mac M1, Android ARM device, and Raspberry Pi ARM to test with using GCC, which do not report any compilation issues. I'll try to install clang if necessary. I will report back when I collected more info and results.

@genivia-inc
Copy link
Member

By the way, I forgot to ask, but are you using ./build.sh to compile? This checks for -march=native and doesn't use it when unsupported. This is the preferred way to install reflex.

@genivia-inc genivia-inc merged commit 54a6560 into Genivia:master Jun 9, 2023
@chocolacula
Copy link
Contributor Author

Thank you for the merge. I am using CMake to build RE-flex as a dependency. I was really happy to see CMake support in one of last releases.

@arnoldrobbins
Copy link

@genivia-inc Check out the GCC Compile Farm for access to lots of different systems and compilers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants