-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
.NET single-file deployment behaviour has changed with the libsodium v1.0.19.1+ NuGet package #1437
Comments
The change for v1.0.19.1 happened between September 2023 and May 2024 (8 months ago). This is equivalent to Could it be related to a Zig update? There were some changes to the builds for macOS (80aca14), but it looks like they were reverted (08fa6d1), and I think linux-musl stayed the same besides c9a92ea. CC'ing some people who've been involved in .NET PRs here: @nil4, @MartyIX, @ektrah, @alexrp, @js-9, @bfren, @MichalPetryka, @SeanMollet, @enclave-alistair (sorry for bothering you) |
It's a bit difficult to diagnose why |
Well, it's actually not that difficult. The A file will be excluded by the The file type is detected by the
So I have no idea. It's a bit difficult to diagnose 😸 |
The macOS library files changed between 1.0.19 and 1.0.19.1. In the earlier package, the > curl -fsSL -o 19.zip https://www.nuget.org/api/v2/package/libsodium/1.0.19 && unzip 19.zip -d 19
> file ./19/runtimes/osx-arm64/native/libsodium.dylib
./19/runtimes/osx-arm64/native/libsodium.dylib: Mach-O 64-bit dynamically linked shared library arm64
> file ./19/runtimes/osx-x64/native/libsodium.dylib
./19/runtimes/osx-x64/native/libsodium.dylib: Mach-O 64-bit dynamically linked shared library x86_64 In the later version, they became universal (fat) binaries: > curl -fsSL -o 19.1.zip https://www.nuget.org/api/v2/package/libsodium/1.0.19.1 && unzip 19.1.zip -d 19.1
> file ./19.1/runtimes/osx-arm64/native/libsodium.dylib
./19.1/runtimes/osx-arm64/native/libsodium.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64:Mach-O 64-bit dynamically linked shared library arm64]
./19.1/runtimes/osx-arm64/native/libsodium.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
./19.1/runtimes/osx-arm64/native/libsodium.dylib (for architecture arm64): Mach-O 64-bit dynamically linked shared library arm64
> file ./19.1/runtimes/osx-x64/native/libsodium.dylib
./19.1/runtimes/osx-x64/native/libsodium.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64:Mach-O 64-bit dynamically linked shared library arm64]
./19.1/runtimes/osx-x64/native/libsodium.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
./19.1/runtimes/osx-x64/native/libsodium.dylib (for architecture arm64): Mach-O 64-bit dynamically linked shared library arm64 This supports @ektrah's spot-on sleuthing above. I also think that the best avenue to figure out why published output differs would be to open an issue on the .NET SDK or runtime repos. The macOS |
Thanks both, I'll open an issue or discussion in a .NET repo and link them here. |
In .NET, you can bundle the runtime and libraries into a single executable, meaning users only need the executable to run your application (rather than needing to install the .NET runtime or have libraries in the same folder).
I've just been trying to create a new release of a project and have encountered an issue when doing a self-contained, single-file deployment for macOS (osx-x64 and osx-arm64).
win-x64
,win-x86
,win-arm64
,linux-x64
,linux-arm64
, andlinux-arm
don't seem to be affected. However,linux-musl-x64
has the same problem as macOS.With v1.0.19 of the NuGet package, the libsodium library is bundled into the executable. However, with v1.0.19.1 onwards, it's not. You get a separate
libsodium.dylib
file (for macOS) orlibsodium.a
file (forlinux-musl-x64
) that needs to be kept with your executable for the application to work.v1.0.19 was published to NuGet on the 19th September 2023, so a change after that date seems to have affected this functionality.
I unfortunately can't downgrade the libsodium package because my .NET libsodium binding enforces the latest version.
Steps to reproduce
dotnet new console --framework net8.0
.dotnet add package libsodium --version 1.0.19.1
.dotnet publish -c Release -r osx-x64 -p:PublishSingleFile=true -p:PublishTrimmed=true -p:PublishReadyToRun=true -p:IncludeNativeLibrariesForSelfExtract=true --self-contained true
.bin\Release\net8.0\osx-x64\publish\
), and you'll see there's alibsodium.dylib
file.dotnet add package libsodium --version 1.0.19
.dotnet publish
again as before.libsodium.dylib
file. This is what you want.The text was updated successfully, but these errors were encountered: