Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to load shared library '/home/site/wwwroot/libadonetHDB.dll' or one of its dependencies.

Manisha5
Explorer
0 Kudos

Reproduction steps

1)Created new Web API project in Visual studio 2022 and using Target Framework .NET 8.0, Platform target is Any CPU

2)Added package through NuGet is SAPHanaForNetCore 3.1.0 package

3)deploying the project on Azure app service and OS is Linux and getting below error 2024-04-01T14:35:07.4105784Z ---> System.DllNotFoundException: Unable to load shared library '/home/site/wwwroot/libadonetHDB.dll' 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: /home/site/wwwroot/libadonetHDB.dll: invalid ELF header at System.Runtime.InteropServices.NativeLibrary.Load(String libraryPath)

Description

Unable to load shared library '/home/site/wwwroot/libadonetHDB.dll' 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: I am using Visual Studio 2022 and Architecture is "Any CPU" I have downloaded the SAPHanaForNetCore 3.1.0 package through nuget

16 REPLIES 16

DonWilliams
Active Contributor
0 Kudos

See if this helps you:

https://developers.sap.com/tutorials/hana-clients-dot-net-core.html

Connect Using the SAP HANA .NET Interface | SAP Tutorials

 
SAP Developer Center
https://developers.sap.com › hana-clients-dot-net-core
Aug 16, 2020 — Create and debug a .NET application that connects to SAP HANA using the SAP HANA client.
DonWilliams_0-1712003200325.png

0 Kudos

Hi Team,

I have gone through link but I didn't found the file libadonetHDB.so , could you please provide me the file?

Dan_vL
Product and Topic Expert
Product and Topic Expert
0 Kudos

The direct download link is https://tools.hana.ondemand.com/additional/hanaclient-dotnetcore-2.19.21-linux-x64.tar.gz.  You can reach this link from https://tools.hana.ondemand.com/#hanatools.  

Hope that helps,
Dan

0 Kudos

Thank You @dan

I will try to add this libadonetHDB.so file on Linux App Service and will check if the code is working or not for .NET core application.

agey76
Explorer
0 Kudos

Where can I find libadonetHDB.so?

Dan_vL
Product and Topic Expert
Product and Topic Expert
0 Kudos

You can download the HANA Client from https://tools.hana.ondemand.com/#hanatools 

Specifically the .NET driver for Linux can be found at
https://tools.hana.ondemand.com/additional/hanaclient-dotnetcore-latest-linux-x64.tar.gz 

0 Kudos

I downloaded the Linux.tar.gz, but I can't find the file inside.

0 Kudos

Thank you for the link, I haven't found it on the site tools.hana.ondemand.com.
I have copied the file to my output directory, but the Entity Frameworks stucks, when i open the connection. Last message ist "Creating DbConnection".

 
dbug: 05/16/2024 06:36:26.119 CoreEventId.ContextInitialized[10403] (Microsoft.EntityFrameworkCore.Infrastructure)
Entity Framework Core 7.0.18 initialized 'UsageContext' using provider 'Sap.EntityFrameworkCore.Hana.v7.0:2.20.20.0' with options: None
dbug: 05/16/2024 06:36:26.218 RelationalEventId.ConnectionCreating[20005] (Microsoft.EntityFrameworkCore.Database.Connection)
Creating DbConnection.

0 Kudos
When I use the libadonnetHDB.dll, then I get the following error:
 
System.TypeInitializationException: The type initializer for 'Sap.Data.Hana.HanaConnection' threw an exception.
---> System.DllNotFoundException: Unable to load shared library '/app/libadonetHDB.dll' 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:
/app/libadonetHDB.dll: invalid ELF header

Dan_vL
Product and Topic Expert
Product and Topic Expert

Have you tried using the .NET SDK and the steps described at https://developers.sap.com/tutorials/hana-clients-dot-net-core.html ?  Note that the steps are slightly different depending on the platform you are on Windows vs Linux as is the download link from https://tools.hana.ondemand.com/#hanatools as you will need the appropriate client for Windows, macOS, or Linux.

0 Kudos

Yes I tried the steps. But after hdbclient installation there is no libadonetHDB.so file in the installation dir. And I'am not sure if I need the file. I use .Net 7 with Entity Framework. So in my project i reference Sap.EntityFrameworkCore.Hana.v7.0.dll and Sap.Data.Hana.Net.v6.0.dll. The Sap.Data.Hana.Net.v6.0.dll reference lidadonetHDB.dll and not libadonetHDB.so. Under windows this constellation works, but under linux i get the error "/app/libadonetHDB.dll: invalid ELF header".

Dan_vL
Product and Topic Expert
Product and Topic Expert

If you are using an installation of the SAP HANA Client on Linux, make sure you are using the very latest version which is 2.20.22 released May 15th.
  
There was a known issue as described at 

https://me.sap.com/notes/3427733 

Client Installer changes

  • Issue Number 323022: .NET Core was missing from the Linux x86_64 client installation package.

0 Kudos

I can't find the version 2.20.22 on https://tools.hana.ondemand.com/#hanatools

Dan_vL
Product and Topic Expert
Product and Topic Expert

You can find 2.20.22 at the SAP Software Downloads site.  This is further described in step 3 of https://developers.sap.com/tutorials/hana-clients-install.html#712a293b-6097-481d-b073-2425513695c0 

0 Kudos

Thank you very much!!! With the new DLL it works!