Skip to content
This repository has been archived by the owner on Apr 15, 2021. It is now read-only.

Unhandled Exception: System.DllNotFoundException: Unable to load DLL 'libtdjson.so': #2

Closed
Anseltis opened this issue May 7, 2018 · 19 comments

Comments

@Anseltis
Copy link

Anseltis commented May 7, 2018

Hi, guys!

I tried to run elgram.tel on CentOS (CentOS 7-1611 64bit) and encountered:

StackTrace

Unhandled Exception: System.DllNotFoundException: Unable to load DLL 'libtdjson.so': The specified module or one of its dependencies could not be found.
 (Exception from HRESULT: 0x8007007E)
   at TD.Bindings.LinuxBindings.td_set_log_verbosity_level(Int32 level)
   at Egram.Registry.TDRegistry.<>c.<AddTDLib>b__0_0(IServiceProvider p) in /home/osboxes/egram.tel/Egram/Registry/TDRegistry.cs:line 15
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
   at Egram.Program.Run(IServiceProvider provider) in /home/osboxes/egram.tel/Egram/Program.cs:line 41
   at Egram.Program.Main(String[] args) in /home/osboxes/egram.tel/Egram/Program.cs:line 18
Aborted (core dumped)

I saw file libtdjson.dll nevertheless elgram.tel requires libtdjson.so.

@x2bool
Copy link
Collaborator

x2bool commented May 7, 2018

Yep! Same issue as #1. Libs for Linux are not included. We are going to solve this soon. Sorry for inconvenience.

@denisgolius
Copy link

denisgolius commented May 8, 2018

+1 - Same error on

DISTRIB_DESCRIPTION="Linux Mint 18.3 Sylvia"
NAME="Linux Mint"
VERSION="18.3 (Sylvia)"
dotnet --version
2.1.105

@x2bool
Copy link
Collaborator

x2bool commented Sep 8, 2018

Should be now fixed by 27f9399

@x2bool x2bool closed this as completed Sep 8, 2018
@eimiar
Copy link

eimiar commented Dec 5, 2018

