-
Notifications
You must be signed in to change notification settings - Fork 10
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
Mac M1 Support for Cmake #87
Comments
Is there an example to compare against? I do not own a Macintosh of that type, unfortunately (only Intel based), and that probably will not change for quite some time. If you are aware of the fix, please make a PR that targets CMake with the appropriate guards for that platform, otherwise I will be unable to incorporate or validate those arguments. |
I will attempt a few fixes on my side and do a PR or a diff after some testing. Thanks! |
So I did it (sort of). I forked and pushed the few changes I did here: I did have to add this: src/md5_conv/sse2neon.h -> it seems M1 Macs do not have this file at all (I compiled the header from its github repo). I also have a binary here (with stack traces and link.txt): Maybe this will be useful to get it working in the future on M1's once they become more popular. I'm more than willing to assist with debugging this however. |
It looks like it crashes around where it does the config parse. On your system, do you see "edge.ini" created anywhere? I only ask because that's where it appears to have segfaulted on your M1. If we have a config created then it might be further down in startup. If a config file is not created in whatever directory EDGE writes it to, then it might be a bug with the way the file system is set up on MacOSX, where it might be unable to find, read or write to the homedir (or equivalent). . |
So what happens is the EDGE2 directory is created in Library/Application Support. However, the EDGE.ini is not created. So I took the default EDGE.ini from Windows and put it in the same location. Error is now: both Vi and Emacs do not list any whitespace in the file. I also used 'cp' rather than any GUI editors to copy the file, to preserve the contents. |
This is sounding like a path issue. EDGE is probably not finding its own directory to read off the files/folders it needs; in the same directory you put EDGE.ini into, also put the "base" folder into it. |
@atsb Looking into src\dstrings.h, I see some defines at the bottom. I'm not sure if recent versions of Macintosh have changed the subdir expectation or not. It might be a combined issue between post-building on OSX (making sure files are copied via CMake/Clang to the right location), and EDGE itself setting this EDGEHOMESUBDIR directive properly:
|
I think you may be right. Safest thing to do would be that I would modify them to simply look into the same directory as the binary. Then go from there. |
@atsb Let me know how I can help! Looking forward to supporting the M1 in EDGE 😊 |
So I've been working on this silently, I've been debugging it probably way to much, but it always fails at: m_toml.h
It actually also fails on my Intel Mac too. The INI file generated is (pasted only part of it):
The only whitespace being the tabulature lines between the config and the value. It may or may not be relevant, but I was also helping on the 'https://github.com/dashodanger/EDGE-classic' fork (a fork of EDGE 1.35). Now it uses the same format (.cfg instead of .ini) endings, and this one works fine. I know a lot changed from 1.x to 2.x but it definitely seems to be incorrectly parsing the config file. I've also tried modifying the path to be the same as the binary itself, removing all whitespace from directory paths etc.. |
I'll fire up my intel Macbook Pro here shortly. Please post the compiler error also if you can as well (assuming you are using XCode). I've since fixed a few things with this via 695e8e7, so please pull and recompile to see if we are still running into the problem. I can't verify if it fixes Mac yet. |
I tried it from that commit and from the latest master. Seems the CMake file is now broken on a Mac (and finds SDL1 instead of SDL2).
|
Wait - that’s not EDGE. I think you are building EDGE-Classic.. They didn’t fork from the official EDGE repo so their structure and build system is completely different. For instance, we don’t use GLEW anymore and our repo structure isn’t like how Classic structures it but instead largely how it’s been supported historically. Please make sure you are pulling from the EDGE repo and try again 🤭😅😎 |
Oh dear, I didn't even realise. Serves me right for naming the two folders almost identically! Edit: Make still adds ''-mtune=cortex-a7'' to M1 builds, I'll apply my local fixes to get it building. I'll test also on my intel mac as that is a bit easier (does not require this patching). |
So I made this little change to stop the cortex arm setting on Macs.
Edit So it still fails at the exact same point. I have base, all the ddf's, the epk file etc..
I also use this sse2neon header from its GitHub repo (because M1 macs do not contain it at all, I'm guessing officially, it is no longer supported, because it cannot be supported on non-Intel hardware anymore). It compiles obviously, but might be worth checking and disabling such things for M1 architectures. Edit Another fix I did (to fix the link.txt errors)
You don't need the SDL2 and COCOA_LIBRARY in the target_link_libraries line. Since it is also linking against the frameworks and dynamic library from SDL2_LIBRARY_DIR. I confirmed this on both Intel and M1 Macs (Big Sur and Monterey). |
…ue to the arm with no system specified) (#92)
Generating a Unix Makefile for an M1 Mac incorrectly adds
-mtune=cortex
to some build arguments for coal.M1 Macs do not support and do not require regular ARM mtune arguments (Apple Clang on M1 does not support them either). These need to be removed when generating on an M1.
The text was updated successfully, but these errors were encountered: