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 shared library 'lmdb' on Linux #133

Closed
eaba opened this issue Jan 7, 2021 · 9 comments
Closed

Unable to load shared library 'lmdb' on Linux #133

eaba opened this issue Jan 7, 2021 · 9 comments

Comments

@eaba
Copy link

eaba commented Jan 7, 2021

System.DllNotFoundException: Unable to load shared library 'lmdb' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblmdb: cannot open shared object file: No such file or directory
[Node #1(first)]   at LightningDB.Native.LmdbMethods.mdb_env_create(IntPtr& env)
[Node #1(first)]   at LightningDB.Native.Lmdb.mdb_env_create(IntPtr& env)
[Node #1(first)]   at LightningDB.LightningEnvironment..ctor(String path, EnvironmentConfiguration configuration)
[Node #1(first)]   at Akka.DistributedData.LightningDB.LmdbDurableStore.get_Lmdb() in /home/vsts/work/1/s/src/contrib/cluster/Akka.DistributedData.LightningDB/LmdbDurableStore.cs:line 79
[Node #1(first)]   at Akka.DistributedData.LightningDB.LmdbDurableStore.<Active>b__19_0(Store store) in /home/vsts/work/1/s/src/contrib/cluster/Akka.DistributedData.LightningDB/LmdbDurableStore.cs:line 161
[Node #1(first)]Cause: System.DllNotFoundException: Unable to load shared library 'lmdb' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblmdb: cannot open shared object file: No such file or directory
[Node #1(first)]   at LightningDB.Native.LmdbMethods.mdb_env_create(IntPtr& env)
[Node #1(first)]   at LightningDB.Native.Lmdb.mdb_env_create(IntPtr& env)
[Node #1(first)]   at LightningDB.LightningEnvironment..ctor(String path, EnvironmentConfiguration configuration)
[Node #1(first)]   at Akka.DistributedData.LightningDB.LmdbDurableStore.get_Lmdb() in /home/vsts/work/1/s/src/contrib/cluster/Akka.DistributedData.LightningDB/LmdbDurableStore.cs:line 79
[Node #1(first)]   at Akka.DistributedData.LightningDB.LmdbDurableStore.<Active>b__19_0(Store store) in /home/vsts/work/1/s/src/contrib/cluster/Akka.DistributedData.LightningDB/LmdbDurableStore.cs:line 161
[Node #1(first)]   at LightningDB.Native.LmdbMethods.mdb_env_create(IntPtr& env)
[Node #1(first)]   at LightningDB.Native.Lmdb.mdb_env_create(IntPtr& env)
[Node #1(first)]   at LightningDB.LightningEnvironment..ctor(String path, EnvironmentConfiguration configuration)
[Node #1(first)]   at Akka.DistributedData.LightningDB.LmdbDurableStore.get_Lmdb() in /home/vsts/work/1/s/src/contrib/cluster/Akka.DistributedData.LightningDB/LmdbDurableStore.cs:line 79
[Node #1(first)]   at Akka.DistributedData.LightningDB.LmdbDurableStore.<Active>b__19_0(Store store) in /home/vsts/work/1/s/src/contrib/cluster/Akka.DistributedData.LightningDB/LmdbDurableStore.cs:line 161
[Node #1(first)]Cause: System.DllNotFoundException: Unable to load shared library 'lmdb' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblmdb: cannot open shared object file: No such file or directory
[Node #1(first)]   at LightningDB.Native.LmdbMethods.mdb_env_create(IntPtr& env)
[Node #1(first)]   at LightningDB.Native.Lmdb.mdb_env_create(IntPtr& env)
[Node #1(first)]   at LightningDB.LightningEnvironment..ctor(String path, EnvironmentConfiguration configuration)
[Node #1(first)]   at Akka.DistributedData.LightningDB.LmdbDurableStore.get_Lmdb() in /home/vsts/work/1/s/src/contrib/cluster/Akka.DistributedData.LightningDB/LmdbDurableStore.cs:line 79
[Node #1(first)]   at Akka.DistributedData.LightningDB.LmdbDurableStore.<Active>b__19_0(Store store) in /home/vsts/work/1/s/src/contrib/cluster/Akka.DistributedData.LightningDB/LmdbDurableStore.cs:line 161
[Node #1(first)]   at LightningDB.Native.LmdbMethods.mdb_env_create(IntPtr& env)
[Node #1(first)]   at LightningDB.Native.Lmdb.mdb_env_create(IntPtr& env)
[Node #1(first)]   at LightningDB.LightningEnvironment..ctor(String path, EnvironmentConfiguration configuration)
[Node #1(first)]   at Akka.DistributedData.LightningDB.LmdbDurableStore.get_Lmdb() in /home/vsts/work/1/s/src/contrib/cluster/Akka.DistributedData.LightningDB/LmdbDurableStore.cs:line 79
[Node #1(first)]   at Akka.DistributedData.LightningDB.LmdbDurableStore.<Active>b__19_0(Store store) in /home/vsts/work/1/s/src/contrib/cluster/Akka.DistributedData.LightningDB/LmdbDurableStore.cs:line 161

@eaba
Copy link
Author

eaba commented Jan 7, 2021

How does one set the path via Code or Configuration - am asking because of this:

- name: Test (Linux)
        working-directory: ${{ runner.workspace }}/Lightning.NET
        run: LD_LIBRARY_PATH=${{ runner.workspace}}/Lightning.NET/lmdb/libraries/liblmdb/:$LD_LIBRARY_PATH dotnet test -f netcoreapp3.1 --no-restore --verbosity normal
        if: matrix.os == 'ubuntu-latest'

@AlgorithmsAreCool
Copy link
Collaborator

@eaba I've seen this issue, I'll take a look soon

@eaba
Copy link
Author

eaba commented Jan 8, 2021

I was able to get pass this with the following:

 - script: make --directory=$(build.sourcesDirectory)/lmdb/libraries/liblmdb/
    displayName: 'Build lmdb native lib'
    condition: in( variables['Agent.OS'], 'Linux', 'Darwin' )
 - script: echo '##vso[task.setvariable variable=LD_LIBRARY_PATH]$(build.sourcesDirectory)/lmdb/libraries/liblmdb/'
    displayName: Set LMDB Env Variable
    condition: in( variables['Agent.OS'], 'Linux', 'Darwin' )

@simonfisher16
Copy link

I am getting this same error (below), running dotnet core 3.1 on Amazon Linux 2. I'm not following the above, how exactly can I fix this?

"Unable to load shared library 'lmdb' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblmdb: cannot open shared object file: No such file or directorySystem.DllNotFoundException: Unable to load shared library 'lmdb' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblmdb: cannot open shared object file: No such file or directory
at LightningDB.Native.LmdbMethods.mdb_env_create(IntPtr& env)
at LightningDB.Native.Lmdb.mdb_env_create(IntPtr& env)
at LightningDB.LightningEnvironment..ctor(String path, EnvironmentConfiguration configuration)"

Thanks
Simon

@simonfisher16
Copy link

simonfisher16 commented Mar 4, 2021

@eaba

 - script: make --directory=$(build.sourcesDirectory)/lmdb/libraries/liblmdb/
    displayName: 'Build lmdb native lib'
    condition: in( variables['Agent.OS'], 'Linux', 'Darwin' )
 - script: echo '##vso[task.setvariable variable=LD_LIBRARY_PATH]$(build.sourcesDirectory)/lmdb/libraries/liblmdb/'
    displayName: Set LMDB Env Variable
    condition: in( variables['Agent.OS'], 'Linux', 'Darwin' )

I'm not quite following how you fixed this. Any ideas how I can fix this on Amazon Linux or Ubuntu? Do I need to set some environment config?

@eaba
Copy link
Author

eaba commented Mar 4, 2021

@eaba

 - script: make --directory=$(build.sourcesDirectory)/lmdb/libraries/liblmdb/
    displayName: 'Build lmdb native lib'
    condition: in( variables['Agent.OS'], 'Linux', 'Darwin' )
 - script: echo '##vso[task.setvariable variable=LD_LIBRARY_PATH]$(build.sourcesDirectory)/lmdb/libraries/liblmdb/'
    displayName: Set LMDB Env Variable
    condition: in( variables['Agent.OS'], 'Linux', 'Darwin' )

I'm not quite following how you fixed this. Any ideas how I can fix this on Amazon Linux or Ubuntu? Do I need to set some environment config?

I did that in Azure pipeline template yaml. make --directory=$(build.sourcesDirectory) - compiles the code.
echo '##vso[task.setvariable variable=LD_LIBRARY_PATH]$(build.sourcesDirectory)/lmdb/libraries/liblmdb/' - sets the path environment variable for azure....

What I did was used in CI...if u are doing it manually then you will need to set the path environment variable and then run the make script

@CoreyKaylor
Copy link
Owner

It might be the path of least resistance to include linux binaries in the nuget at this point. I didn't bother early on because there was a lot of churn, but thinking the dust has settled by now.

Anybody up for a PR?

@eaba
Copy link
Author

eaba commented Mar 15, 2021

The last time I checked, nuget had linux libraries included but somehow that is not being discovered on linux

@CoreyKaylor
Copy link
Owner

Fixed by 057e841

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

4 participants