YorVeX / ObsCSharpExample

Example for an OBS plugin written in C# containing various standard items like output, filter, source or a settings dialog in the OBS Tools menu. Meant to be used both to learn writing OBS plugins in C# and as a template for creating new plugins or plugin content like a source or an output.
MIT License
11 stars 2 forks source link

Unable to load plugin #3

Closed PedroCavaleiro closed 7 months ago

PedroCavaleiro commented 7 months ago

Unable to load the plugin into OBS on macOS & OBS 30

Took all build steps changing only the -r parameter to osx-x64 (since I have a Intel based Mac)

Created in the folder ~/Library/Application Support/obs-studio/plugins the structure like yours ProjectName/bin/x64, also tested ProjectName/bin/mac and ProjectName/Mac/ but no avail

No errors on OBS logs, this example simply doesn't load

I assume it's required to pack it into .plugin files but still haven't figured out how to do it

YorVeX commented 7 months ago

Happy to see someone is looking into Mac support, but just to be sure: you're aware that you entered uncharted territory there, right? I don't even have a Mac myself, so won't be able to be of any help. Only very recently with the release of .NET 8 Mac support for NativeAOT libraries like this was added, so even outside of this project you probably won't find many people with experience in this area (or help resources whatsoever). So all I can do right now is wishing you good luck basically 🍀

PedroCavaleiro commented 7 months ago

Welp, I just wanted to know if the build process has changed in some way

YorVeX commented 7 months ago

Welp, I just wanted to know if the build process has changed in some way

Hehe, for Mac there simply is no build process, and nothing has changed about that, until someone comes along who figures it out 😎

PedroCavaleiro commented 7 months ago

Actually is just like Linux just change the -r flag to osx-x64 and it’s done I just find weird that the plugin doesn’t load as expected I’ll try later on Windows to see what I’m doing wrong

YorVeX commented 7 months ago

Actually is just like Linux just change the -r flag to osx-x64 and it’s done I just find weird that the plugin doesn’t load as expected I’ll try later on Windows to see what I’m doing wrong

I think in theory it should really be that simple now that .NET 8 officially supports it, it's just that I have no way of testing it myself. When you say there is nothing in OBS log that makes me think whatever is wrong must also be something rather simple, like files not having the right name or not being in the right folder. Otherwise OBS would at least try to load the plugin and then write an error message to the log when this fails. When you get nothing it means it just didn't find any plugin file there to begin with.

Please keep us posted, would be really nice to be able to add macOS support to my other plugins. Though even if you manage to do it, I still don't have a Mac to be able to compile it myself, but I think at least for the x86 variant I should be able to run this in a VM, just haven't taken the time to look into it yet.

PedroCavaleiro commented 7 months ago

I solved the issue finally

So on the path ~/Library/Application Support/obs-studio/plugins create the folder with the following structure ProjectName/bin

Assuming that you're in the scripts folder of this project you execute the script like so

dotnet publish .. -c Release -o ..\publish\osx-x64 -r osx-x64 /p:DefineConstants=MACOS /p:NativeLib=Shared /p:SelfContained=true

This will generate you the file with a extension .dylib here is where the problems started, the file did not have the execution permissions and it didn't have the proper extension so using

chmod +x filename.dylib

Handles the permissions and rename the filename.dylib to filename.so and it works

YorVeX commented 7 months ago

So OBS successfully loaded the plugin and you can see the elements it created there? Would it be a lot to ask whether you can try to compile my https://github.com/YorVeX/xObsAsyncImageSource plugin for macOS and see whether you can get async image sources in OBS to work?

PedroCavaleiro commented 7 months ago

So OBS successfully loaded the plugin and you can see the elements it created there? Would it be a lot to ask whether you can try to compile my https://github.com/YorVeX/xObsAsyncImageSource plugin for macOS and see whether you can get async image sources in OBS to work?

Working just fine

YorVeX commented 7 months ago

So OBS successfully loaded the plugin and you can see the elements it created there? Would it be a lot to ask whether you can try to compile my https://github.com/YorVeX/xObsAsyncImageSource plugin for macOS and see whether you can get async image sources in OBS to work?

Working just fine

That's great news, thanks a lot, I guess I have to look into getting a VM set up for this soon!