-
-
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
libsodium
NuGet package unusable on win-arm64
#1430
Comments
It seems that the Ruling out .NET being related to, or the actual root case here -- ref. #1431 (comment) loading this DLL using plain Windows APIs from C and Zig fails very similarly, reporting that it is not a valid executable format. |
Is there a way to test this without a Windows machine? |
By the way, is this only on Windows ARM64? Does a library compiled with |
I'm not aware of one; I believe a Windows machine or VM with an ARM64 CPU is required AFAIK. |
Yes, this is solely about Windows ARM64. The binary Hence my testing that a VC++ build for ARM64 Windows does indeed work, and proposing the PR. |
https://github.com/utmapp/UTM seems to be able to run Windows VMs on Apple arm hardware -- if that's available. ref. utmapp/UTM#6816 (comment) The Windows ARM64 ISO is publicly-downloadable here: https://www.microsoft.com/en-us/software-download/windows11arm64 |
A new version of the NuGet package has been uploaded. |
Much appreciated, thank you! |
It appears that the NuGet package (at least version 1.0.20) includes an invalid
libsodium.dll
forwin-arm64
. I'm not sure if this is because it was built with Zig, but this is reproducible on two separate machines, a Windows VM running under Parallels on macOS, and a Lenovo laptop with a Qualcomm ARM64 CPU.(I found a few issues and discussions around this topic already, and I hope I can contribute to fixing this issue by providing the information below.)
I would be happy to help in any way that I can to find a solution to this issue. At the very least, I hope some of the information below might help improve the build/CI or testing strategy for future releases. For instance, actions/partner-runner-images#19 gives some hope that an earlier announcement may soon materialize:
Steps to reproduce with
libsodium
NuGet packageRun the following steps on a Windows machine with ARM64 CPU. (To keep it brief, I'll use
[...]
below to elide some irrelevant bits of output.)Create a new .NET console app and add the
libsodium
package reference:Edit
repro.csproj
and make the following change:<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net9.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <ItemGroup> <PackageReference Include="libsodium" Version="1.0.20" /> </ItemGroup> </Project>
Edit
Program.cs
and replace its entire content with:Compile and run the app for
win-arm64
, note thatlibsodium.dll
fails to load at runtime:Testing a local VC++ build
Clone the libsodium repo locally:
As a quick & dirty test, apply the following patch to
builds\msvc\build\buildbase.bat
to only build the Release DLL forARM64
and then immediately exit:Run the batch file and note it succeds:
Confirm that
libsodium.dll
was indeed compiled successfully:Note that the DLL built with VC++ is quite a bit smaller (222,720 bytes) compared to the one provided in the
libsodium
package (391,168 bytes)Finally, update the
repro\Program.cs
to load the locally-built DLL, making the following change:Compile and run the .NET program again, noting it now succeeds:
Detailed version information
The text was updated successfully, but these errors were encountered: