Closed StigOlavsen closed 7 years ago
Could it be a case-sensitivity issue?
I notice when i delete my obj and bin folders, and then do a dotnet restore, the generated project.assets.json
file has the following section
"JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64/2.4.1": {
"type": "package",
"runtimeTargets": {
"runtimes/osx-x64/native/libChakraCore.dylib": {
"assetType": "native",
"rid": "osx-x64"
}
}
},
Which specifies JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64
, while in the nuget folder it is all lowercase javascriptengineswitcher.chakracore.native.osx-x64
.
Hello, H0rdak!
I'm having an issue where the ChakraCore DLL is not found, even if the JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64 package is installed.
While no one wrote about such errors. I use a similar deployment scheme in two packages: JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64 and LibSassHost.Native.osx-x64.
I'm running the project on OSX Sierra 10.12.4:
Darwin MacBook-Pro.local 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar 3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64
I have built and tested the ChakraCore on OS X El Capitan10.11.6:
Darwin Drons-Mac.local 15.6.0 Darwin Kernel Version 15.6.0: Fri Feb 17 10:21:18 PST 2017; root:xnu-3248.60.11.4.1~1/RELEASE_X86_64 x86_64
Which specifies
JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64
, while in the nuget folder it is all lowercasejavascriptengineswitcher.chakracore.native.osx-x64
.
My nuget folder is preserved case sensitive - ~/.nuget/packages/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64
. But I think, that this should not matter, because .NET Core Runtime manages independently loading of native assemblies. I just place the native assembly in runtimes/osx-x64/native
directory of NuGet package.
Try to register the ChakraCore library manually:
ln -s ~/.nuget/packages/javascriptengineswitcher.chakracore.native.osx-x64/2.4.1/runtimes/osx-x64/native/libChakraCore.dylib /usr/local/lib/
Thanks for your reply. I will try to manually symlink later.
Do you know where I can find any information about how dotnet core handles loading of native assemblies for nuget packages? Maybe this is an upstream bug in dotnet?
There is very little information on this theme and part of it is already outdated: “Using native libraries in ASP.NET 5”, “Developing Libraries with Cross Platform Tools” and “.NET Core Runtime IDentifier (RID) catalog”.
So trying with the symlink gives the same error.
Do you know if there is a way to see the filename it is trying to locate, and the search paths?
Would it give the same error if it found the file but was unable to use the library for some reason? Maybe it needs to be re-built for sierra?
Do you know if there is a way to see the filename it is trying to locate, and the search paths?
Unfortunately, I don't know. I recommend before launching the website from the command line, execute the following commands:
export DYLD_PRINT_LIBRARIES=1
export ASPNETCORE_ENVIRONMENT=Development
Maybe it needs to be re-built for sierra?
I have no such possibility, but you can do it yourself. In the official building instructions there is not enough information yet, so use my instructions:
Install dependencies:
xcode-select --install
brew install cmake icu4c
To build the ChakraCore you must first clone the ChakraCore repository:
mkdir Github && cd Github
git clone https://github.com/Microsoft/ChakraCore.git
cd ChakraCore
git checkout v1.4.3
Run the build script:
./build.sh --icu=/usr/local/opt/icu4c/include -j=2
After the build is complete, copy libChakraCore.dylib
file from ~/Github/ChakraCore/BuildLinux/Release
directory to ~/.nuget/packages/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64/2.4.1/runtimes/osx-x64/native
directory.
export DYLD_PRINT_LIBRARIES=1
this gives some more information:
dyld: loaded: /Users/user/.nuget/packages/javascriptengineswitcher.chakracore.native.osx-x64/2.4.1/runtimes/osx-x64/native/libChakraCore.dylib
dyld: loaded: /usr/lib/libstdc++.6.dylib
dyld: unloaded: /Users/user/.nuget/packages/javascriptengineswitcher.chakracore.native.osx-x64/2.4.1/runtimes/osx-x64/native/libChakraCore.dylib
dyld: unloaded: /usr/lib/libstdc++.6.dylib
Unhandled Exception: dyld: loaded: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/1.1.1/System.Native.dylib
JavaScriptEngineSwitcher.Core.JsEngineLoadException: During loading of ChakraCoreJsEngine error has occurred.
Followed by the same exception as before. So it looks like it finds the library, but has some problems with it. I will try building the library myself and see how that works.
Building the library from source solved the problem.
If you or anyone else who stumbles upon this issue want to use my binary, feel free
https://www.dropbox.com/s/1guaf9ngxo2aqen/libChakraCore.dylib?dl=0
Followed by the same exception as before. So it looks like it finds the library, but has some problems with it.
It's possible, that problem is not even in the ChakraCore library itself, but in absence of its dependencies (cmake
and icu4c
) on the computer. Try to roll back the ChakraCore library to version from the JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64 package.
It's possible, that problem is not even in the ChakraCore library itself, but in absence of its dependencies (cmake and icu4c) on the computer.
Both of those were already installed on my computer, so that wasn't the issue.
@h0rdak After a series of experiments with the installation and uninstallation of libraries, I came to the conclusion, that this error was caused by the lack of the ICU4C library.
In general, problem is solved by using just one command:
brew install icu4c
@Taritsyn I have the same problem on os x 10.12.6. i have installed icu4c as you have mentioned above. i have even tried the library assembly from the dropbox as @h0rdak proposed. but still no success. the installed nuget packages are :
<PackageReference Include="JavaScriptEngineSwitcher.ChakraCore" Version="2.4.10" /> <PackageReference Include="JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64" Version="2.4.6" /> <PackageReference Include="JavaScriptEngineSwitcher.Core" Version="2.4.10" /> <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" /> <PackageReference Include="React.AspNet" Version="3.1.0" />
The exception trace:
dyld: loaded: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/2.0.0/System.Native.dylib dyld: loaded: /Users/adel/.nuget/packages/javascriptengineswitcher.chakracore.native.osx-x64/2.4.6/runtimes/osx-x64/native/libChakraCore.dylib dyld: loaded: /usr/lib/libstdc++.6.dylib dyld: unloaded: /Users/adel/.nuget/packages/javascriptengineswitcher.chakracore.native.osx-x64/2.4.6/runtimes/osx-x64/native/libChakraCore.dylib
Unhandled Exception: JavaScriptEngineSwitcher.Core.JsEngineLoadException: During loading of ChakraCoreJsEngine error has occurred.
See more details:
Unable to load DLL 'ChakraCore': The specified module or one of its dependencies could not be found. (Exception from HRESULT: 0x8007007E) ---> System.DllNotFoundException: Unable to load DLL 'ChakraCore': The specified module or one of its dependencies could not be found. (Exception from HRESULT: 0x8007007E)
The most strange thing is, that it worked for the first time. After, i've experimented with building v8 (without success) But i can't image, that it make an influence on my problem.
Please, help.
Hello!
i have even tried the library assembly from the dropbox as @h0rdak proposed.
I do not recommend doing this, because the native assembly may be incompatible with current version of .NET wrapper. Moreover, then problem was not in the native assembly, but in the dependencies.
The most strange thing is, that it worked for the first time. After, i've experimented with building v8 (without success)
From this, and it was necessary to begin. If you have something worked, and then stopped working, it means that something has changed (or broken) in your operating system. I can only advise to reinstall the ICU4C library:
brew reinstall icu4c
brew reinstall icu4c does not help. i will try with a fresh system.
Try to perform steps from the “Building ChakraCore > OS X > Install dependencies” section of ChakraCore's documentation.
I tried on the fresh system. Tried to perform the steps from install dependencies. Still the same error: Unable to load DLL 'ChakraCore': The specified module or one of its dependencies could not be found. Now i'm not more shure, that it "worked" before.
However with Jint it's working well
var engineSwitcher = JsEngineSwitcher.Instance; engineSwitcher.EngineFactories .AddJint(); engineSwitcher.DefaultEngineName = JintJsEngine.EngineName;
Now i'm not more shure, that it "worked" before.
But somehow it worked.
However with Jint it's working well
When you execute a larger amount of JS code, you can encounter serious performance issues.
@h0rdak, @risayew This problem was solved in version 2.4.12.
I'm having an issue where the ChakraCore DLL is not found, even if the JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64 package is installed.
This is using dotnet core 1.1 with Visual Studio for Mac, same results with the dotnet cli tools.
Some minimal code to get the exception:
The full exception is:
The csproj file:
I'm running the project on OSX Sierra 10.12.4:
The library is installed in: