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

Error System.DllNotFoundException when trying to run code on Debian #81

Closed
pasha-e opened this issue Apr 21, 2023 · 18 comments
Closed

Error System.DllNotFoundException when trying to run code on Debian #81

pasha-e opened this issue Apr 21, 2023 · 18 comments
Assignees
Labels
bug Something isn't working Linux

Comments

@pasha-e
Copy link

pasha-e commented Apr 21, 2023

I tried to run the project on сlear Debian 11 + dotnet SDK. Project from github, without edits.
Builded, but is non running

pasha_e@debian-pe:~/Projects/photino.Blazor-master$ dotnet run --project Samples/HelloWorld/
Photino.NET: "Photino".SetTitle(Photino.Blazor App)
Photino.NET: "Photino.Blazor App".SetUseOsDefaultLocation(False)
Photino.NET: "Photino.Blazor App".SetWidth(1000)
Photino.NET: "Photino.Blazor App".SetHeight(900)
Photino.NET: "Photino.Blazor App".SetLeft(0)
Photino.NET: "Photino.Blazor App".SetTop(100)
Photino.NET: "Photino.Blazor App".SetIconFile(favicon.ico)
Photino.NET: "Photino.Blazor App".SetTitle(Photino Hello World)
Photino.NET: "Photino Hello World".Load(app://localhost/)
Photino.NET: "Photino Hello World"***
Unable to load shared library 'Photino.Native' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libPhotino.Native: cannot open shared object file: No such file or directory
at PhotinoNET.PhotinoWindow.Photino_ctor(PhotinoNativeParameters& parameters)
at PhotinoNET.PhotinoWindow.b__277_0()
at PhotinoNET.PhotinoWindow.Invoke(Action workItem)
at PhotinoNET.PhotinoWindow.WaitForClose()
Error #0
Unhandled exception. System.ApplicationException: Native code exception. Error # 0 See inner exception for details.
---> System.DllNotFoundException: Unable to load shared library 'Photino.Native' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libPhotino.Native: cannot open shared object file: No such file or directory
at PhotinoNET.PhotinoWindow.Photino_ctor(PhotinoNativeParameters& parameters)
at PhotinoNET.PhotinoWindow.b__277_0()
at PhotinoNET.PhotinoWindow.Invoke(Action workItem)
at PhotinoNET.PhotinoWindow.WaitForClose()
--- End of inner exception stack trace ---
at PhotinoNET.PhotinoWindow.WaitForClose()
at Photino.Blazor.PhotinoBlazorApp.Run() in /home/pasha_e/Projects/photino.Blazor-master/Photino.Blazor/PhotinoBlazorApp.cs:line 50
at HelloWorld.Program.Main(String[] args) in /home/pasha_e/Projects/photino.Blazor-master/Samples/HelloWorld/Program.cs:line 32

If i change in Photino.Blazor.csproj package reference
<ItemGroup> <PackageReference Include="Photino.NET" Version="2.4.0" /> </ItemGroup>
to
<ItemGroup> <PackageReference Include="Photino.NET" Version="2.3.0" /> </ItemGroup>
project is builded and launched.

With Photino.NET Version 2.3.2 not launched too.

If in Debug folder replace manually file Photino.Native.so to old version (24.09.2022 ver 2.2.3) project launched successfully.

So, I have a problem on Linux based system with Photino.Native version older 2.2.3.
On Windows builded and launched withhout problem on all versions.
What could be the reason?

@pasha-e
Copy link
Author

pasha-e commented Apr 21, 2023

Additional info.
On Ubuntu 22.04 work corectly.

On Debian 11 not found dependency at version 2.4.1 (13.04.2023)

pasha_e@debian-pe:~/Projects/Strela/StrelaGUI/bin/Debug/net6.0/runtimes/linux-x64/native$ ldd Photino.Native.so

./Photino.Native.so: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by ./Photino.Native.so)

@pasha-e
Copy link
Author

pasha-e commented Apr 26, 2023

I compiled the library Photino.Native.so from source on my Debian 11. And this library works correctly.

Thus, the library from your NuGet repository is platforfm-dependent. To work correctly on Linux disribution, other thn Ubuntu, recompilation is required.

@philippjbauer
Copy link
Member

Additional info. On Ubuntu 22.04 work corectly.

On Debian 11 not found dependency at version 2.4.1 (13.04.2023)

pasha_e@debian-pe:~/Projects/Strela/StrelaGUI/bin/Debug/net6.0/runtimes/linux-x64/native$ ldd Photino.Native.so

./Photino.Native.so: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by ./Photino.Native.so)

