Add Lzma library files to the repository#124003
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds the XZ Utils library (version 5.8.2) to the dotnet/runtime repository as preparatory work for issue #1542. The addition includes the complete LZMA compression library source code, build configurations, documentation, and integration scripts.
Changes:
- Adds XZ Utils 5.8.2 library files from the tukaani-project/xz repository
- Includes CMake and Autotools build system configurations
- Adds documentation, examples, and internationalization support files
- Configures the library for static linking with multithreading disabled
Reviewed changes
Copilot reviewed 75 out of 497 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/native/external/xz/* | Complete XZ Utils 5.8.2 library source code including build scripts, documentation, examples, and localization files |
| src/native/external/xz.cmake | CMake configuration to integrate XZ Utils into dotnet/runtime build system with specific feature flags |
| src/native/external/xz.version | Version tracking file indicating XZ Utils v5.8.2 from tukaani-project |
| src/native/external/cgmanifest.json | Component governance manifest entry for XZ Utils dependency |
|
Tagging subscribers to this area: @karelz, @dotnet/area-system-io-compression |
|
I am getting compile errors on linux: Seems like there is something wrong with the exports specification: System.IO.Compression.Native$ nm libSystem.IO.Compression.Native.so | grep " lzma_stream_decoder"
00000000003c51c0 t lzma_stream_decoder
00000000003c4410 t lzma_stream_decoder_initAll the other exported entries have But the exports file seems to be generated correctly: I am not sure what is going on here, maybe there is a problem because the library functions are declared as runtime/src/native/external/xz/src/liblzma/api/lzma/container.h Lines 838 to 840 in d8731e0 I will need to investigate a bit more |
Co-authored-by: Copilot <[email protected]>
Should be working now |
Co-authored-by: Copilot <[email protected]>
|
What sort of size increase do we see to our system.io.compression.native with this, across different platforms? Have you confirmed we are linking correctly and getting the minimal set of things we need? |
the PR as-is increases the native .so by about 60 kB in release on my desktop, there is a reference to |
| @@ -0,0 +1,302 @@ | |||
| #!@POSIX_SHELL@ | |||
| # SPDX-License-Identifier: GPL-2.0-or-later | |||
There was a problem hiding this comment.
Do we really need these GPL licensed sources?
There was a problem hiding this comment.
Unfortunately, the configure-time step fails without them even though they are not necessary for the liblzma target build, we could get rid of them after some CMakeLists.txt modifications.
There was a problem hiding this comment.
Would it be a small change that can be up streamed?
I expect that this will get flagged by license scanning tools like https://github.com/dotnet/dotnet/blob/main/docs/license-scanning.md . If you get rid of all GPL sources, it should make it easier to deal with the license scanning tools.
Does FWIW, I do not see a problem with the extra code that this brings. We add several megabytes of code to netcoreapp every release. The problem I see is that the overall compression design is not trimming friendly. The moment you enable compression for your HttpClient, you get all compression algorithms in our portfolio in your (AOT compiled) binary - discussed at #123531 (comment) . |
I am not 100% sure. I just assumed that the other code does not get eliminated and 60 kB seems reasonable compared to about 400 kB added by zstd when looking at the included code size
Can you see something that we could do about the design to improve the trimming situation? I don't have enough knowledge in that area |
Linkers for native code trim unreachable code by default. If the actual compression / decompression implementation is unreachable code, it is likely stripped by the linker in the final binary.
We have solved this problem for encodings in globalization by having an API that allows registering encoding implementation https://learn.microsoft.com/dotnet/api/system.text.encoding.registerprovider?view=net-10.0#system-text-encoding-registerprovider(system-text-encodingprovider) . We can consider something similar for compression algorithms. |
HAVE_SYS_PARAM_H was misspelled HAVE_PARAM_H. This might have broken the build on systems where sysctl() is used to detect the amount of RAM or the number of processor cores/threads. The cpuset code for FreeBSD doesn't need the macro it so it was removed. Fixes: dotnet/runtime#124003 (comment) Fixes: dotnet/runtime#124003 (comment) Fixes: 7e3493d ("Build: Add very limited experimental CMake support.")
It made no difference in this package, but it's good to fix it still. Fixes: dotnet/runtime#124003 (comment)
HAVE_SYS_PARAM_H was misspelled HAVE_PARAM_H. This might have broken the build on systems where sysctl() is used to detect the amount of RAM or the number of processor cores/threads. The cpuset code for FreeBSD doesn't need the macro it so it was removed. Fixes: dotnet/runtime#124003 (comment) Fixes: dotnet/runtime#124003 (comment) Fixes: 7e3493d ("Build: Add very limited experimental CMake support.")
It made no difference in this package, but it's good to fix it still. Fixes: dotnet/runtime#124003 (comment)
Fixes: dotnet/runtime#124003 (comment) Fixes: 96b663f ("liblzma: Refactor CRC comments.")
HAVE_SYS_PARAM_H was misspelled HAVE_PARAM_H. This might have broken the build on systems where sysctl() is used to detect the amount of RAM or the number of processor cores/threads. The cpuset code for FreeBSD doesn't need the macro it so it was removed. Fixes: dotnet/runtime#124003 (comment) Fixes: dotnet/runtime#124003 (comment) Fixes: 7e3493d ("Build: Add very limited experimental CMake support.")
It doesn't matter in this package, but it's good to fix it still. Fixes: dotnet/runtime#124003 (comment)
Fixes: dotnet/runtime#124003 (comment) Fixes: 96b663f ("liblzma: Refactor CRC comments.")
Preparatory PR for #1542