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

dll not found in ubuntu #34

Closed
IOL0ol1 opened this issue Feb 24, 2020 · 5 comments
Closed

dll not found in ubuntu #34

IOL0ol1 opened this issue Feb 24, 2020 · 5 comments

Comments

@IOL0ol1
Copy link

IOL0ol1 commented Feb 24, 2020

Visual studio 2019, net core 3.1
pubilsh for linux-x64
run in ubuntu 1910 x64 have exception:


Unhandled exception. System.DllNotFoundException: Unable to load shared library 'libopenslide-0.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibopenslide-0.dll: cannot open shared object file: No such file or directory


libopenslide-0.dll.so file and executables are in the same directory, i think nuget is worked.

this is my FolderProfile.pubxml in my visual studio, it‘s auto-generated by Build - Publish in vs:

<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121. 
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <PublishProtocol>FileSystem</PublishProtocol>
    <Configuration>Release</Configuration>
    <Platform>Any CPU</Platform>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <PublishDir>bin\Release\netcoreapp3.1\publish\</PublishDir>
    <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
    <SelfContained>true</SelfContained>
    <PublishSingleFile>False</PublishSingleFile>
    <PublishReadyToRun>False</PublishReadyToRun>
    <PublishTrimmed>True</PublishTrimmed>
  </PropertyGroup>
</Project>
@yigolden
Copy link
Owner

Can you try version 1.0.0-preview5-20022501 from NuGet and see if it works?

I just push #35 that may fix your issue.

@IOL0ol1
Copy link
Author

IOL0ol1 commented Feb 26, 2020

Can you try version 1.0.0-preview5-20022501 from NuGet and see if it works?

I just push #35 that may fix your issue.

no,it's not work.
I'm looking for a cross-platform nuget package with a native library, but i'm not find.
I haven't found an official example of Microsoft. 👎
cross-platform packaging may not support native libraries

Maybe we should only provide the csharp part, other problems to the user to solve it

@yigolden
Copy link
Owner

Just to confirm, do you have the OpenSlide package installed on your system? OpenSlideNET is only acting as a interop layer. It still requires the OpenSlide native library pre-installed.

On Ubuntu 19.10, the command is:

sudo apt install libopenslide0

Our Travis CI works on Ubuntu 18.04. You can see how it is set up in the .travis.yml in the repository root.

@yigolden
Copy link
Owner

As for packaging a cross-platform nuget package with native dependencies, Microsoft does not provide an official way to do it.

Before #35, we were using a workaround proposed in this link. We generated a native stub that uses the Windows DLL name while it redirects all the native library call to the Linux shared library. This works, but makes it difficult to target new CPU architectures because we have to generate native stubs for every platform we wish to support. The native stubs used to be package in OpenSlideNET.NativeStubs packge.

After #35, we have switched to use the MSBuild.Sdk.Extras package which enables us to conditional compile different codes for different platforms. On Linux, we are directing calling functions on libopenslide.so.0 shared library while on Windows we are still using libopenslide-0.dll. After the transition, the OpenSlideNET.Interop package now contains different binary for each platform as you can see in the screenshot below.

image

@IOL0ol1
Copy link
Author

IOL0ol1 commented Feb 26, 2020

Just to confirm, do you have the OpenSlide package installed on your system? OpenSlideNET is only acting as a interop layer. It still requires the OpenSlide native library pre-installed.

On Ubuntu 19.10, the command is:

sudo apt install libopenslide0

Our Travis CI works on Ubuntu 18.04. You can see how it is set up in the .travis.yml in the repository root.

oh, think you , it's ok now.
I thought it would automatically copy *.so files like some nuget packet under the windows platform...

Do you have a plan to add a windows platform nuget pack for automatically copy *.dll ?
Unlike the official practice of openslide,maybe all in one .dll would be better in windows.

@IOL0ol1 IOL0ol1 closed this as completed Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants