Skip to content
This repository has been archived by the owner on Jan 15, 2023. It is now read-only.

Crossplat demo does not work on Mac #27

Closed
xplicit opened this issue Nov 9, 2020 · 7 comments
Closed

Crossplat demo does not work on Mac #27

xplicit opened this issue Nov 9, 2020 · 7 comments

Comments

@xplicit
Copy link

xplicit commented Nov 9, 2020

When I run it, I've got crash in libcef.dylib, last messages in terminal are

[1110/052302.260519:ERROR:icu_util.cc(177)] icudtl.dat not found in bundle
[1110/052302.260615:ERROR:icu_util.cc(241)] Invalid file descriptor to ICU data received.

StackTrace:

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BREAKPOINT (SIGTRAP)
Exception Codes:       0x0000000000000002, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Trace/BPT trap: 5
Termination Reason:    Namespace SIGNAL, Code 0x5
Terminating Process:   exc handler [28272]

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libcef.dylib                  	0x00000001a667aaa5 ChromeAppModeStart_v6 + 3007717
1   libcef.dylib                  	0x00000001a667c3d0 ChromeAppModeStart_v6 + 3014160
2   libcef.dylib                  	0x00000001a8f46b42 cef_time_delta + 39472562
3   libcef.dylib                  	0x00000001a68f76b7 ChromeAppModeStart_v6 + 5615863
4   libcef.dylib                  	0x00000001a68f712c ChromeAppModeStart_v6 + 5614444
5   libcef.dylib                  	0x00000001a403909b cef_initialize + 283
6   ???                           	0x000000011bb5f3df 0 + 4759876575
7   ???                           	0x000000011bb5c73a 0 + 4759865146
8   ???                           	0x000000011bb4ed47 0 + 4759809351
9   ???                           	0x000000011bb4d8a8 0 + 4759804072
10  ???                           	0x000000011bb45f5f 0 + 4759773023
11  ???                           	0x000000011ae80523 0 + 4746380579
12  libcoreclr.dylib              	0x000000010c40742b CallDescrWorkerInternal + 124
13  libcoreclr.dylib              	0x000000010c253239 MethodDescCallSite::CallTargetWorker(unsigned long const*, unsigned long*, int) + 1657
14  libcoreclr.dylib              	0x000000010c11ac26 RunMain(MethodDesc*, short, int*, PtrArray**) + 726
15  libcoreclr.dylib              	0x000000010c11af98 Assembly::ExecuteMainMethod(PtrArray**, int) + 408
16  libcoreclr.dylib              	0x000000010c15b548 CorHost2::ExecuteAssembly(unsigned int, char16_t const*, int, char16_t const**, unsigned int*) + 504
17  libcoreclr.dylib              	0x000000010c092832 coreclr_execute_assembly + 226
18  libhostpolicy.dylib           	0x000000010c0069a7 0x10bff6000 + 68007
19  libhostpolicy.dylib           	0x000000010c00797e 0x10bff6000 + 72062
20  libhostfxr.dylib              	0x000000010bfbb8ef 0x10bf92000 + 170223
21  libhostfxr.dylib              	0x000000010bfbabe2 0x10bf92000 + 166882
22  libhostfxr.dylib              	0x000000010bfb6bea 0x10bf92000 + 150506
23  dotnet                        	0x000000010bf42402 0x10bf36000 + 50178
24  dotnet                        	0x000000010bf429f5 0x10bf36000 + 51701
25  libdyld.dylib                 	0x00007fff6805bcc9 start + 1
@mattkol
Copy link
Member

mattkol commented Nov 10, 2020

@xplicit the reason you are seeing what you are seeing is because of the CEF download process. There seems to be a timing issue between the actual application run and CEF download process. Seems like the app timesout waiting for the download to complete.

After the error and a successful CEF download, run it again:

dotnet run

image
image

@xplicit
Copy link
Author

xplicit commented Nov 11, 2020

Yeah, It's working, if start again.

I workarounded that by setting FrameworkDirPath in chromely source and placing CEF binaries during build into output folder.

            var settings = new CefSettings
            {
                MultiThreadedMessageLoop = _config.Platform == ChromelyPlatform.Windows,
                LogSeverity = CefLogSeverity.Info,
                LogFile = "logs\\chromely.cef_" + DateTime.Now.ToString("yyyyMMdd") + ".log",
                ResourcesDirPath = Path.Combine(_config.AppExeLocation, "Resources"),
                FrameworkDirPath = _config.AppExeLocation
            };

Can we add the ability to override CefSettings which are used in HostBase from user code? I see there is a extension method to update them from string dictionary, but it does not contain all settings , for example, FrameworkDirPath is not in the dictionary. It would be simper to path the settings from the object, because in this case we can see all available properties from IDE

@xplicit
Copy link
Author

xplicit commented Nov 11, 2020

If run with command dotnet run it works. If change directory to bin folder and run crossplatdemo binary from that folder it shows error message about icudtl.dat file (even when CEF files downloaded). If set FrameworkDirPath = _config.AppExeLocation it also works when run binary from bin folder.

@IlyaSemenov
Copy link

Apple M1 heads up

On Apple Silicon, it is required to use <RuntimeIdentifier>osx-x64</RuntimeIdentifier> or build with dotnet run -r osx-x64, or you will get the same error (icudtl.dat not found in bundle).

On Intel Mac, it used to work fine without explicit runtime identifier.

@mikhey
Copy link

mikhey commented Sep 21, 2021

I'm encountering this on an Intel Mac and no matter what I do, I cannot seem to get it to work... with dotnet run or attempting to set the custom CefConfiguration settings i.e. Framework Dir. It's very frustrating!

@wwarby
Copy link

wwarby commented Nov 23, 2021

I'm still experimenting with this, but as a first step I tried running every single demo app on Mac OS. None of them worked, but the variety of different ways in which they failed was impressive :) For further testing, which ones would you expect to work out-of-the-box?

Here are my results:

ServerAppDemo: BlazorChromelyTest

System.PlatformNotSupportedException: Named maps are not supported.
   at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateCore(FileStream fileStream, String mapName, HandleInheritability inheritability, MemoryMappedFileAccess access, MemoryMappedFileOptions options, Int64 capacity)
   at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateNew(String mapName, Int64 capacity, MemoryMappedFileAccess access, MemoryMappedFileOptions options, HandleInheritability inheritability)
   at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateNew(String mapName, Int64 capacity)
   at ServerAppDemo.ServerAppUtil.SavePort(String appName, Int32 port) in /Users/wwarby/Desktop/demo-projects-master/blazor/ServerAppDemo/ServerAppUtil.cs:line 66
   at ServerAppDemo.Program.Main(String[] args) in /Users/wwarby/Desktop/demo-projects-master/blazor/ServerAppDemo/Program.cs:line 46

WebAssemblyBlazorComponents: BlazorComponents

  WebAssemblyBlazorComponents.csproj(22, 5): [MSB3073] The command "xcopy "/Users/wwarby/Desktop/demo-projects-master/blazor/WebAssemblyBlazorComponents/wwwroot" "/Users/wwarby/Desktop/demo-projects-master/blazor/\WebAssemblyBlazorComponentsDemo\bin\x64\Debug\netcoreapp3.1\win-x64\app"   /i /s /r /y /c
xcopy "/Users/wwarby/Desktop/demo-projects-master/blazor/WebAssemblyBlazorComponents/bin/Debug/netstandard2.1/dist" "/Users/wwarby/Desktop/demo-projects-master/blazor/\WebAssemblyBlazorComponentsDemo\bin\x64\Debug\netcoreapp3.1\win-x64\app"   /i /s /r /y /c" exited with code 127.

WebAssemblyChromelyControllers: BlazorControllers

  WebAssemblyChromelyControllers.csproj(22, 5): [MSB3073] The command "xcopy "/Users/wwarby/Desktop/demo-projects-master/blazor/WebAssemblyChromelyControllers/wwwroot" "/Users/wwarby/Desktop/demo-projects-master/blazor/\WebAssemblyChromelyControllersDemo\bin\x64\Debug\netcoreapp3.1\win-x64\app"   /i /s /r /y /c
xcopy "/Users/wwarby/Desktop/demo-projects-master/blazor/WebAssemblyChromelyControllers/bin/Debug/netstandard2.1/dist" "/Users/wwarby/Desktop/demo-projects-master/blazor/\WebAssemblyChromelyControllersDemo\bin\x64\Debug\netcoreapp3.1\win-x64\app"   /i /s /r /y /c
" exited with code 127.

WebAssemblyBlazorComponentsDemo

/Applications/Rider.app/Contents/lib/ReSharperHost/macos-x64/dotnet/dotnet exec /Applications/Rider.app/Contents/lib/ReSharperHost/JetBrains.Debugger.Worker.exe --mode=client --frontend-port=55332 --plugins=
One or more errors occurred. (Started a process for debugging, but no CoreCLR runtime was seen to be loaded within the 00:00:16 time limit.)

WebAssemblyChromelyControllersDemo

/Applications/Rider.app/Contents/lib/ReSharperHost/macos-x64/dotnet/dotnet exec /Applications/Rider.app/Contents/lib/ReSharperHost/JetBrains.Debugger.Worker.exe --mode=client --frontend-port=55376 --plugins=
One or more errors occurred. (Started a process for debugging, but no CoreCLR runtime was seen to be loaded within the 00:00:16 time limit.)

ChromelyAngular

  ChromelyAngular.csproj(71, 5): [MSB3073] The command "xcopy "/Users/wwarby/Desktop/demo-projects-master/angular-react-vue/ChromelyAngular/angularapp/dist" "/Users/wwarby/Desktop/demo-projects-master/angular-react-vue/ChromelyAngular/bin/x64/Debug/netcoreapp3.1/win-x64/dist"   /i /s /r /y /c" exited with code 127.

Fix the above with rsync, then got:

  Microsoft.NET.Sdk.targets(464, 5): [NETSDK1074] The application host executable will not be customized because adding resources requires that the build be performed on Windows (excluding Nano Server).

Fix the above with <RuntimeIdentifier>osx-x64</RuntimeIdentifier>, then got:

[Shows both browser pages downloading CEF binaries]

Dialog box: chromely_angular quit unexpectedly (send to Apple)

      Unable to load shared library 'libcef' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(liblibcef, 0x0001): tried: 'liblibcef' (no such file), '/usr/local/lib/liblibcef' (no such file), '/usr/lib/liblibcef' (no such file), '/Users/wwarby/Desktop/demo-projects-master/angular-react-vue/ChromelyAngular/bin/x64/Debug/netcoreapp3.1/osx-x64/liblibcef' (no such file), '/usr/local/lib/liblibcef' (no such file), '/usr/lib/liblibcef' (no such file)
System.DllNotFoundException: Unable to load shared library 'libcef' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(liblibcef, 0x0001): tried: 'liblibcef' (no such file), '/usr/local/lib/liblibcef' (no such file), '/usr/lib/liblibcef' (no such file), '/Users/wwarby/Desktop/demo-projects-master/angular-react-vue/ChromelyAngular/bin/x64/Debug/netcoreapp3.1/osx-x64/liblibcef' (no such file), '/usr/local/lib/liblibcef' (no such file), '/usr/lib/liblibcef' (no such file)
...
[1123/200746.936974:ERROR:icu_util.cc(178)] icudtl.dat not found in bundle
[1123/200746.937085:ERROR:icu_util.cc(242)] Invalid file descriptor to ICU data received.

ChromelyReact

  ChromelyReact.csproj(71, 5): [MSB3073] The command "xcopy "/Users/wwarby/Desktop/demo-projects-master/angular-react-vue/ChromelyReact/reactapp/dist" "/Users/wwarby/Desktop/demo-projects-master/angular-react-vue/ChromelyReact/bin/x64/Debug/netcoreapp3.1/win-x64/dist"   /i /s /r /y /c" exited with code 127.

ChromelyVue

  ChromelyVue.csproj(71, 5): [MSB3073] The command "xcopy "/Users/wwarby/Desktop/demo-projects-master/angular-react-vue/ChromelyVue/vueapp/dist" "/Users/wwarby/Desktop/demo-projects-master/angular-react-vue/ChromelyVue/bin/x64/Debug/netcoreapp3.1/win-x64/dist"   /i /s /r /y /c" exited with code 127.

web-chromely-bootstrap4: Chromely

  web-chromely-bootstrap4.csproj(54, 5): [MSB3073] The command "npm run build:dev" exited with code 127.

web-chromely-bootstrap4: Web.Chromely.Bootstrap4

  web-chromely-bootstrap4.csproj(54, 5): [MSB3073] The command "npm run build:dev" exited with code 127.

web-chromely-mvc: Chromely

[1123/201602.662225:ERROR:icu_util.cc(178)] icudtl.dat not found in bundle
[1123/201602.662397:ERROR:icu_util.cc(242)] Invalid file descriptor to ICU data received.

web-chromely-mvc: web.chromely.mvc

Launched a web browser to http://localhost:1111/, not Chromely

CefSharpDemo

  Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(59, 5): [NETSDK1100] Windows is required to build Windows desktop applications.

CrossPlatDemo

/Applications/Rider.app/Contents/lib/ReSharperHost/macos-x64/dotnet/dotnet exec /Applications/Rider.app/Contents/lib/ReSharperHost/JetBrains.Debugger.Worker.exe --mode=client --frontend-port=56112 --plugins=
One or more errors occurred. (Started a process for debugging, but no CoreCLR runtime was seen to be loaded within the 00:00:16 time limit.)

NetFrameworkDemo

[Shows both browser pages downloading CEF binaries]

System.DllNotFoundException: libcef assembly:<unknown assembly> type:<unknown type> member:(null)
  at (wrapper managed-to-native) Xilium.CefGlue.Interop.libcef.api_hash(int)
  at Xilium.CefGlue.CefRuntime.CheckVersionByApiHash () [0x00000] in <7a3bd74ddb9d4fa4bb186c17fc43fcbb>:0 
  at Xilium.CefGlue.CefRuntime.CheckVersion () [0x00000] in <7a3bd74ddb9d4fa4bb186c17fc43fcbb>:0 
  at Xilium.CefGlue.CefRuntime.Load (System.String path) [0x0002a] in <7a3bd74ddb9d4fa4bb186c17fc43fcbb>:0 
  at Xilium.CefGlue.CefRuntime.Load () [0x00000] in <7a3bd74ddb9d4fa4bb186c17fc43fcbb>:0 
  at Xilium.CefGlue.CefRuntime.LoadIfNeed () [0x00007] in <7a3bd74ddb9d4fa4bb186c17fc43fcbb>:0 
  at Xilium.CefGlue.CefRuntime.Initialize (Xilium.CefGlue.CefMainArgs args, Xilium.CefGlue.CefSettings settings, Xilium.CefGlue.CefApp application, System.IntPtr windowsSandboxInfo) [0x00000] in <7a3bd74ddb9d4fa4bb186c17fc43fcbb>:0 
  at Chromely.WindowController.RunInternal (System.String[] args) [0x00231] in <7a3bd74ddb9d4fa4bb186c17fc43fcbb>:0 
  at Chromely.WindowController.Run (System.String[] args) [0x00000] in <7a3bd74ddb9d4fa4bb186c17fc43fcbb>:0 

In my own app I additionally managed to generate a The cache_path directory (/usr/share/MyAppName/chromely-cache) could not be created. error somehow.

I'm going to concentrate on the Angular scenario, since that's what my app is, and I've fixed the superficial issues that cause it to not build out-of-the-box and now I get the same results in the demo app (more or less) as I do in my own app. I'm not clear from this thread though what the solution is. Running it a second time seems to be the proposed solution - that definitely doesn't work in my case.

@mattkol
Copy link
Member

mattkol commented Dec 11, 2021

@wwarby sorry I was not really monitoring this issue since it was closed, but just seeing this. Please let me know if yo still need some inputs, Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants