fzwoch / obs-gstreamer

GStreamer OBS Studio plugin
GNU General Public License v2.0
358 stars 34 forks source link

Mac distribution appears to be missing a file #74

Closed dgatwood closed 2 years ago

dgatwood commented 2 years ago

The mac distro provides the .so file, but it appears to depend on a file called "obs-gstreamer.dylib".

$ otool -L obs-gstreamer.so obs-gstreamer.so: @rpath/obs-gstreamer.dylib (compatibility version 0.0.0, current version 0.0.0) @rpath/libobs.0.dylib (compatibility version 0.0.0, current version 0.0.0) /opt/local/lib/libgstreamer-1.0.0.dylib (compatibility version 1603.0.0, current version 1603.0.0) /opt/local/lib/libgobject-2.0.0.dylib (compatibility version 5801.0.0, current version 5801.3.0) /opt/local/lib/libglib-2.0.0.dylib (compatibility version 5801.0.0, current version 5801.3.0) /opt/local/lib/libgstvideo-1.0.0.dylib (compatibility version 1603.0.0, current version 1603.0.0) /opt/local/lib/libgstaudio-1.0.0.dylib (compatibility version 1603.0.0, current version 1603.0.0) /opt/local/lib/libgstapp-1.0.0.dylib (compatibility version 1603.0.0, current version 1603.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1)

This file is not found anywhere in the binary distribution zip archive, and appears to be part of this plug-in. As a result, the binary distribution is not usable on macOS. Please update the zip archive to include both files, not just the .so.

More curiously, the .so file appears to contain symbols from every .c file in the source code, so I have no idea what that dylib could even contain.

fzwoch commented 2 years ago

Hopefully the referenced commit fixes that. There is indeed no other dependency. The build system just defaults to .dylib on macOS. But for some reason OBS only loads .so and no .dylib as plugins. So I lazy renamed the file. The first line of the otool output actually is supposed to reference itself. Of course with renaming the file this breaks.

I hope the new builds will have the correct .so reference to itself.

tleish commented 6 months ago

Just ran into this same issue.

$ otool -L obs-gstreamer.so
obs-gstreamer.so:
    @rpath/obs-gstreamer.dylib (compatibility version 0.0.0, current version 0.0.0)
    @rpath/libobs.0.dylib (compatibility version 0.0.0, current version 0.0.0)
    /opt/local/lib/libgstreamer-1.0.0.dylib (compatibility version 1603.0.0, current version 1603.0.0)
    /opt/local/lib/libgobject-2.0.0.dylib (compatibility version 5801.0.0, current version 5801.3.0)
    /opt/local/lib/libglib-2.0.0.dylib (compatibility version 5801.0.0, current version 5801.3.0)
    /opt/local/lib/libgstvideo-1.0.0.dylib (compatibility version 1603.0.0, current version 1603.0.0)
    /opt/local/lib/libgstaudio-1.0.0.dylib (compatibility version 1603.0.0, current version 1603.0.0)
    /opt/local/lib/libgstapp-1.0.0.dylib (compatibility version 1603.0.0, current version 1603.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1)

Logs show:

11:08:46.671: os_dlopen(/Users/username/Library/Application Support/obs-studio/plugins/obs-gstreamer/bin/obs-gstreamer.so->/Users/username/Library/Application Support/obs-studio/plugins/obs-gstreamer/bin/obs-gstreamer.so): dlopen(/Users/username/Library/Application Support/obs-studio/plugins/obs-gstreamer/bin/obs-gstreamer.so, 0x0105): Library not loaded: @rpath/libobs.0.dylib
11:08:46.671:   Referenced from: <CD635E9C-D5D9-34B0-A1A4-5240AE2F7103> /Users/username/Library/Application Support/obs-studio/plugins/obs-gstreamer/bin/obs-gstreamer.so
11:08:46.671:   Reason: tried: '/Applications/OBS.app/Contents/Frameworks/libobs.0.dylib' (no such file), '/Applications/OBS.app/Contents/Frameworks/libobs.0.dylib' (no such file), '/usr/lib/libobs.0.dylib' (no such file, not in dyld cache)
11:08:46.671: 
11:08:46.671: Module '/Users/username/Library/Application Support/obs-studio/plugins/obs-gstreamer/bin/obs-gstreamer.so' not loaded

It's not clear to me how I can fix this.

I did find this thread on OBS.

That is intended - plugins should not link to libobs dynamic library version but use the Framework instead - we introduced the Framework several versions ago and we need to cut the cord (any plugin supporting Apple Silicon needs to use the Framework anyway).

Linking against other libraries in the application bundle besides Qt is also not officially supported, so it's up to plugin authors to keep up with changes to them.

Especially FFmpeg would have broken with the new version regardless, as we've updated to FFmpeg 6 and the named library versions would have changed to libavcodec.60.dylib.

see: https://github.com/obsproject/obs-studio/issues/8698#issuecomment-1500972953

fzwoch commented 6 months ago

You would have to build the plugin to link to the libobs framework instead of the old libobs.dyblib. Proabbly includes changing the meson build to find and use the framework.

rhwinter commented 6 months ago

@fzwoch how would one do that?

I'm trying to compile the plugin for Apple Silicon (an M-series ARM CPU), but I can't get past this:

$ meson --buildtype=release build
The Meson build system
Version: 1.4.0
Source dir: ____/obs/obs-gstreamer
Build dir: ____/obs/obs-gstreamer/build
Build type: native build
Project name: obs-gstreamer
Project version: undefined
C compiler for the host machine: cc (clang 15.0.0 "Apple clang version 15.0.0 (clang-1500.3.9.4)")
C linker for the host machine: cc ld64 1053.12
Host machine cpu family: aarch64
Host machine cpu: aarch64
Found pkg-config: YES (/opt/homebrew/bin/pkg-config) 0.29.2
Found CMake: /opt/homebrew/bin/cmake (3.29.3)
Run-time dependency libobs found: NO (tried pkgconfig, framework and cmake)

meson.build:30:36: ERROR: C header 'obs/obs.h' not found

A full log can be found at ___/obs-gstreamer/build/meson-logs/meson-log.txt
WARNING: Running the setup command as `meson [options]` instead of `meson setup [options]` is ambiguous and deprecated.

I have a folder above with OBS compiled from source (following the official instructions), that is, I have the following folder structure:

./obs-gstreamer/
./obs-studio/

I've been trying for hours, but I can't get meson to find libobs :(

Thanks a lot for any help!

fzwoch commented 6 months ago

Check out .gitlab-ci.yml and docker/macOS files. There you can look up the build steps that have been happening and how the project is set up. Essentially you need to tell meson where to look for OBS's include and library path.