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

clang build fix march=native is unsupported #165

Closed
wants to merge 2 commits into from

Conversation

devnexen
Copy link
Contributor

No description provided.

@Screwtapello
Copy link
Contributor

Which versions of clang do not support -march=native?

$ clang --version
Debian clang version 11.0.1-2
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ clang -march=native -o werder werder.c
$ ls -l werder
-rwxr-xr-x 1 st st 16864 Mar 20 22:40 werder

@devnexen
Copy link
Contributor Author

devnexen commented Mar 20, 2021

clang/xcode specifically (Mac M1)

@jchv
Copy link
Contributor

jchv commented Mar 20, 2021

In general, clang does support this flag, on x86 machines, so it is not a good idea to not set it whenever clang is being used. Detecting that we’re on a setup that doesn’t support -march will require some better detection. For now my workaround for the problem is to just pass local=false to make when building on M1.

@Screwtapello
Copy link
Contributor

After some scrounging around, I found an article discussing tuning flags across ARM and x86. Apparently -march, -mcpu and -mtune mean different things, and x86's -march is roughly equivalent to ARM's -mcpu, it doesn't have anything to do with macOS, and it's not even specific to Clang/LLVM (although GCC is friendlier to x86 compiler flags).

@devnexen
Copy link
Contributor Author

seems to work on Mac M1.

@Screwtapello
Copy link
Contributor

Thank you for looking into this! I've made an expanded version of this change in #167, preserving you as the patch author. If you could look over that change and confirm I haven't missed anything, I'll land it.

@devnexen
Copy link
Contributor Author

All good

@Screwtapello
Copy link
Contributor

I've merged #167, so higan should build cleanly on M1 Macs by default now. Again, thank you for your help!

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