WebView
WebView copied to clipboard
M1 ARM Mac support
Hi, I tried to open the WebView on a M1 Mac with ARM CPU but it doesn't work. Is there any way to run it on ARM Macs?
Hi,
It works with the Rosetta emulation. What error are you getting?
I'll try to explain my whole situation. I'm developing a cross-platform app that needs to run on both Windows and Mac with both x64 and ARM cpu architecture support, with specific self-contained and architecture dependent builds. On x64 I have no problem, while on ARM I get crashes.
I noticed that on M1 Mac I don't get the dialog that asks me to install Rosetta (like explained here). I think that happens because the app is built for ARM, so Mac thinks there is no need to install Rosetta. Any ideas?
By the way, will there be any native support for ARM architectures for both Windows and Mac?
To work natively on Apple Silicon chips this project needs 2 upgrades:
- CEF, the underlying browser engine, (CefGlue) needs to be upgraded to version 93+
- .Net 6 - this is the first .net with M1 support
Have you tried installing Rosetta?
At the moment I can't try with Rosetta because I don't have a M1 Mac, I received the feedback from a client that has one. By the way, I'll try to find a way to try it, maybe asking him to install directly the x64 version on his M1.
By the way, if you don't mind me asking, is there any plan to upgrade CEF and NET to the latest versions in order to support natively Apple Silicon chips?
I don't have an M1 also... so I can't assist on that now. We don't have plans yet to do the upgrade. .Net upgrade should be easy... CEF upgrade can give a little bit more troubles (it depends on CEF apis breaking changes).
All clear, thanks. I'll let you know if I get any news
Is there any news on this ? I'm trying to create an native Mac ARM app with .net 6.0.
After building my app I receive the message "Unhandled exception. System.BadImageFormatException: Could not load file or assembly 'WebViewControl.Avalonia, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. An attempt was made to load a program with an incorrect format."
I don't know if this message is about the CEF framework or de WebView library.
I;ve managed to build a native CEF build. But this does not generate the libcef.dylib anymore, but the "Chromium Embedded Framework.framework". So I can't quite figure out how to implement this.
Well, I still don't have Apple Silicon, so can't help on that. :(
After building my app I receive the message "Unhandled exception. System.BadImageFormatException: Could not load file or assembly 'WebViewControl.Avalonia, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. An attempt was made to load a program with an incorrect format."
Having the same issue. I will do some more investigating and see if I can find a solution. I may be in over my head.
@rickkock I have managed to get it to run on Rosetta by publishing and osx-x64
version.
I cannot get it to launch from Rider/debug even with an osx-x64
or x64
build configuration. That is the next hurtle.
I've got it fully worked on M1 native now.
What I did was compiled both CefGlue (including the browser process etc.) and WebView from source on the M1 Mac
After that I've downloaded the corresponding version of CEF from https://cef-builds.spotifycdn.com/index.html#macosarm64:91.1.6
Form here I've extracted the libcef.dylib (renamed the "Chromium Embedded Framework" file from the "Chromium Embedded Framework.framework" directory) and copy it all to the output folder of my application.
Hi @rickkock May I suggest you open a PR on CefGlue with those changes? Also you may find here the cef packaging scripts for macOS: https://github.com/OutSystems/cef.redist.osx
Also according to this thread: version 93 was the first official version to support ARM64 on Apple Silicon chips.
I didn't make any changes to CefGlue or WebView, I just compiled it on an M1 to create an anycpu library. For some reason the nuget package provides an x64 library. That's why the System.BadImageFormatException occurs.
I did the part of cef.redist script by hand, because I didn't know that there was a script for.
Also there is an arm64 build of CEF for the version 91.1.6. Witch is these same version used in the cef.redist.osx package. The only downside is that this is an beta version of CEF, but that it is also for the x64 version of OSX.
There is.. but according to that thread, it might not be "stable", since the first version supported was 93. Was just suggesting submitting a PR because other people might want to use it. I dont have M1 so I cant provide a solution as of now.
Hi, just to update on this thread: the current version of WebView in master supports ARM64 natively