-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
NewFromBuffer/FindLoadBuffer error in NetVips.Native.osx-x64 #83
Comments
Based on the stack trace it looks like the Windows NetVips DLL (from the I had a similar problem while testing this on Mono running on macOS. I noticed this during my initial attempt.
So, it copies the Windows DLL instead than the macOS DLL to the output directory. Setting the
Line 38 in 7ff45f8
(I'm not sure why Mono didn't set this property by default, .NET Core doesn't have this kind of problems) You could also use a <?xml version="1.0" encoding="utf-8"?>
<!-- This configuration is only required for Mono runtime on platforms other than Windows -->
<configuration>
<dllmap dll="libglib-2.0-0.dll" os="linux,freebsd,netbsd" target="libgobject-2.0.so.0"/>
<dllmap dll="libgobject-2.0-0.dll" os="linux,freebsd,netbsd" target="libgobject-2.0.so.0"/>
<dllmap dll="libvips-42.dll" os="linux,freebsd,netbsd" target="libvips.so.42"/>
<dllmap dll="libglib-2.0-0.dll" os="osx" target="libgobject-2.0.dylib"/>
<dllmap dll="libgobject-2.0-0.dll" os="osx" target="libgobject-2.0.dylib"/>
<dllmap dll="libvips-42.dll" os="osx" target="libvips.42.dylib"/>
</configuration> (untested) |
@kleisauke, thanks. I will give this a try. I was thinking the |
Two things I noticed:
After that, now the test case errors like this:
|
Ah, I read too fast. That's odd. I'm not sure why some of the tests work and others don't. Are they all using export MONO_LOG_LEVEL="debug"
export MONO_LOG_MASK="dll" Also, maybe this
I think that's right. Only the native
That is on purpose, |
Ahh, I removed the Here's what its saying:
The library name is So I then
Looks like that library name is So I then
|
You still need the
|
Okay, I'll give that a try. It still looks like its trying to locate glib even if it is baked into libvips. On a side note, I'm seeing why I didn't need a dll.config for my netminiz. I did it slightly different: https://github.com/jsm174/net-miniz/blob/master/NetMiniZ/NetMinizUtils.cs#L45 |
Added the It looks like
|
That's what it was. I temporarily swapped the symbolic link for The test case then passed. Will have to figure out how to have it use yours instead of monos. |
So I'm still at a loss on this. Mono seems to need
|
Fixes compatibility with Mono and other libraries that depend on GLib. See: kleisauke/net-vips#83.
I was able to reproduce this. It looks like Lines 19 to 21 in 4dae98d
Given that the above workaround is a hackish solution, I decided to build libvips as a single shared binary on Linux and macOS with GLib statically linked (commit kleisauke/libvips-packaging@8a89a8e) to avoid conflicts with other installed GLib libraries (if any). This is released as NetVips.Native v8.9.2-build3 on NuGet which requires NetVips v1.2.3 (commit e04c6b0). If you deploy --- a/NetVips.dll.config
+++ b/NetVips.dll.config
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This configuration is only required for Mono runtime on platforms other than Windows -->
<configuration>
- <dllmap dll="libglib-2.0-0.dll" os="linux,freebsd,netbsd" target="libgobject-2.0.so.0"/>
- <dllmap dll="libgobject-2.0-0.dll" os="linux,freebsd,netbsd" target="libgobject-2.0.so.0"/>
+ <dllmap dll="libglib-2.0-0.dll" os="linux,freebsd,netbsd" target="libvips.so.42"/>
+ <dllmap dll="libgobject-2.0-0.dll" os="linux,freebsd,netbsd" target="libvips.so.42"/>
<dllmap dll="libvips-42.dll" os="linux,freebsd,netbsd" target="libvips.so.42"/>
- <dllmap dll="libglib-2.0-0.dll" os="osx" target="libgobject-2.0.dylib"/>
- <dllmap dll="libgobject-2.0-0.dll" os="osx" target="libgobject-2.0.dylib"/>
+ <dllmap dll="libglib-2.0-0.dll" os="osx" target="libvips.42.dylib"/>
+ <dllmap dll="libgobject-2.0-0.dll" os="osx" target="libvips.42.dylib"/>
<dllmap dll="libvips-42.dll" os="osx" target="libvips.42.dylib"/>
</configuration> Thanks for reporting this! |
@kleisauke - Thanks. I will give this a try in the morning.. I've had a very challenging go with DLLs / maps (and Since our project runs in Unity, I can not get it to accept individual specific maps. Ie, you have to change Unity's config:
And out of the box Unity has the entries:
I wonder if these might collide with your updates. It looks like this has existed for nearly a decade, so it's probably never going to change: https://forum.unity.com/threads/has-anyone-done-opencl-unity-on-mac.173728/#post-1207632 |
I don't like the To fix this behavior of Mono, you could paste this in your csproj file: <!-- https://github.com/mono/mono/issues/15569 -->
<PropertyGroup Condition="'$(MSBuildRuntimeType)' == 'Mono'">
<RuntimeIdentifier Condition="$([MSBuild]::IsOSPlatform('Linux'))">linux-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="$([MSBuild]::IsOSPlatform('OSX'))">osx-x64</RuntimeIdentifier>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
</PropertyGroup> To ensure that it chooses the correct DLL after the restoring and building the project. This avoids having to use |
So I finally had a chance to test 1.2.3 and 8.9.2-build3, and it worked! I still had no choice but to add the entries to Unity's config file. I'm a little concerned it could potentially clash with the default ones, but it does seem to be working well. (The names are different so I guess thats why it works). |
Great. I'm glad it's working now. I'll close this issue. |
Now that
NetVips.Native.osx-x64 8.9.2-build2
works in Mono, we were able to start running test cases on MacOS.Out of our 113 tests, many of which use NetVips, only one has an error. The same test passes in Win x64.
The test uses
Image.NewFromBuffer()
and is passed in abyte[]
containing a png.I believe the error is ultimately with
FindLoadBuffer
.Here is the stack trace:
I looked at:
https://github.com/kleisauke/net-vips/blob/master/src/NetVips/Image.cs/#L305
https://github.com/kleisauke/net-vips/blob/master/src/NetVips/Image.cs/#L138
I checked the dylib for
vips_foreign_find_load_buffer
and it is there:The text was updated successfully, but these errors were encountered: