Skip to content
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

Unable to load DLL 'DlibDotNet.Native.dll' #50

Closed
bozkurtfurkan opened this issue Nov 21, 2018 · 15 comments
Closed

Unable to load DLL 'DlibDotNet.Native.dll' #50

bozkurtfurkan opened this issue Nov 21, 2018 · 15 comments

Comments

@bozkurtfurkan
Copy link

Summary of your issue

I did everything steps by steps. I built dlibDotnet with cmake. But I'm still getting this error :

screenshot_1
screenshot_2

My steps result :
screenshot_3
screenshot_4
screenshot_5

@takuya-takeuchi
Copy link
Owner

Could you show your directory which includes DlibDotNet.Native.dll?
Basically, you must deploy DlibDotNet.Native, DlibDotNet.Native.Dnn and DlibDotNet.

And I do not recommend using CMake GUI to build native dlls.
Because, GUI can not specify DLIB_PATH variable.

The following is simple command line.

cd src\DlibDotNet.Native
mkdir build
cd build
cmake -G "Visual Studio 15 2017 Win64" -T host=x64 ^
           -D DLIB_PATH=D:/Works/Lib/DLib/19.15 ^
           ..
cmake --build . --config Release

Or you can also use NuGet.

@bozkurtfurkan
Copy link
Author

for "Could you show your directory which includes DlibDotNet.Native.dll?" :
taku_1

Also I added from nugget but still didn't work :
taku_2

@takuya-takeuchi
Copy link
Owner

It is weird. I never face this issue.

Just in case, please check execute directory.
IDE could copy FaceRecognitionDotNet, DlibDotNet, DlibDotNet.Native and DlibDotNet.Native.Dnn to execute directory.
And check DlibDotNet.Native.dll by Dependency Walker x64.
It should help us!!

In any case, DlibDotNet can not use DlibDotNet.Native.dll due to lack of dependencies library.

@valerysntx
Copy link
Contributor

valerysntx commented Nov 21, 2018

@takuya-takeuchi I think that DlibDotNet package .nuspec should be investigated for finding proper way to package deps...

<PackageReference PrivateAssets="All" could fix #50 ?

@takuya-takeuchi, taking the .target file of the DlibDotNet nuget package below
I suppose the
<DeploymentContent>true</DeploymentContent> should be put for <ItemGroup>

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
	<PropertyGroup>
		<DlibDotNetNativeDlls>$(MSBuildThisFileDirectory)\..\NativeDlls</DlibDotNetNativeDlls>
	</PropertyGroup>
	<ItemGroup>
		<None Include="$(DlibDotNetNativeDlls)\DlibDotNet.Native.dll">
			<Link>DlibDotNet.Native.dll</Link>
                        
                            <DeploymentContent>true</DeploymentContent>

			<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
		</None>
		<None Include="$(DlibDotNetNativeDlls)\DlibDotNet.Native.Dnn.dll">
			<Link>DlibDotNet.Native.Dnn.dll</Link>
			<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
		</None>
	</ItemGroup>
</Project>

@valerysntx
Copy link
Contributor

valerysntx commented Nov 21, 2018

In any case, DlibDotNet can not use DlibDotNet.Native.dll due to lack of dependencies library.

NugetPackageExplorer tool to the help!

There are different approaches how to deploy natives with DlibDotNet
One way is to split DlibDotNet into two packages, so natives could go into the .nuspec package dependency.

Another could be the VcPkg.Nuget way ;)

@bozkurtfurkan
Copy link
Author

Yes, it is weird :) Create another empty project and get it back from nuget, it is improved.

@bozkurtfurkan
Copy link
Author

I think understood the problem. I am getting 'DlibDotNet.Native.dll' error that i created web application but there is no error in console application. Do you have a solution ?

@bozkurtfurkan bozkurtfurkan reopened this Nov 26, 2018
@takuya-takeuchi
Copy link
Owner

I had never develop web app.
so I have no idea.

but if try to work on no-development machine, you should check whether proper vc++ runtime is installed.

i will check if you can upload minimum web app using dlibdotnet.

@bozkurtfurkan
Copy link
Author

I checked vc++ runtime and it is installed. If you create basic web mvc or webapi and install from nuget then you can see the problem

@valerysntx
Copy link
Contributor

valerysntx commented Nov 26, 2018

@bozkurtfurkan #50 (comment)

I checked vc++ runtime and it is installed. If you create basic web mvc or webapi and install from nuget then you can see the problem

  • You can't use DlibDotNet with .netcoreapp2.1 target framework, that is webapi default target.

  • Nuget package DlibDotNet is compiled for .netstandard2.0 target framework.

  • You can't build webapi project with netstandard2.0 target framework, due to NU1202: Package Microsoft.AspNetCore.App 2.1.0 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package Microsoft.AspNetCore.App 2.1.0 supports: netcoreapp2.1 (.NETCoreApp,Version=v2.1)

  • Currently, due to the specifics of the Nuget packaging, there are no compatibility messages issued when
    doing dotnet package add DlibDotNet against netcoreapp2.1 target framework project.

  • While currently Your netcoreapp2.1 default project could be even built without any issues, You will get no chance to find the DlibDotNet.dll managed assembly in the /bin/{Debug/Release}/netcoreapp2.1/**

    So, please check, if Your .csproj has
    <TargetFramework>netstandard2.0</TargetFramework>, before trying to use DlibDotNet nuget package, - directly or via dependencies

@takuya-takeuchi - I beleive DlibDotNet.props needs simple compatibility tests to be added, to raise the failure message, if not netstandard2.0 framework target is used

@takuya-takeuchi
Copy link
Owner

@valerysntx
Thanks a lot.

@bozkurtfurkan
I didn't test and try .net core 2.1.
However, .NET Starndard 2.1 is not ready.
https://github.com/dotnet/standard/milestone/3

Therefore, we can not support .NET Core 2.1.
I'm so sorry.

@bozkurtfurkan
Copy link
Author

I changed target framework. It is working. Thank you so much : @valerysntx and @takuya-takeuchi

@bozkurtfurkan
Copy link
Author

bozkurtfurkan commented Nov 27, 2018

I worked a few example today and I created a console app on 2.1 target framework. It is working ! I think the problem is not version number. What do you think about this stuation ? @takuya-takeuchi @valerysntx
butttt

@valerysntx
Copy link
Contributor

valerysntx commented Dec 2, 2018

I worked a few example today and I created a console app on 2.1 target framework. It is working ! I think the problem is not version number. What do you think about this stuation ? @takuya-takeuchi @valerysntx

Not the problem! - This confirms that DlibDotNet.dll managed assembly is binary compartible with .netcoreapp2.1 platform (see netstandard2.0.md#platform-support) so it could be referenced on the following platforms:

  • .NET Core 2.0
  • .NET Framework 4.6.1
  • Mono 5.4
  • Xamarin.iOS 10.14
  • Xamarin.Mac 3.8
  • Xamarin.Android 8.0
  • Universal Windows Platform 10.0.16299

Great, but DlibDotNet.Native and DlibDotNet.Native.Dnn native library dependencies, used by P/Invoke interoperability, should run properly on x64, both win and linux only.

@bozkurtfurkan, making such DlibDotNet.Native builds for iOS, Mac, Android could be great contribution to the project!

@bozkurtfurkan
Copy link
Author

bozkurtfurkan commented Dec 5, 2018

@valerysntx Thank you for your answer

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

No branches or pull requests

3 participants