Open justasxz opened 3 weeks ago
Did you see https://github.com/kleisauke/net-vips/issues/189#issuecomment-1408407451 ?
I have all the native-arm packages installed.
You could try to install the NetVips.Native
NuGet package, it will automatically choose the appropriate NetVips.Native.* package based on which OS/bitness it's running on. This can be useful for cross-platform deployments.
Did you see #189 (comment) ?
I have all the native-arm packages installed.
You could try to install the
NetVips.Native
NuGet package, it will automatically choose the appropriate NetVips.Native.* package based on which OS/bitness it's running on. This can be useful for cross-platform deployments.
Thanks, for quick reply. Yes I tried various combinations such as netvips and netvips.native only. netvips native and arm64 version at the same time. Only arm64 version, neither works. Here is the full error:
Exception has occurred: CLR/System.DllNotFoundException
Exception thrown: 'System.DllNotFoundException' in NetVips.dll: 'libvips.so.42'
at NetVips.Internal.Vips.Init(String argv0)
at NetVips.NetVips.Init()
at NetVips.ModuleInitializer.Initialize()
at .cctor()
at PSPerformance.Domain.Editor.EditorImage.
If that helps I had similar issue with MagickNet until I added this to my csproj < MagickCopyNativeMacOS >true< /MagickCopyNativeMacOS >
Just to reiterate this is blazor hybrid project (so basically maui + blazor) It works fine on windows, just on macos keeps throwing that error. I have not tried, but I believe manually adding the dll might help ?
On macOS, it should look for libvips.42.dylib
instead of libvips.so.42
. Could you try updating to the release candidates of NetVips 3.0.0 and NetVips.Native 8.16.0?
https://www.nuget.org/packages/NetVips/3.0.0-rc1
https://www.nuget.org/packages/NetVips.Native/8.16.0-rc1
If that works, it seems that the wrong NetVips DLL for Linux (from the runtimes/unix/lib/netstandard2.0
directory) is being used on macOS, when it should be loading the macOS-specific DLL (from the runtimes/osx/lib/netstandard2.0
directory) instead. Fortunately, after commit 14480400ce17a1bbb48c74e718f4d05f50e11e49, only a single DLL is now required, with re-mapping handled at runtime using NativeLibrary.SetDllImportResolver()
.
On macOS, it should look for
libvips.42.dylib
instead oflibvips.so.42
. Could you try updating to the release candidates of NetVips 3.0.0 and NetVips.Native 8.16.0? https://www.nuget.org/packages/NetVips/3.0.0-rc1 https://www.nuget.org/packages/NetVips.Native/8.16.0-rc1If that works, it seems that the wrong NetVips DLL for Linux (from the
runtimes/unix/lib/netstandard2.0
directory) is being used on macOS, when it should be loading the macOS-specific DLL (from theruntimes/osx/lib/netstandard2.0
directory) instead. Fortunately, after commit 1448040, only a single DLL is now required, with re-mapping handled at runtime usingNativeLibrary.SetDllImportResolver()
.
I updated it to the newest versions but I seem to be getting the same issue. To clarify the target is maccatalyst. I don't think you can target macOS directly on blazor hybrid. Unless I am missing something.
It appears that this issue is related to https://github.com/dotnet/runtime/issues/104160. As a workaround, you could try symlinking or renaming libvips.42.dylib
to libvips.so.42
, although I'm unsure if this would work on Mac Catalyst without further adjustments.
Additionally, I'm uncertain whether NetVips, or any other that relies on unmanaged/native code, would function correctly in a Blazor Hybrid environment. It's probably unsupported in Blazor components, as P/Invoke isn't natively supported there.
@justasxz Are you able to test commit 8308801dd52e84a6769b688019193b3d02fdab09? Testing can be done by using the nightly version of NetVips. Add the https://ci.appveyor.com/nuget/net-vips
feed in the <packageSources>
section of your NuGet.config
:
<packageSources>
<add key="netvips-nightly" value="https://ci.appveyor.com/nuget/net-vips" />
</packageSources>
And update NetVips to 3.0.0 (build number 605 - prerelease).
Hmm, looking at PortableRuntimeIdentifierGraph.json
, I'm unsure if the above commit will work with the NetVips.Native*
packages, since the maccatalyst
RIDs inherit from ios
rather than osx
.
graph TD;
unix --> unix-x64 & ios & unix-arm64;
unix-x64 --> ios-x64;
unix-arm64 --> ios-arm64;
ios --> ios-x64 & maccatalyst & ios-arm64;
ios-x64 & maccatalyst --> maccatalyst-x64;
ios-arm64 & maccatalyst --> maccatalyst-arm64;
@justasxz Are you able to test commit 8308801? Testing can be done by using the nightly version of NetVips. Add the
https://ci.appveyor.com/nuget/net-vips
feed in the<packageSources>
section of yourNuGet.config
:<packageSources> <add key="netvips-nightly" value="https://ci.appveyor.com/nuget/net-vips" /> </packageSources>
And update NetVips to 3.0.0 (build number 605 - prerelease).
I would for sure be able to, I greatly appreciate your effort to add support to maccatalyst. But you just responded that you doubt it would work. Do you want me to test it or wait for another commit ?
Do you want me to test it or wait for another commit ?
Feel free to test that commit; hopefully it will now look for libvips.42.dylib
instead of libvips.so.42
.
Support for iOS (and .NET MAUI) is being tracked in issue #154.
Hi,
So I am trying to build the application (that already runs on windows) on mac, it builds successfully everything seems to work, but when the application opens up it throws netvips.dll exception. Is there any fix to this ? I have all the native-arm packages installed. It only fails when it tries to run netvips code, it functions normally besides that. I am running VS Code blazor hybrid