basler / gst-plugin-pylon

The official GStreamer plug-in for Basler cameras
BSD 3-Clause "New" or "Revised" License
40 stars 9 forks source link

macOS Installation #61

Open snaggas opened 11 months ago

snaggas commented 11 months ago

Hi @thiesmoeller,

I tried to follow your new macOS installation instructions, but unfortunately got stuck at ninja -C build. The pylon libraries (such as pylon/BaslerUniversalInstantCamera.h) are not being found even though they do exist in /Users/<username>/Library/Frameworks/pylon.framework/Versions/A/Headers. I noticed the similarity with the "RPATH" comment, but wasn't quite sure how to solve it. Any suggestion?

Cheers, Sam

P.S. Minor comments:

thiesmoeller commented 11 months ago
thiesmoeller commented 11 months ago

.. you forgot to checkout the feature branch

git checkout feature/macos_port_alpha

snaggas commented 11 months ago

Yes, I did forget that - thanks. The ninja calls then work without issues (although I think it's necessary to prefix them all: PYLON_ROOT=/Users/<username>/Library/Frameworks ninja -C build).

However, when I call LD_LIBRARY_PATH=/Users/<username>/Library/Frameworks/pylon.framework/Versions/A/Libraries gst-launch-1.0 pylonsrc ! fakesink there are some issues with libraries and finally "WARNING: erroneous pipeline: no element "pylonsrc"".

I would note that I tried both the homebrew and official versions of gstreamer, but I couldn't get as far with the official version (perhaps because it installs to the system Library, not the user library?). The meson build step throws some warnings which might be due the homebrew version.

thiesmoeller commented 11 months ago

you might have to clear your gstreamer cache

$HOME/.cache/gstreamer-1.0

it might be that pylonsrc got blacklisted after some failure

you can check this with

gst-inspect-1.0 -b

thiesmoeller commented 11 months ago

Ninja calls only have to be prefixed, if meson have to start to do a reconfigure. As you checked out the new branch, without deleting your build folder, there was a meson cache, that doesn't match the current sources -> new pylon finder run -> PYLON_ROOT has to be set

snaggas commented 11 months ago

Clearing the cache unfortunately doesn't help because the gst call causes the blacklisting (i.e. LD_LIBRARY_PATH=/Users/<username>/Library/Frameworks/pylon.framework/Versions/A/Libraries gst-launch-1.0 pylonsrc ! fakesink or gst-inspect-1.0 -b). These two are blacklisted: libgstpylon.dylib and libgstvalidatessim.dylib.

Here is that part of the output: (gst-plugin-scanner:99677): GStreamer-WARNING **: 16:19:50.010: Failed to load plugin '/usr/local/Cellar/gstreamer/1.22.5/lib/gstreamer-1.0/libgstpylon.dylib': dlopen(/usr/local/Cellar/gstreamer/1.22.5/lib/gstreamer-1.0/libgstpylon.dylib, 0x0002): Library not loaded: '@rpath/pylon.framework/Versions/A/Libraries/libGCBase_gcc_v3_1_Basler_pylon.dylib'

thiesmoeller commented 11 months ago

you have to replace <username> in the path -> or simply put $HOME/Library/Frameworks/pylon.framework/Versions/A/Libraries

snaggas commented 11 months ago

I actually did use the correct replacement for <username>. Sorry for the confusion - here is the actual call and result.

Screen Shot

thiesmoeller commented 11 months ago

hm... only difference I see is, that I installed gstreamer from homebrew. ( also not mentioned in readme yet )

brew install gstreamer

Just checked again, this works on my side

thiesmoeller commented 11 months ago

It's possible that the official gstreamer build somehow only recognises the DYLD_LIBRARY_PATH environment variable for lookup. Can you give that a try?

snaggas commented 11 months ago

Actually, I've also been using the brew version, so I guess it makes sense to stick with that for now since it works for you.

I read the output above a bit more carefully and it seems to be getting the wrong path from @rpath. It's looking for the pylon libraries at the gstreamer installation: /usr/local/Cellar/gstreamer/1.22.5/lib/pylon.framework/Versions/A/Libraries

The pylon libraries are here of course: $HOME/Library/Frameworks/pylon.framework/Versions/A/Libraries

I tried forcing this with LD_LIBRARY_PATH=$HOME/Library/Frameworks/pylon.framework/Versions/A/Libraries DYLD_LIBRARY_PATH=$HOME/Library/Frameworks/pylon.framework/Versions/A/Libraries gst-launch-1.0 pylonsrc ! fakesink but that was just a guess and didn't work.

I was thinking of trying something like this but perhaps that's getting carried away.

thiesmoeller commented 11 months ago

The CI reproduces the error you see... https://github.com/basler/gst-plugin-pylon/actions/runs/5752206328/job/15593622426#step:4:979 which is good.

snaggas commented 11 months ago

It's not clear to me if you had success with your most recent changes, but they didn't work for me. For your info, I did at least get gst-launch-1.0 ... to run by putting a copy of the libraries where they were being sought. Obviously that's dirty, but it at least shows that it will run once the library problem has been solved...

thiesmoeller commented 11 months ago

I'm currently struggling with finding a good solution that still works when the system integrity protection kicks in. It seems that libraries have very limited locations in the filesystem