-
Notifications
You must be signed in to change notification settings - Fork 93
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
Support Apple Silicon (ARM64) #187
Comments
You can tweak the Xcode project to build for whatever architectures you want that Xcode supports. It might take a while before CMake offers that as an automatic choice, or it might be possible to manually override it today. But either way, you can adjust the Xcode project to do whatever you like. |
It sounds like a new version of CMake may not be required, just a tweak to the makefile: https://mobile.twitter.com/kubamracek/status/1275545458706755584 |
I'm trying to build MultiMarkdown with the
Is this related to what you were saying above? If yes, what do I have to do to make the build work? (I'm not an expert with CMake and environment variables.) |
I'll need to look at the |
I think you can fix this when building for x86_64 by adding |
Thanks a lot, that line fixed the build. Unfortunately I'm unable to support you in providing a general fix (it sounds like we need a different solution for arm64), since I know very little about CMake etc, but it would be great if someone could figure out how to fix this in the near future. |
I am running macOS 10.15.7 on a Late 2014 Mac mini (surprisingly this machine does everything I need it to!) and using Xcode 12.0.1. Whether I use MultiMarkdown or a new Xcode project, I don't seem to be able to compile for arm64 (Mac), only x86_64. I can build for arm64 for iOS (last I checked anyways). My Architectures Build Setting shows "Standard architectures - Is there something obvious I am missing? I'm trying to come up with the proper Cmake configuration to allow universal binaries in anticipate of Silicon computers becoming widespread. Thanks! |
I just pushed a couple of updates. 6.6.0 uses a revised Cmake configuration that works better for me on Xcode 12 with x86_64. I think it should work better when transitioning towards ARM, but have not tested it yet (I don't have an ARM machine). Input appreciated! |
Thanks for jumping on this! I have a total of 24 third-party libraries to recompile for Apple Silicon and it's been a nightmare of trying to figure out most of them. It's nice to see this project staying ahead of the curve! |
Okay, I've built the framework for
This produced an error:
It sounded to me like the script couldn't find Cmake something-or-other, so I unzipped a fresh copy of the source code and then:
CMake now built the Xcode project. I opened that in Xcode and noticed that several settings were messed up by CMake:
So, I then:
Inspecting the compiled framework with
|
Hmm. I may have spoken too soon. When I attempt to USE the compiled framework in my app, I now get several errors related to undefined functions for
I think that's related to 8afd127#diff-47babe9dd5e41858b6944d0e59f0f8656922ae67efa9f1251f4ef09d6e10ff08 In the headers I'm getting, this change is not included; I still see:
I can modify the header, but when I do that the Linker gives me this: I think if I modify the header BEFORE I compile the framework, that should solve this? |
@bdkjones -- a couple of issues
|
That looks right, but you have to be certain that libMultiMarkdown can only be used on a single thread at a time. The object pool is a single shared instance, so freeing it in one thread would wreck another thread that was using it. In a multithreaded application, that might be difficult, and might take more overhead and trouble than you gain in performance. Also, it doesn't speed compiling time, it speeds processing time when converting text to HTML. |
Yea. As far as I know, the XPC service is single-threaded. It doesn't matter how many threads from the host application call into the service, the service has only one thread. I've tested it by pummeling the thing with hundreds of MD files to compile and have never had a crash. By "compiling" in the comment I meant the processing of MD to HTML; not the compiling of the app in Xcode. |
I can also confirm that the Universal binary is working (at least on x86_64). After cloning the repo (instead of downloading the zipped source code from the latest release tag) running |
What were the arch settings prior to changing them? It should have defaulted to Standard architectures and "No" to build active only. The goal is for you not to have to manually adjust anything for standard uses of the library. |
Can you make a fresh copy of the .xcodeproj, open it, change one setting and then undo that change (in order to ensure Xcode rewrites the file), and then zip/send it to me? I'm trying to see what is different. On my build libMultiMarkdown has Build Active Arch Only set to No and Arch set to $(ARCHS_STANDARD). Thanks! (It might be a while before I get a Silicon machine, so I can test this myself yet.) |
My app uses 29 libraries/frameworks, so I've been using CMake a LOT. It's doing the same thing on all other libraries I'm building as well—the same settings show up in the generated Xcode project. |
What version of CMake are you using? |
Since updating to macOS Big Sur, I get this output for the command
I ran |
After uninstalling Homebrew and hence cmake, reinstalling both, and running |
With the CMakeList changes introduced recently, I building on Intel Macs for both architectures works. I believe this also solves building on an ARM Mac. Can anyone with an M1 Mac try the latest |
Closing -- I have been using libMultiMarkdown via CMake for nvUltra for quite a while and building for x86 and ARM universal binaries without trouble. |
I realize it was just announced, but there are six months until ARM Macs are in the wild. To be ready for them, apps that integrate
libmultimarkdown
need to be able to build a Universal version of the library. To rebuild, they'll first need a Universal version of the MultiMarkdown library.The CMake dependency probably complicates this transition a lot because I imagine it won't be possible to build a Universal version of
libmultimarkdown
until CMake supports ARM64.However, because this is a blocker for any apps that include MultiMarkdown, I wanted to open the issue so progress could be tracked and any related problems could be discussed. Thanks for your help!
The text was updated successfully, but these errors were encountered: