Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

[osx] missing native libraries in latest build #2607

Closed
natemcmaster opened this issue Sep 1, 2015 · 16 comments
Closed

[osx] missing native libraries in latest build #2607

natemcmaster opened this issue Sep 1, 2015 · 16 comments
Assignees
Milestone

Comments

@natemcmaster
Copy link

dnu restore with 1.0.0-beta8-15548 throws an error on OS X

System.TypeInitializationException: The type initializer for 'System.Net.Http.CurlHandler' threw an exception. ---> System.TypeInitializationException: The type initializer for 'libcurl' threw an exception. ---> System.TypeInitializationException: The type initializer for 'HttpInitializer' threw an exception. ---> System.TypeInitializationException: The type initializer for 'CryptoInitializer' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'System.Security.Cryptography.Native': The specified module could not be found.

Missing libcurl and System.Security.Cryptography.Native

Looks like this error started in 15545
#1793 (comment)

@davidfowl
Copy link
Member

Did you install libcurl?

@BrennanConroy
Copy link
Member

Looks like we need to copy System.Net.Http.Native.so and System.Security.Cryptography.Native.so to the Microsoft.Dnx.Tooling folder in the dnx

@natemcmaster
Copy link
Author

@davidfowl Update: libcurl was already installed. It's because DNX is missing System.Security.Cryptography.Native.dylib

@BrennanConroy
Copy link
Member

fc105f6

@xasx
Copy link

xasx commented Sep 7, 2015

I am seeing similar exceptions on Linux when trying out the HelloWorld sample.

$ dnu build --framework dnxcore50
Microsoft .NET Development Utility CoreCLR-x64-1.0.0-beta8-15585


Building helloworld-dnxcore for DNXCore,Version=v5.0
System.TypeInitializationException: The type initializer for 'libcrypto' threw an exception. ---> System.TypeInitializationException: The type initializer for 'CryptoInitializer' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'System.Security.Cryptography.Native': The specified module could not be found.
 (Exception from HRESULT: 0x8007007E)
   at Interop.CryptoInitializer.EnsureOpenSslInitialized()
   at Interop.CryptoInitializer..cctor()
   --- End of inner exception stack trace ---
   at Interop.CryptoInitializer.Initialize()
   at Interop.libcrypto..cctor()
   --- End of inner exception stack trace ---
   at Interop.libcrypto.EVP_sha1()
   at Internal.Cryptography.HashProviderDispenser.CreateHashProvider(String hashAlgorithmId)
   at System.Security.Cryptography.SHA1.Implementation..ctor()
   at System.Security.Cryptography.SHA1.Create()
   at Roslyn.Utilities.SHA1CryptoServiceProvider..ctor()
   at Microsoft.CodeAnalysis.CryptographicHashProvider.TryGetAlgorithm(SourceHashAlgorithm algorithmId)
   at Microsoft.CodeAnalysis.Text.SourceText.CalculateChecksum(Stream stream, SourceHashAlgorithm algorithmId)
   at Microsoft.CodeAnalysis.Text.SourceText.From(Stream stream, Encoding encoding, SourceHashAlgorithm checksumAlgorithm, Boolean throwIfBinaryDetected)
   at Microsoft.Dnx.Compilation.CSharp.RoslynCompiler.<>c__DisplayClass15_0.<CreateSyntaxTree>b__0(CacheContext ctx)
   at Microsoft.Dnx.Compilation.Caching.CacheExtensions.<>c__DisplayClass0_0`1.<Get>b__0(CacheContext ctx)
   at Microsoft.Dnx.Compilation.Caching.Cache.CreateEntry(Object k, Func`2 acquire)
   at Microsoft.Dnx.Compilation.Caching.Cache.<>c__DisplayClass5_0.<AddEntry>b__0()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at Microsoft.Dnx.Compilation.Caching.Cache.Get(Object key, Func`2 factory)
   at Microsoft.Dnx.Compilation.Caching.CacheExtensions.Get[T](ICache cache, Object key, Func`2 factory)
   at Microsoft.Dnx.Compilation.CSharp.RoslynCompiler.CreateSyntaxTree(String sourcePath, CSharpParseOptions parseOptions)
   at Microsoft.Dnx.Compilation.CSharp.RoslynCompiler.GetSyntaxTrees(CompilationProjectContext project, IEnumerable`1 sourceFiles, IEnumerable`1 sourceReferences, CSharpParseOptions parseOptions, Boolean isMainAspect)
   at Microsoft.Dnx.Compilation.CSharp.RoslynCompiler.CompileProject(CompilationProjectContext projectContext, IEnumerable`1 incomingReferences, IEnumerable`1 incomingSourceReferences, Func`1 resourcesResolver)
   at Microsoft.Dnx.Compilation.CSharp.RoslynProjectCompiler.CompileProject(CompilationProjectContext projectContext, Func`1 referenceResolver, Func`1 resourcesResolver)
   at Microsoft.Dnx.Compilation.LibraryExporter.<>c__DisplayClass18_0.<ExportProject>b__0(CacheContext ctx)
   at Microsoft.Dnx.Compilation.Caching.CacheExtensions.<>c__DisplayClass0_0`1.<Get>b__0(CacheContext ctx)
   at Microsoft.Dnx.Compilation.Caching.Cache.CreateEntry(Object k, Func`2 acquire)
   at Microsoft.Dnx.Compilation.Caching.Cache.<>c__DisplayClass5_0.<AddEntry>b__0()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at Microsoft.Dnx.Compilation.Caching.Cache.Get(Object key, Func`2 factory)
   at Microsoft.Dnx.Compilation.Caching.CacheExtensions.Get[T](ICache cache, Object key, Func`2 factory)
   at Microsoft.Dnx.Compilation.LibraryExporter.ExportProject(ProjectDescription project, String aspect, LibraryExporter exporter)
   at Microsoft.Dnx.Compilation.LibraryExporter.GetAllExports(ProjectDescription project, String aspect, Func`2 include)
   at Microsoft.Dnx.Compilation.LibraryExporter.GetAllExports(String name, String aspect, Func`2 libraryFilter)
   at Microsoft.Dnx.Compilation.LibraryExporter.GetAllExports(String name, String aspect)
   at Microsoft.Dnx.Compilation.LibraryExporter.GetAllExports(String name)
   at Microsoft.Dnx.Tooling.BuildContext.ShowDependencyInformation(IReport report)
   at Microsoft.Dnx.Tooling.BuildContext.Initialize(IReport report)
   at Microsoft.Dnx.Tooling.BuildManager.BuildInternal(String projectPath)
   at Microsoft.Dnx.Tooling.BuildManager.Build()
   at Microsoft.Dnx.Tooling.BuildConsoleCommand.<>c__DisplayClass0_0.<Register>b__1()
   at Microsoft.Dnx.Runtime.Common.CommandLine.CommandLineApplication.Execute(String[] args)
   at Microsoft.Dnx.Tooling.Program.Main(String[] args)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
   at Microsoft.Dnx.Host.Bootstrapper.RunAsync(List`1 args, IRuntimeEnvironment env, FrameworkName targetFramework)
   at Microsoft.Dnx.Host.RuntimeBootstrapper.ExecuteAsync(String[] args, FrameworkName targetFramework)
   at Microsoft.Dnx.Host.RuntimeBootstrapper.Execute(String[] args, FrameworkName targetFramework)
System.TypeInitializationException: The type initializer for 'CryptoInitializer' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'System.Security.Cryptography.Native': The specified module could not be found.
 (Exception from HRESULT: 0x8007007E)
   at Interop.CryptoInitializer.EnsureOpenSslInitialized()
   at Interop.CryptoInitializer..cctor()
   --- End of inner exception stack trace ---
   at Interop.CryptoInitializer.Initialize()
   at Interop.libcrypto..cctor()
System.DllNotFoundException: Unable to load DLL 'System.Security.Cryptography.Native': The specified module could not be found.
 (Exception from HRESULT: 0x8007007E)
   at Interop.CryptoInitializer.EnsureOpenSslInitialized()
   at Interop.CryptoInitializer..cctor()

Similarly, dnx run prints pretty the same.

However, the required files seem to be present:

$ ls -1 ~/.dnx/runtimes/dnx-coreclr-linux-x64.1.0.0-beta8-15585/bin/lib/Microsoft.Dnx.Tooling
Microsoft.CSharp.dll
Microsoft.Dnx.Tooling.dll
Microsoft.Framework.NotNullAttribute.Sources.dll
Microsoft.Win32.Registry.dll
Newtonsoft.Json.dll
System.Diagnostics.Process.dll
System.IO.UnmanagedMemoryStream.dll
System.Linq.Parallel.dll
System.Net.Http.dll
System.Net.Http.Native.so
System.Security.Cryptography.Native.so

Any hint on how to get it working?

@BrennanConroy
Copy link
Member

Not sure how you are seeing this, I just tested it on my Linux machine and it works fine.

@xasx
Copy link

xasx commented Sep 9, 2015

Removed ~/.dnx, started over with Getting started again.

Still seeing the same error with 1.0.0-beta8-15586.

I appreciate any help, especially for debugging this issue. BTW: I am running Fedora.

@Rwing
Copy link

Rwing commented Sep 9, 2015

me too, but I am running Centos 7

@BrennanConroy
Copy link
Member

Wrong getting started, try this http://docs.asp.net/en/latest/getting-started/installing-on-linux.html

@xasx
Copy link

xasx commented Sep 9, 2015

Okay, after following this guide it turns out that this Getting started: http://dotnet.github.io/core/getting-started/ is actually working with 1.0.0-beta7 but not with any 1.0.0-beta8-* build (just tested 15591).

@Rwing
Copy link

Rwing commented Sep 10, 2015

yum install openssl-devel libcurl libcurl-devel 

on Centos

@sig9
Copy link

sig9 commented Sep 11, 2015

apt-get install libcurl4-openssl-dev

on ubuntu 14.10

@jonesnc
Copy link

jonesnc commented Sep 15, 2015

Also seeing this error on Fedora 22 with version 1.0.0-beta8-15616 after following this guide and installing the dependencies listed above.

@xasx
Copy link

xasx commented Sep 16, 2015

Just verified that the guide actually works as written in a ubuntu:latest Docker container.

Maybe mono or other libs' installation differs slightly on platforms?

At first sight I cannot see any difference in ~/.dnx/runtimes/dnx-coreclr-linux-x64.1.0.0-beta8-15618/bin/lib/Microsoft.Dnx.Tooling at least.

@jonesnc
Copy link

jonesnc commented Sep 16, 2015

I was able to get it working by following this.

@BrennanConroy
Copy link
Member

System.Security.Cryptography.Native.so was already in the bin folder

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

No branches or pull requests

7 participants