Skip to content
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

IncludeNativeLibrariesForSelfExtract not working with newer libsodium binaries for osx/linux-musl #45903

Open
samuel-lucas6 opened this issue Jan 11, 2025 · 2 comments
Labels
area-Single-File untriaged Request triage from a team member

Comments

@samuel-lucas6
Copy link

Describe the bug

As discussed here, publishing a single-file application for osx-x64/osx-arm64 with -p:IncludeNativeLibrariesForSelfExtract=true doesn't embed libsodium.dylib in the executable as of v1.0.19.1+ of the libsodium NuGet package. The same issue occurs with libsodium.a for linux-musl-x64/linux-musl-arm64. This wasn't a problem with v1.0.19. win-x64, win-x86, win-arm64, linux-x64, linux-arm64, and linux-arm don't seem to be affected.

As it's unclear why this is happening, I'm opening an issue here to try and get some help from .NET maintainers.

To reproduce

  1. Download the latest .NET 8 SDK installer.
  2. Create a folder to house the project and navigate to it in the terminal.
  3. Create a new console project with dotnet new console --framework net8.0.
  4. Install the libsodium NuGet package with dotnet add package libsodium --version 1.0.19.1.
  5. Do a self-contained, single-file publish for macOS with dotnet publish -c Release -r osx-x64 -p:PublishSingleFile=true -p:PublishTrimmed=true -p:PublishReadyToRun=true -p:IncludeNativeLibrariesForSelfExtract=true --self-contained true. The extra options are just what I normally use.
  6. Navigate to the printed path (bin\Release\net8.0\osx-x64\publish\), and you'll see there's a libsodium.dylib file.
  7. Delete the files in this folder and return to the original project directory.
  8. Change the libsodium package version with dotnet add package libsodium --version 1.0.19.
  9. Use dotnet publish again as before.
  10. Navigate to the printed path again, and you'll see there's no libsodium.dylib file. This is what you want.

Further technical details

Tried on a Windows machine with the latest .NET 8/9 SDKs and on a macOS machine with the latest .NET 8 SDK.

.NET SDK:
 Version:           9.0.101
 Commit:            eedb237549
 Workload version:  9.0.100-manifests.3068a692
 MSBuild version:   17.12.12+1cce77968

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22631
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\9.0.101\

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
  Version:      9.0.0
  Architecture: x64
  Commit:       9d5a6a9aa4

.NET SDKs installed:
  8.0.404 [C:\Program Files\dotnet\sdk]
  9.0.101 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Request triage from a team member label Jan 11, 2025
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

1 similar comment
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Single-File untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

2 participants