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

M1 Mac chip fix #30

Merged
merged 4 commits into from Mar 10, 2023
Merged

M1 Mac chip fix #30

merged 4 commits into from Mar 10, 2023

Conversation

MacPapo
Copy link
Contributor

@MacPapo MacPapo commented Mar 9, 2023

Hi @abougouffa, I created this pull request to close the issue on Mac M chips that currently doesn't compile at all because of compiler flags.

(defun disaster--arch-flags ()
  "Select the right flags depending on the right architecture."
  (if ((lambda () "Optimize for M1 family if true"
         (and (eq system-type 'darwin)
              (string= "arm64" (string-trim (shell-command-to-string "uname -m"))))))
      "-mcpu=apple-m1"
    "-march=native"))

This is the function that select the right comp flag when starting disaster.

Mac M1 chip fix for specific compile flags.
This patch the march=native flag that is not currently supported in gcc
for mac M1 family chips. Simply check if the system is an arm64 version
of darwin kernel and substitute the march to mcpu=apple-m1 for native
comp.
@abougouffa abougouffa self-assigned this Mar 10, 2023
@MacPapo
Copy link
Contributor Author

MacPapo commented Mar 10, 2023

I'm very sorry, but I still can't see any comments over the code.

@abougouffa
Copy link
Collaborator

abougouffa commented Mar 10, 2023

They are not comments in a programming language sense (not Elisp lines starting with ;), they are code reviews. When you click on "Files changed" or here #30, you will find some remarks about two particular lines.

image

OR

image

@MacPapo
Copy link
Contributor Author

MacPapo commented Mar 10, 2023

Not having been assigned to the pull request, I can't see these comments, but from the photo I have fixed the first of the two lines. Could you send me a photo of the second line to fix?

@abougouffa
Copy link
Collaborator

Can you see them now?

Anyway, this is the second comment:

Screenshot_20230310_220132

disaster.el Outdated Show resolved Hide resolved
disaster.el Outdated
"Command line options to use when compiling Fortran."
:group 'disaster
:type 'string)

(defcustom disaster-objdump
(concat (if (eq system-type 'darwin) "gobjdump" "objdump")
" -d -M att -Sl --no-show-raw-insn")
"objdump -d -M att -Sl --no-show-raw-insn"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't test this as I don't have a Mac. However, I think this can cause an issue on other Mac architectures (see #22)

If the tool is named objdump on your machine, you can customize the variable when loading disaster.

(use-package disaster
  :ensure t
  :custom 
  (disaster-objdump "objdump -d -M att -Sl --no-show-raw-insn"))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On mac m1 we can't use gobjdump, we need the counterpart made for clang. I fixed that if it's a standard intel mac then gobjdump otherwise just objdump.

disaster.el Outdated Show resolved Hide resolved
@abougouffa abougouffa merged commit 50232ae into jart:master Mar 10, 2023
@abougouffa
Copy link
Collaborator

LGTM, merged! Thanks @MacPapo

@MacPapo
Copy link
Contributor Author

MacPapo commented Mar 10, 2023

Thank you @abougouffa for the attention and trust you have given me.

@abougouffa
Copy link
Collaborator

You're welcome @MacPapo. It is me who should thank you for your contribution!

@MacPapo MacPapo deleted the mac-m1-fix branch March 10, 2023 22:46
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.

None yet

2 participants