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

MacOS - DllNotFoundException: webp #42

Open
NikMikk opened this issue Apr 29, 2022 · 19 comments
Open

MacOS - DllNotFoundException: webp #42

NikMikk opened this issue Apr 29, 2022 · 19 comments

Comments

@NikMikk
Copy link

NikMikk commented Apr 29, 2022

Hi!

We're using your wrapper inside our game and it works wonders, except on macOS. The .dll seems to not be included sometimes and sometimes it is but super rare.

Any thoughts on why this might happen?

@NikMikk
Copy link
Author

NikMikk commented Jun 2, 2022

It works on certain macOS devices but won't load on older laptops it seems, is it the DLL_NAME that works differently on older devices?
Uploading Crash Report DllNotFoundException: Unable to load DLL 'webp': The specified module could not be found. at WebP.Texture2DExt.EncodeToWebP (UnityEngine.Texture2D lTexture2D) [0x00000] in <00000000000000000000000000000000>:0

@netpyoung
Copy link
Owner

well.. currently I built native library only x86_64 & arm64 versions for macOS.

Which mac model are you using for? Is that x86 marchine? and which version of unity.webp?

@NikMikk
Copy link
Author

NikMikk commented Jun 2, 2022

Our test laptop is a MacBook Air Early 2014 running Sierra 10.12.6 which is a x86_64 bit operating system

@netpyoung
Copy link
Owner

well.
That issue seems be associated with this line : https://github.com/netpyoung/prebuilt-libwebp/blob/93d292d2d4afd5f13b6bd1049e0d8bc3f3a098f2/Rakefile#L214

I don't rememeber why I set minimum version 13.0. If modify script to minimum version to 10.12, It may will be work except webp's library build enviornment support that.

@NikMikk
Copy link
Author

NikMikk commented Jun 2, 2022

Ohh I see, that makes sense that it's not loading in at all haha.

So the webp's library build environment doesn't support anything lower than 13.0?

@netpyoung
Copy link
Owner

So the webp's library build environment doesn't support anything lower than 13.0?

Not sure, It need to check though out compiling it. but when I googling that It can be work, I will modify build script to 10.12 to check.

@NikMikk
Copy link
Author

NikMikk commented Jun 2, 2022

Awesome, thanks a ton!

@NikMikk
Copy link
Author

NikMikk commented Jun 2, 2022

Could the flag be removed completely? So it works on all 64 bit macOS devices

netpyoung added a commit to netpyoung/prebuilt-libwebp that referenced this issue Jun 2, 2022
@netpyoung netpyoung reopened this Jun 2, 2022
@netpyoung
Copy link
Owner

When remove that flag It gain compatibility but not can be impact on some perfomances. so instead of to remove that flag, I just down min version to 10.12

netpyoung added a commit that referenced this issue Jun 2, 2022
- apply: prebuilt-libwebp v0.0.6 for #42
@netpyoung
Copy link
Owner

@NikMikk
Copy link
Author

NikMikk commented Jun 4, 2022

I will give it a try on Monday!

@NikMikk
Copy link
Author

NikMikk commented Jun 6, 2022

It seems that we're still getting the Could not load DLL error, I will give it another go tomorrow as we've been moving around in our office all day. In other words, I didn't give it much time to make sure everything was correctly set up.

@NikMikk
Copy link
Author

NikMikk commented Jun 8, 2022

Nope still no progress, same error. :(

@netpyoung
Copy link
Owner

:( opps.
The problem is I don't have testable mac device...
to solving this issue It need to test modifying build parameters with machine.

Would you try to run build library script on your local machine remove that line? https://github.com/netpyoung/prebuilt-libwebp/blob/566248b5755428699188a0f11a0eef950823fda5/Rakefile#L214

@NikMikk
Copy link
Author

NikMikk commented Jun 14, 2022

I have no idea run that build script haha, I can give it a go if you help me out here a little first :)

Btw, we're using this in the game TOEM. We want to include you in the credits so if you want to be included, what do you want us to write?

@netpyoung
Copy link
Owner

It willl be better to support variable test macOs versions on github action but not.
anyway to build library using buildscript

git clone https://github.com/netpyoung/prebuilt-libwebp.git
cd prebuilt-libwebp
bundle install

#modify build script maybe remove -mmacos-version-min=10.12 line on Rakefile then

rake update_library_ios

then this funtion will be produce bundle files on build/macos directory.

Did you made that? Wow. That game already in my library. It was cool!
This repo just simple wrapper for webp. I'm just happy with that this repo helps a little people to develop something. I don't want anything.

@NikMikk
Copy link
Author

NikMikk commented Jan 3, 2023

Sorry for the radio silence!

Sorry for being such a noob but how do I build using buildscript / rake?? I've never used it before

This wrapper totally made TOEM's Quality of life update happen, we could double our photo capacity as the image sizes got so small!! We "only" use the decode/encode parts and removed the threading as it caused issues on the switch if lots of photos were loaded at the same time. Not enough mutexes

@megavoid
Copy link

megavoid commented Apr 17, 2023

I had a related issue - I need to convert WebP data to Texture2D and stumbled on this project. When testing this project on my ARM Mac I got a DllNotFoundException when trying to access the Texture2D conversion function.

I simply rebuilt the library on my ARM Mac with rake update_library_macos and finally got it to work.

I do not use this project right now as I only need two functions from the library. The webp.bundle and a small wrapper class is all I need:

using System;
using System.Runtime.InteropServices;

public class WebPWrapper
{

    [DllImport("webp")]
    public static extern int WebPGetInfo(byte[] data, ulong data_size, out int width, out int height);
    
    [DllImport("webp")]
    public static extern IntPtr WebPDecodeRGBA(byte[] data, ulong data_size, out int width, out int height);
}

The build script saved me, though. Thanks!

@netpyoung
Copy link
Owner

netpyoung commented Nov 2, 2023

that problem cause by dependency path. so I fixed that using install_name_tool

  • if you are still using this wrapper try to use
 "com.netpyoung.webp": "https://github.com/netpyoung/unity.webp.git?path=unity_project/Assets/unity.webp#0.3.10",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants