core icon indicating copy to clipboard operation
core copied to clipboard

Official RHEL6 support document doesn't seem to cover Microsoft-provided SQLite?

Open The-MAZZTer opened this issue 7 years ago • 5 comments

I've been tasked to get our .NET Core 2.2 application running on Red Hawk Linux 6. I have been following this official document here:

https://github.com/dotnet/core/blob/master/Documentation/build-and-install-rhel6-prerequisites.md

But there are pieces of it that seem to be outdated and I am not sure if it is supported any more. It does appear to have been updated fairly recently.

One thing I noticed is that there's a section suggesting that you can deploy self-contained applications to RHEL6, but this thread: https://github.com/dotnet/cli/issues/9282 suggests that is not supported and applications must be framework-dependent. So there is something wrong somewhere.

My efforts were hampered by lack of internet connectivity on the server I am trying to run my application on. I was provided with one dotnet package to use but it lacked ASP.NET Core files. I was provided with another which seemed to have the RHEL7 dotnet binary as it would not run. I had to Frankenstein them together by extracting the ASP.NET Core files from the latter and the rest from the former into a local folder, which seems to run properly.

Ultimately I was able to get a simple "Hello World" application running but past that, running a real application, is where I start having problems I can't figure out. Specifically, Microsoft.EntityFrameworkCore.Sqlite does not appear to work. It is supported for RHEL6?

My main problem at first was that the nuget package sqlitepclraw.lib.e_sqlite3.linux appears to be required, but at no point is it included in my publish, as when I attempt to run my application I am told my .runtimedeps.json references it but I can't find the .so file it wants in the publish.

Is this a problem with cross-platform builds and platform-specific packages? (I built in Visual Studio on Windows 10 for linux-x64 target). I had to manually download the package and extract the libe_sqlite3.so to get dotnet to find it.

Secondly it seemed to want a second copy of the file named e_sqlite3.so... I would assume this is a different file entirely but I could not find any additional .SOs in the package. The package, even when explicitly installed, is not included in publish so I couldn't be sure.

Assuming all I needed to do was simply drop a renamed copy into the dotnet folder where it could find it, the last problem I ran into was e_sqlite3.so tries to load GLIBC 2.14, which is not provided for RHEL6, which only provides 2.12. Trying to drop in the RHEL7 2.17 so only led to further problems.

So here is where I am stuck and the official instructions don't seem to cover this.

I have downloaded and built curl from the url indicated, and downloaded icu. I then put all the .SOs from both these efforts into a local dotnet folder alongside the runtime. I then run my application like so:

LD_DEBUG all LD_LIBRARY_PATH=./dotnet ./dotnet/dotnet ./MyApplication.dll

The output ends with:

 10742:   file=e_sqlite3.so [0];  needed by /opt/myapplication/dotnet/shared/Microsoft.NETCore.App/2.2.7/libcoreclr.so [0]
 10742:   find library=e_sqlite3.so [0]; searching
 10742:    search path=./dotnet/tls/x86_64:./dotnet/tls:./dotnet/x86_64:./dotnet          (LD_LIBRARY_PATH)
 10742:     trying file=./dotnet/tls/x86_64/e_sqlite3.so
 10742:     trying file=./dotnet/tls/e_sqlite3.so
 10742:     trying file=./dotnet/x86_64/e_sqlite3.so
 10742:     trying file=./dotnet/e_sqlite3.so
 10742:
 10742:   file=e_sqlite3.so [0];  generating link map
 10742:     dynamic: 0x00007ff774321de8  base: 0x00007ff774031000   size: 0x00000000002f41d8
 10742:       entry: 0x00007ff77403f310  phdr: 0x00007ff774031040  phnum:                  7
 10742:
 10742:   checking for version `GLIBC_2.14' in file /lib64/libc.so.6 [0] required by file ./dotnet/e_sqlite3.so [0]
 10742:   symbol=pthread_sigmask;  lookup in file=./dotnet/dotnet [0]
 10742:   symbol=pthread_sigmask;  lookup in file=/lib64/libdl.so.2 [0]
 10742:   symbol=pthread_sigmask;  lookup in file=/lib64/libpthread.so.0 [0]
 10742:   binding file /opt/myapplication/dotnet/shared/Microsoft.NETCore.App/2.2.7/libcoreclr.so [0] to /lib64/libpthread.so.0 [0]: normal symbol `pthread_sigmask' [GLIBC_2.2.5]

Segmentation fault

Without LD_DEBUG=all I just get:

System.DllNotFoundException: Unable to load shared library 'e_sqlite3' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libe_sqlite3: cannot open shared object file: No such file or directory.

Not sure if this is the best repo to file this issue in (if any) but this is the repo holding the document. Does the document only cover specific versions of .NET Core? Is it still supported or deprecated? Does it only cover the framework and not official Microsoft packages (and their dependencies) on top of that? Is Red Hawk too different from RHEL for this document to apply?

The-MAZZTer avatar Oct 14 '19 22:10 The-MAZZTer