Thank you for the additional information here. Is the console output from trying to run your program after building it or is this an error that you got while building your project?

@philippjbauer
Copy link
Member

We'll try to statically link these dependencies during compilation and see if we can fix this error that way.

@pasha-e
Copy link
Author

pasha-e commented Apr 28, 2023

Additional info. On Ubuntu 22.04 work corectly.
On Debian 11 not found dependency at version 2.4.1 (13.04.2023)

pasha_e@debian-pe:~/Projects/Strela/StrelaGUI/bin/Debug/net6.0/runtimes/linux-x64/native$ ldd Photino.Native.so

./Photino.Native.so: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by ./Photino.Native.so)

Thank you for the additional information here. Is the console output from trying to run your program after building it or is this an error that you got while building your project?

This is the console output from checking the library Photino.Native.so dependencies (last version from nuget)
(Ldd is a Linux command line utility that is used in case a user wants to know the shared library dependencies of an executable or even that of a shared library.)

@philippjbauer
Copy link
Member

Thank you @pasha-e!

I somehow completely missed the command at the very end of that line. Should've had another cup of coffee before I looked through the issues here 😆

I got a Debian 11 VM with LXDE going and will test it shortly

@philippjbauer
Copy link
Member

Hi @pasha-e

Can you try the following debug package? You will likely need to add a nuget.conf file to your project as described under "Connect to Feed" (there's a tag you might need to remove).

https://dev.azure.com/tryphotino/Photino.Native/_artifacts/feed/PhotinoPackages/NuGet/Photino.Native/overview/0.9.0-20230428.1

@azraelrabbit
Copy link

azraelrabbit commented May 28, 2023

I am also facing this problem and have found a solution to this problem. see below detail.


and and and, the Photino.Native also need more dependecy: libgtk-3-bin libwebkit2gtk-4.0-37 libnotify4

in my ubuntu18.04/debian 11/linux mint 20.1, i install those dependecy use:

sudo apt install libgtk-3-bin libwebkit2gtk-4.0-37 libnotify4

and i make the recompiled Photino.Native.so to new nuget package,
you could find it in nuget.org , search "AZ.Photino.Blazor.UnOfficial", or "AZ.Photino.Net.UnOfficial" and "AZ.Photino.Native.UnOfficial",

i've test on ubuntu 18.04.6, debian 11, linux mint 20.1 , ubuntu 22.04 , it's worked fine.

also , i compiled the linux-arm64, but I didn't test it, I don't know if it can run normally on the linux-arm64 system.
may be someone could to test it in linux-arm64.


the reason is that debian 11 default apt source can install gcc/g++ max version is gcc-10/g++10 ,
and the debian 11 only have max version of GLIBCXX_3 is GLIBCXX_3.4.28 ,
therefore , the Photino.Native.so on nuget.org , is building by gcc-11/g++-11, that needed the GLIBCXX_3.4.30,
you can try this command to check your target system :
sudo strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBC
or
strings /usr/lib64/libstdc++.so.6 |grep GLIBC

and to resolve this issue, you need in older version linux,
i just use ubuntu 18.04.6 and use lower version gcc/g++ to compile Photino.Native.so,
i have tried use gcc-8 ,it's can not compiled.
then i tried gcc-10/g++-10, it's build successed. so and use this command to check the .so file real dependecy:

objdump -T Photino.Native.so | grep -Eo 'GLIBCXX_\S+'| sort -u


more detail:

the GLIBCXX version related to libstd++6 version
The newer the Linux distribution, the higher the libcstd++6 version that comes with it.
so, we need compile Photino.Native in older linux version to support older libstd++6 library.

@bxjg1987
Copy link

Debian, I've also encountered this problem , photino.blazor 2.4.1 version

@grofit
Copy link

grofit commented Jan 23, 2024

I recently went to see how hard it would be to refactor a photino blazor app over to support linux and was faced with the GibC version issue, brand new Ubuntu instance on a VM, only things installed were .net 8 and Rider via the ubuntu app store thingy, was any progress made with this since last post? (I am using the latest Photino.Blazor which was built against .net 8)

@philippjbauer
Copy link
Member

A debug version is available that is compiled against GLIBCXX_3.4.21/GLIBC_2.17 and libwebkit2gtk-4.0.

During my testing I was able to run this on fresh installations of Ubuntu 22.04, Ubuntu 20.04, Debian 12, Debian 11 with Gnome desktop environment on ARM64.

I tested a Debian installation with the latest Plasma (KDE) desktop and noticed it is using a QT version of the webkit browser control. We're looking into how to fix this. Until then, if you are dependent on this environment you might need to depend on apt for packaging and referencing libwebkit2gtk-4.0 as a dependency for installation.

I'd appreciate any feedback for x64 based systems as I currently don't have access to it. Here's a debug package based on the latest Photino.NET 2.6.0. If it works for y'all I'll push a release to main and Nuget release. TIA

https://dev.azure.com/tryphotino/Photino.Native/_artifacts/feed/PhotinoPackages/NuGet/Photino.NET/overview/0.9.0-dev-20240209.1

@pasha-e @azraelrabbit @bxjg1987 @grofit

@grofit
Copy link

grofit commented Feb 16, 2024

I went to try your version but it kicks up too many problems, as Photino.Blazor wants Photino.Net >= 2.6.0 and I dont believe .net core/5+ supports assembly redirects, so I couldnt test it sorry. If you have a workaround for that problem or can bump the development version up I am happy to try again later.

@philippjbauer
Copy link
Member

@grofit Here's a Blazor package that uses the latest Photino.NET debug package:

https://dev.azure.com/tryphotino/Photino.Native/_artifacts/feed/PhotinoPackages/NuGet/Photino.Blazor/overview/0.9.0-dev-20240216.1

@grofit
Copy link

grofit commented Feb 16, 2024

Thanks for providing that, it got further but then blew up on:

Unable to load shared library 'Photino.Native' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable: 
libwebkit2gtk-4.0.so.37: cannot open shared object file: No such file or directory
/snap/dotnet-sdk/236/shared/Microsoft.NETCore.App/8.0.2/Photino.Native.so: cannot open shared object file: No such file or directory

I am using a bare bones install of Ubuntu 23.10 (in a VM), so not installed anything major other than Rider, GitKraken and .net 8, happy to try anything else that will help you progress.

Forgive me for being a simpleton but is the crux of the problem that you are forced to link to a specific version of glibc and gtk etc, so even if you get this working out the box for my version of ubuntu it will potentially break for other peoples versions out the box?

Hopefully there is some way of requesting a minimum version or somthing like we do with semver, but I never really use Linux so have no idea about if there is any way to do that, thanks again for your help so far though.

@philippjbauer
Copy link
Member

@grofit

Which desktop environment are you using? Gnome?

I have tried 20.04 and 22.04 with Gnome and it worked out of the box. An installation with Plasma (KDE) did not work because it relies on a QT version of webkit instead of the GTK version.

I haven't tried 23.10, could you run sudo find / -iname 'libwebkit2gtk-*' and reply with what versions you have installed?

@grofit
Copy link

grofit commented Feb 16, 2024

I believe it is gnome as thats what is listed in the help docs, but as I have no idea where to find that information its whatever the official ubuntu 23.10 release comes with.

Anyway here is what the result of that command was:

find: ‘/run/user/1000/gvfs’: Permission denied
find: ‘/run/user/1000/doc’: Permission denied
/var/lib/dpkg/info/libwebkit2gtk-4.1-0:amd64.symbols
/var/lib/dpkg/info/libwebkit2gtk-4.1-0:amd64.shlibs
/var/lib/dpkg/info/libwebkit2gtk-4.1-0:amd64.md5sums
/var/lib/dpkg/info/libwebkit2gtk-4.1-0:amd64.list
/var/lib/dpkg/info/libwebkit2gtk-4.1-0:amd64.triggers
/usr/share/doc/libwebkit2gtk-4.1-0
/usr/share/lintian/overrides/libwebkit2gtk-4.1-0
/usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.1.so.0
/usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.1.so.0.12.7
/snap/gnome-42-2204/141/usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so
/snap/gnome-42-2204/141/usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37
/snap/gnome-42-2204/141/usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37.63.5
/snap/gnome-42-2204/141/usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.1.so
/snap/gnome-42-2204/141/usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.1.so.0
/snap/gnome-42-2204/141/usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.1.so.0.8.5
/snap/gnome-42-2204/141/usr/share/lintian/overrides/libwebkit2gtk-4.0-37

@philippjbauer
Copy link
Member

@grofit @azraelrabbit @bxjg1987

The publishing guide that addresses these issues can be found here: tryphotino/photino.Native#129 (comment)

Also see this discussion for some updates to the current development tryphotino/photino.Documentation#18 (comment)

@grofit
Copy link

grofit commented Jun 12, 2024

I know this has been closed, but I recently tried the latest 3.* release and same issues as above still exist and the other issues you link to are not specifically about getting it running/building on Linux. So I would ask this issue be re-opened as I still cant even run Photino apps in Ubuntu >= 23, and there is no real guidance as to how to get them running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Linux
Projects
None yet
Development

No branches or pull requests

5 participants