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

fix libdl name src/Pkcs11Interop/Pkcs11Interop/Common/NativeMethods.cs #159

Closed
wants to merge 1 commit into from

Conversation

lo1ol
Copy link

@lo1ol lo1ol commented Jul 17, 2020

Hello,
Our library depends on your lib v4.1.1. We have noticed that applications linked with this lib have an error:

Unhandled exception. System.DllNotFoundException: Unable to load shared library 'libdl' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibdl: cannot open shared object file: No such file or directory
   at Net.Pkcs11Interop.Common.NativeMethods.dlopen(String filename, Int32 flag)
   at Net.Pkcs11Interop.Common.UnmanagedLibrary.Load(String fileName)
   at Net.Pkcs11Interop.LowLevelAPI80.Pkcs11..ctor(String libraryPath)
   at Net.Pkcs11Interop.HighLevelAPI80.Pkcs11..ctor(String libraryPath, AppType appType)
   at Net.Pkcs11Interop.HighLevelAPI.Pkcs11..ctor(String libraryPath, AppType appType)
   at Aktiv.RtAdmin.Startup.RegisterServices(String nativeLibraryPath) in /home/lo1ol/rtadmin/Aktiv.RtAdmin/Startup.cs:line 51
   at Aktiv.RtAdmin.Startup.Configure(String logFilePath, String nativeLibraryPath) in /home/lo1ol/rtadmin/Aktiv.RtAdmin/Startup.cs:line 20
   at Aktiv.RtAdmin.RtAdmin.Main(String[] args) in /home/lo1ol/rtadmin/Aktiv.RtAdmin/Program.cs:line 48
Aborted (core dumped)

This problem can be solved by downloading package libc6-dev or by creating sym link libdl.so to the library libdl.so.2.
Nevertheless, this solution isn't convenient for common users of our application. We decided to change name of linked library by libdl.so.2. and this help.
I don't know the purpose why the link to libdl.so doesn't exist by default, but inside all tested OSes libdl.so.2 exists always.

If our solution is relevant, could you please fix the current version of you project and create a new branch v4.1.2 with this fix for our library.

@jariq
Copy link
Member

jariq commented Jul 26, 2020

Hey @lo1ol, thanks for the PR. Could you please answer these two additional questions?

  1. On which Linux distributions and versions are you experiencing this problem?

  2. Did you try to use dllmap in app.config of your application?

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
        <dllmap dll="libdl">
            <dllentry os="linux" dll="libdl.so.2" />
        </dllmap>
    </configuration>

@jariq jariq self-assigned this Jul 26, 2020
@lo1ol
Copy link
Author

lo1ol commented Jul 26, 2020

Thank your for your response.

  1. I found this problem in Ubuntu and some Russian OSes based on Debian and Red Hat (Astra Linux, Red OS, Alt Linux and ROSA).

  2. I think that dllmap can solve my problem. I try it tomorrow.

@lo1ol
Copy link
Author

lo1ol commented Jul 29, 2020

Hello,

We tested your solution with an implementation similar to this.

Firstly we tried set lib name resolver for our application Assemble, but it didn't work. After that we tried set lib name resolver for your Assemble and this is help.

I close MR, thank you for your help.

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

Successfully merging this pull request may close these issues.

None yet

2 participants