@tarekgh

KoteshBoda avatar Oct 17 '19 23:10 KoteshBoda

I have downloaded and built curl from the url indicated, and downloaded icu. I then put all the .SOs from both these efforts into a local dotnet folder alongside the runtime. I then run my application like so:

We don't support loading ICU libs from the app local folder. you need to build and install it from the ICU source folder .

./configure --prefix=/usr/local 
make 
make install

tarekgh avatar Oct 18 '19 17:10 tarekgh

I've been tasked to get our .NET Core 2.2 application running on Red Hawk Linux 6.

Huh. I hadn't heard of this distro before. FWIW, .NET Core doesn't have any Real Time support, so please watch out.

My personal point of view is that support for RHEL 6 was kind of bolted onto .NET Core and wasn't ever a great fit. It's not a great story and there are a few tough spots.

One thing I noticed is that there's a section suggesting that you can deploy self-contained applications to RHEL6, but this thread: dotnet/cli#9282 suggests that is not supported and applications must be framework-dependent.

That's not my take-away form that thread. Can you simplify your test case? Can you follow the RHEL 6 doc to the latter? Download the RHEL 6 SDK from the website (please don't cobble something together yourself here), builds libicu and curl exactly like it suggests and use that (not another SDK from another platform) to build/publish a hello world app? Does that work? Does a hello-world-style ASP.NET Core application works? If so, can you build/publish your own application?

I was provided with one dotnet package to use but it lacked ASP.NET Core files. I was provided with another which seemed to have the RHEL7 dotnet binary as it would not run.

There's a compatibility gotcha here: RHEL 7 binaries use a certain version of GLIBC (that's the GNU standard C library). That version is not available on RHEL 6. If you take an application built on RHEL 7 (like the main "portable" .NET Core SDK is), and try and run it on RHEL 6, it will run, with glibc symbol lookup issues. If you take a the RHEL 6 version of a binary, it should run on RHEL 7 (there might be issues, but not these glibc symbol lookup issues).

Assuming all I needed to do was simply drop a renamed copy into the dotnet folder where it could find it, the last problem I ran into was e_sqlite3.so tries to load GLIBC 2.14, which is not provided for RHEL6, which only provides 2.12. Trying to drop in the RHEL7 2.17 so only led to further problems.

Copying over the glibc.so from one distro to another (or one version of a distro to another) is asking for troubles: that's one library on your system that the low level OS components are very, very particular about.

That's the glibc issue I mentioned above. It looks like this e_sqlite.so was built for linux-x64 RID (which means RHEL 7 or a newer OS). It wont work on RHEL 6 (or a derivative like RedHawk Linux... which seems to be derived from RHEL 6?).

Some options to look into are: filing issues with EntityFramework repo (so they can look into this RHEL 6 compatibility issue) and with the underlying https://github.com/ericsink/SQLitePCL.raw repository that builds the e_sqlite3.so binaries.

omajid avatar Oct 18 '19 20:10 omajid

I have had the chance to look further into this.

To be clear the project I am trying to get running was developed and runs fine on Windows. So this is more of a porting effort. I have already gotten a "Hello World" project running. I have also never done anything "real time" so I don't think that should have any bearing on what I am trying to do; Red Hawk is just the environment I was provided with (I think the customer is still running 32-bit apps; apparently Red Hat/Red Hawk 7 is 64-bit only).

I have had no problems using the pre-built ICU binaries provided. If it is better for the user to build ICU then the document should probably be updated to reflect that, but I am not going to mess with them.

I did have a working ,NET Core 1.0.0-preview2 + Microsoft.Data.Sqlite running on RHEL6 at one point before 1.0 came out I believe.

So I suspect my problem comes down to packages dropping support for RHEL6 at some point. I have also tried to swap out Microsoft.Data.Sqlite for System.Data.SQLite but it seems both are ultimately dependent on versions of glibc that RHEL6 just doesn't have (not 100% sure on this Linux isn't my strong point).

I suppose .NET Core itself runs fine enough, it's only when I am trying to add other packages that I a running into problems, I would suggest something be added to the RHEL6 document to remind users that third-party packages that include native code, even if they claim to be compatible with linux, may still not work on RHEL6, it's all on the package maintainer.

The-MAZZTer avatar Oct 28 '19 22:10 The-MAZZTer

I have resolved my problem by building sqlite3 from source with GLIBC dependency removed (not sure what it uses it for, "backtrace", so is that for stack traces if it crashes?) and dropping e_sqlite3.so in my dotnet folder. Not ideal and supposedly SQLitePCLRaw should let me point to an arbitrary so if I understand the README on its github so I might look into that.

Thanks to listening to me vent, and sorry. Feel free to close if you think no action is needed (though I would appreciate a document update to warn that packages may not support RHEL6, and does the official Microsoft sqlite3 build need GLIBC dependency enabled?).

The-MAZZTer avatar Oct 29 '19 16:10 The-MAZZTer