Maybe it's not.
After cloning the repository i just executed the commands as stated in README
(i can't find any libtdjson file in the source folder after running dotnet restore)

$ dotnet restore
  Restoring packages for /usr/local/src/egram.tel/src/Tel.Egram.Authentication/Tel.Egram.Authentication.csproj...
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Authentication/obj/Tel.Egram.Authentication.csproj.nuget.g.props.
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Authentication/obj/Tel.Egram.Authentication.csproj.nuget.g.targets.
  Restore completed in 868.19 ms for /usr/local/src/egram.tel/src/Tel.Egram.Authentication/Tel.Egram.Authentication.csproj.
  Restoring packages for /usr/local/src/egram.tel/src/Tel.Egram.Components.Application/Tel.Egram.Components.Application.csproj...
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Components.Application/obj/Tel.Egram.Components.Application.csproj.nuget.g.props.
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Components.Application/obj/Tel.Egram.Components.Application.csproj.nuget.g.targets.
  Restore completed in 157.14 ms for /usr/local/src/egram.tel/src/Tel.Egram.Components.Application/Tel.Egram.Components.Application.csproj.
  Restoring packages for /usr/local/src/egram.tel/src/Tel.Egram.Components.Authentication/Tel.Egram.Components.Authentication.csproj...
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Components.Authentication/obj/Tel.Egram.Components.Authentication.csproj.nuget.g.props.
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Components.Authentication/obj/Tel.Egram.Components.Authentication.csproj.nuget.g.targets.
  Restore completed in 59.66 ms for /usr/local/src/egram.tel/src/Tel.Egram.Components.Authentication/Tel.Egram.Components.Authentication.csproj.
  Restoring packages for /usr/local/src/egram.tel/src/Tel.Egram.Components.Messenger/Tel.Egram.Components.Messenger.csproj...
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Components.Messenger/obj/Tel.Egram.Components.Messenger.csproj.nuget.g.props.
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Components.Messenger/obj/Tel.Egram.Components.Messenger.csproj.nuget.g.targets.
  Restore completed in 49.76 ms for /usr/local/src/egram.tel/src/Tel.Egram.Components.Messenger/Tel.Egram.Components.Messenger.csproj.
  Restoring packages for /usr/local/src/egram.tel/src/Tel.Egram.Components.Settings/Tel.Egram.Components.Settings.csproj...
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Components.Settings/obj/Tel.Egram.Components.Settings.csproj.nuget.g.props.
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Components.Settings/obj/Tel.Egram.Components.Settings.csproj.nuget.g.targets.
  Restore completed in 93.49 ms for /usr/local/src/egram.tel/src/Tel.Egram.Components.Settings/Tel.Egram.Components.Settings.csproj.
  Restoring packages for /usr/local/src/egram.tel/src/Tel.Egram.Components.Workspace/Tel.Egram.Components.Workspace.csproj...
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Components.Workspace/obj/Tel.Egram.Components.Workspace.csproj.nuget.g.props.
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Components.Workspace/obj/Tel.Egram.Components.Workspace.csproj.nuget.g.targets.
  Restore completed in 51.7 ms for /usr/local/src/egram.tel/src/Tel.Egram.Components.Workspace/Tel.Egram.Components.Workspace.csproj.
  Restoring packages for /usr/local/src/egram.tel/src/Tel.Egram.Components/Tel.Egram.Components.csproj...
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Components/obj/Tel.Egram.Components.csproj.nuget.g.props.
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Components/obj/Tel.Egram.Components.csproj.nuget.g.targets.
  Restore completed in 39.38 ms for /usr/local/src/egram.tel/src/Tel.Egram.Components/Tel.Egram.Components.csproj.
  Restoring packages for /usr/local/src/egram.tel/src/Tel.Egram.Graphics/Tel.Egram.Graphics.csproj...
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Graphics/obj/Tel.Egram.Graphics.csproj.nuget.g.props.
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Graphics/obj/Tel.Egram.Graphics.csproj.nuget.g.targets.
  Restore completed in 50 ms for /usr/local/src/egram.tel/src/Tel.Egram.Graphics/Tel.Egram.Graphics.csproj.
  Restoring packages for /usr/local/src/egram.tel/src/Tel.Egram.Gui/Tel.Egram.Gui.csproj...
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Gui/obj/Tel.Egram.Gui.csproj.nuget.g.props.
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Gui/obj/Tel.Egram.Gui.csproj.nuget.g.targets.
  Restore completed in 122.18 ms for /usr/local/src/egram.tel/src/Tel.Egram.Gui/Tel.Egram.Gui.csproj.
  Restoring packages for /usr/local/src/egram.tel/src/Tel.Egram.Messaging/Tel.Egram.Messaging.csproj...
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Messaging/obj/Tel.Egram.Messaging.csproj.nuget.g.props.
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Messaging/obj/Tel.Egram.Messaging.csproj.nuget.g.targets.
  Restore completed in 27.73 ms for /usr/local/src/egram.tel/src/Tel.Egram.Messaging/Tel.Egram.Messaging.csproj.
  Restoring packages for /usr/local/src/egram.tel/src/Tel.Egram.Persistance/Tel.Egram.Persistance.csproj...
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Persistance/obj/Tel.Egram.Persistance.csproj.nuget.g.props.
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Persistance/obj/Tel.Egram.Persistance.csproj.nuget.g.targets.
  Restore completed in 38.11 ms for /usr/local/src/egram.tel/src/Tel.Egram.Persistance/Tel.Egram.Persistance.csproj.
  Restoring packages for /usr/local/src/egram.tel/src/Tel.Egram.Settings/Tel.Egram.Settings.csproj...
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Settings/obj/Tel.Egram.Settings.csproj.nuget.g.props.
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Settings/obj/Tel.Egram.Settings.csproj.nuget.g.targets.
  Restore completed in 28.47 ms for /usr/local/src/egram.tel/src/Tel.Egram.Settings/Tel.Egram.Settings.csproj.
  Restoring packages for /usr/local/src/egram.tel/src/Tel.Egram.Utils/Tel.Egram.Utils.csproj...
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Utils/obj/Tel.Egram.Utils.csproj.nuget.g.props.
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram.Utils/obj/Tel.Egram.Utils.csproj.nuget.g.targets.
  Restore completed in 28.89 ms for /usr/local/src/egram.tel/src/Tel.Egram.Utils/Tel.Egram.Utils.csproj.
  Restoring packages for /usr/local/src/egram.tel/src/Tel.Egram/Tel.Egram.csproj...
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram/obj/Tel.Egram.csproj.nuget.g.props.
  Generating MSBuild file /usr/local/src/egram.tel/src/Tel.Egram/obj/Tel.Egram.csproj.nuget.g.targets.
  Restore completed in 542.99 ms for /usr/local/src/egram.tel/src/Tel.Egram/Tel.Egram.csproj.
  Restore completed in 28.94 ms for /usr/local/src/egram.tel/src/Tel.Egram/Tel.Egram.csproj.

$ dotnet run

Unhandled Exception: System.DllNotFoundException: Unable to load shared library 'tdjson' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libtdjson: cannot open shared object file: No such file or directory
   at TdLib.Bindings.LinuxBindings.td_set_log_verbosity_level(Int32 level)
   at Tel.Egram.Registry.<>c.<AddTdLib>b__1_0() in /usr/local/src/egram.tel/src/Tel.Egram/Registry.cs:line 45
   at Splat.DependencyResolverMixins.<>c__DisplayClass8_0`1.<RegisterLazySingleton>b__0() in D:\a\1\s\src\splat\ServiceLocation.cs:line 207
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at Splat.DependencyResolverMixins.GetService[T](IDependencyResolver This, String contract) in D:\a\1\s\src\splat\ServiceLocation.cs:line 151
   at Tel.Egram.Registry.<>c__DisplayClass1_0.<AddTdLib>b__1() in /usr/local/src/egram.tel/src/Tel.Egram/Registry.cs:line 51
   at Splat.DependencyResolverMixins.<>c__DisplayClass8_0`1.<RegisterLazySingleton>b__0() in D:\a\1\s\src\splat\ServiceLocation.cs:line 207
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at Splat.DependencyResolverMixins.GetService[T](IDependencyResolver This, String contract) in D:\a\1\s\src\splat\ServiceLocation.cs:line 151
   at Tel.Egram.Registry.<>c__DisplayClass1_0.<AddTdLib>b__3() in /usr/local/src/egram.tel/src/Tel.Egram/Registry.cs:line 64
   at Splat.DependencyResolverMixins.<>c__DisplayClass8_0`1.<RegisterLazySingleton>b__0() in D:\a\1\s\src\splat\ServiceLocation.cs:line 207
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at Splat.DependencyResolverMixins.GetService[T](IDependencyResolver This, String contract) in D:\a\1\s\src\splat\ServiceLocation.cs:line 151
   at Tel.Egram.Registry.<>c__DisplayClass3_0.<AddServices>b__10() in /usr/local/src/egram.tel/src/Tel.Egram/Registry.cs:line 168
   at Splat.DependencyResolverMixins.<>c__DisplayClass8_0`1.<RegisterLazySingleton>b__0() in D:\a\1\s\src\splat\ServiceLocation.cs:line 207
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at Splat.DependencyResolverMixins.GetService[T](IDependencyResolver This, String contract) in D:\a\1\s\src\splat\ServiceLocation.cs:line 151
   at Tel.Egram.Components.Application.AuthenticationLogic.BindAuthentication(MainWindowModel model) in /usr/local/src/egram.tel/src/Tel.Egram.Components.Application/AuthenticationLogic.cs:line 20
   at Tel.Egram.Components.Application.MainWindowModel.<.ctor>b__28_0(CompositeDisposable disposables) in /usr/local/src/egram.tel/src/Tel.Egram.Components.Application/MainWindowModel.cs:line 33
   at ReactiveUI.ViewForMixins.<>c__DisplayClass3_0.<WhenActivated>b__0() in D:\a\1\s\src\ReactiveUI\Activation\ViewForMixins.cs:line 74
   at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
   at System.Collections.Generic.List`1.AddEnumerable(IEnumerable`1 enumerable)
   at System.Reactive.Disposables.CompositeDisposable..ctor(IEnumerable`1 disposables) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Disposables\CompositeDisposable.cs:line 67
   at ReactiveUI.ViewModelActivator.Activate() in D:\a\1\s\src\ReactiveUI\Activation\ViewModelActivator.cs:line 84
   at Tel.Egram.Program.Run(IDependencyResolver resolver) in /usr/local/src/egram.tel/src/Tel.Egram/Program.cs:line 73
   at Tel.Egram.Program.Main(String[] args) in /usr/local/src/egram.tel/src/Tel.Egram/Program.cs:line 20

@x2bool x2bool reopened this Dec 5, 2018
@x2bool
Copy link
Collaborator

x2bool commented Dec 5, 2018

@eimiar what OS is this?

@eimiar
Copy link

eimiar commented Dec 5, 2018

@x2bool debian stable

@ForNeVeR
Copy link
Member

ForNeVeR commented Dec 5, 2018

Could you please show dotnet --info?

@denisgolius
Copy link

Could you please show dotnet --info?

omg, issue from May 7 ...

My system was reinstalled two times & now I don't have any sources or logs from that situation, Sorry -_-

@ForNeVeR
Copy link
Member

ForNeVeR commented Dec 5, 2018

@denisgolius I was asking @eimiar. I think we have fixed the issue that time, and that's something new (but similar) :)

@eimiar
Copy link

eimiar commented Dec 5, 2018

@ForNeVeR

$ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.1.500
 Commit:    b68b931422

Runtime Environment:
 OS Name:     debian
 OS Version:  9
 OS Platform: Linux
 RID:         debian.9-x64
 Base Path:   /usr/share/dotnet/sdk/2.1.500/

Host (useful for support):
  Version: 2.1.6
  Commit:  3f4f8eebd8

.NET Core SDKs installed:
  2.1.500 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

@x2bool
Copy link
Collaborator

x2bool commented Dec 16, 2018

@eimiar could you please try precompiled version from https://github.com/egramtel/egram.tel/releases ? As far as I know dotnet run is not supposed to copy native dependencies into the output dir. I suspect the runtime on some systems could not find native dependenciees from $HOME/.nuget

@eimiar
Copy link

eimiar commented Dec 17, 2018

@x2bool downloaded egram-x64.tar.gz - v0.5.254, extracted it and ran it.
The exception at startup persists as in #2 (comment), i'm not posting the command output as it's identical (except for filename paths)

@aswinmguptha
Copy link

Same issue here. My machine is running on Debian 9.

@dkni
Copy link

dkni commented Nov 24, 2020

@ForNeVeR @x2bool
Docker image from mcr.microsoft.com/dotnet/core/runtime-deps:2.2-stretch-slim (Debian 9)

    1:     /usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.7/libcoreclr.so: error: symbol lookup error: undefined symbol: PAL_CreateEventEx (fatal)
     1:     /usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.7/libcoreclr.so: error: symbol lookup error: undefined symbol: CreateEventEx (fatal)
     1:     /usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.7/libcoreclr.so: error: symbol lookup error: undefined symbol: PAL_CreateEventExW (fatal)
     1:     /usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.7/libcoreclr.so: error: symbol lookup error: undefined symbol: PAL_SetEvent (fatal)
     1:     find library=tdjson.so [0]; searching
     1:      search cache=/etc/ld.so.cache
     1:      search path=/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/lib:/usr/lib              (system search path)
     1:       trying file=/lib/x86_64-linux-gnu/tdjson.so
     1:       trying file=/usr/lib/x86_64-linux-gnu/tdjson.so
     1:       trying file=/lib/tdjson.so
     1:       trying file=/usr/lib/tdjson.so
     1:
     1:     find library=libtdjson.so [0]; searching
     1:      search cache=/etc/ld.so.cache
     1:      search path=/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/lib:/usr/lib              (system search path)
     1:       trying file=/lib/x86_64-linux-gnu/libtdjson.so
     1:       trying file=/usr/lib/x86_64-linux-gnu/libtdjson.so
     1:       trying file=/lib/libtdjson.so
     1:       trying file=/usr/lib/libtdjson.so
     1:
     1:     find library=tdjson [0]; searching
     1:      search cache=/etc/ld.so.cache
     1:      search path=/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/lib:/usr/lib              (system search path)
     1:       trying file=/lib/x86_64-linux-gnu/tdjson
     1:       trying file=/usr/lib/x86_64-linux-gnu/tdjson
     1:       trying file=/lib/tdjson
     1:       trying file=/usr/lib/tdjson
     1:
     1:     find library=libtdjson [0]; searching
     1:      search cache=/etc/ld.so.cache
     1:      search path=/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/lib:/usr/lib              (system search path)
     1:       trying file=/lib/x86_64-linux-gnu/libtdjson
     1:       trying file=/usr/lib/x86_64-linux-gnu/libtdjson
     1:       trying file=/lib/libtdjson
     1:       trying file=/usr/lib/libtdjson
     1:     ERROR General exception: Unable to load shared library 'tdjson' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libtdjson: cannot open shared object file: No such file or directory

@ForNeVeR
Copy link
Member

@dkni, any more detailed steps to reproduce? I've no idea how to deploy a GUI app into a Docker container.

@dkni
Copy link

dkni commented Dec 1, 2020

@dkni, any more detailed steps to reproduce? I've no idea how to deploy a GUI app into a Docker container.

It's a simple console app, copied over a standard MS image based on Debian 9. TdLib, TdLib.API and TdLib.Native nuget packages are referenced in the project. Copying tdlibjson.so to any and all of the paths in container does not help resolving the dependency at runtime. We switched over to Debian 10 and the problem is no more.

@ForNeVeR
Copy link
Member

ForNeVeR commented Dec 6, 2020

@dkni, I am sorry, but then it's unclear how do you apply egram.tel to a "simple console app". It would be much more convenient and faster if you just shared the example code, and your Docker file.

@dkni
Copy link

dkni commented Dec 6, 2020

@dkni, I am sorry, but then it's unclear how do you apply egram.tel to a "simple console app". It would be much more convenient and faster if you just shared the example code, and your Docker file.

Sorry, I am under a NDA. Our console app calls telegram api via TdLib + TdLib.API, and stores chat messages in a file. I believe I have provided more than enough information to reproduce the issue. The key points here are docker image mcr.microsoft.com/dotnet/core/runtime-deps:2.2-stretch-slim and nuget reference to TdLib.Native.

@x2bool
Copy link
Collaborator

x2bool commented Dec 6, 2020

@dkni You "provided more than enough information" in wrong repo.

@x2bool x2bool closed this as completed Dec 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants