[CSHARP-3824] libmongocrypt.so is separate when building a single-file executable Created: 01/Sep/21 Updated: 27/Oct/23 Resolved: 09/Sep/21 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Field Level Encryption |
| Affects Version/s: | 2.12.0 |
| Fix Version/s: | None |
| Type: | Task | Priority: | Unknown |
| Reporter: | Felix König | Assignee: | James Kovacs |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Linux |
||
| Issue Links: |
|
||||||||
| Description |
|
I am publishing my application as a single-file self-contained (minus runtime) executable like this:
Note that the "--no-self-contained" only means the runtime is not bundled, but dependencies still are due to the "-p:PublishSingleFile=true" flag.
Ignoring pdb files, after I run the above command I can see the following contents under bin\Release\net5.0\linux-x64\publish:
The issue is that the mongocrypt dependency is not bundled within the MyExecutableProject executable. If I delete it manually I get the following error when executing MyExecutableProject:
libmongocrypt.so was not present as a separate file on version 2.11, tested with 2.11.6. |
| Comments |
| Comment by James Kovacs [ 09/Sep/21 ] | |
|
Hi, de.felix.koenig@gmail.com, Glad to hear that this resolved the issue for you. I have closed this issue as resolved. I've opened a separate ticket, CSHARP-3844, to track fixing libmongocrypt.so loading when using CSFLE in a single-file executable. Thanks for using MongoDB! Sincerely, | |
| Comment by Felix König [ 09/Sep/21 ] | |
|
Thank you! That indeed works for me. I was able to update to the latest version (2.13.1) without problem when publishing the way you described. Best Regards, | |
| Comment by James Kovacs [ 09/Sep/21 ] | |
|
Hi, de.felix.koenig@gmail.com, We have reproduced the issue that you describe. This is expected behaviour. libmongocrypt.so is an unmanaged shared library used by client-side field-level encryption (CSFLE). CSFLE support for Linux was introduced in 2.12.0, which is why you do not see this problem with 2.11.6. You can bundle native libraries with your single executable by supplying the additional IncludeNativeLibrariesForSelfExtract option. For example:
This will enable you to run your application as all listed dependencies will be present. It appears that the native library extraction mechanism is not placing libmongocrypt.so in an expected location because loading of the native library fails if you attempt to use CSFLE. We will have to investigate this issue further, but if you are not using CSFLE in your application then the additional publish flag above should allow you to publish and run your application. Sincerely, | |
| Comment by Dmitry Lukyanov (Inactive) [ 01/Sep/21 ] | |
|
Hey de.felix.koenig@gmail.com , thanks for your report, we will check it and come back to you. |