QuantumEntangledAndy / neolink

An RTSP bridge to Reolink IP cameras
GNU Affero General Public License v3.0
330 stars 45 forks source link

Running neolink fails on Macos due to Library not loaded (libssl) #217

Closed ncul777 closed 5 months ago

ncul777 commented 6 months ago

Now I know this is more gstreamer issue rather than neolink but reporting for reference or if anyone has any ideas

Macos 14.3.1,

To Reproduce

  1. Install gstream brew install gstreamer
  2. Create config file (using the sample)
  3. Run neolink

Actual Behaviour

./neolink rtsp --config=neolink.toml
dyld[26705]: Library not loaded: @rpath/libssl.1.1.dylib
  Referenced from: <C5A2BDA1-CBE4-3F5A-908B-6E20F731954C> /Users/nc/Downloads/neolink_macos/neolink
  Reason: tried: '/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/libssl.1.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/libssl.1.1.dylib' (no such file), '/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/libssl.1.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/libssl.1.1.dylib' (no such file), '/usr/local/lib/libssl.1.1.dylib' (no such file), '/usr/lib/libssl.1.1.dylib' (no such file, not in dyld cache)

Note gstreamer installed openssl v3

==> Installing gstreamer dependency: openssl@3
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/manifests/3.2.1-1
Already downloaded: /Users/nc/Library/Caches/Homebrew/downloads/f7b6e249843882452d784a8cbc4e19231186230b9e485a2a284d5c1952a95ec2--openssl@3-3.2.1-1.bottle_manifest.json
==> Pouring openssl@3--3.2.1.sonoma.bottle.1.tar.gz
🍺  /usr/local/Cellar/openssl@3/3.2.1: 6,874 files, 32.5MB

Doing the following didn't help

brew install openssl@1.1

Expected behavior Neolink to connect to the camera

Versions Neolink software: 0.6.3 mac Reolink camera model and firmware: Reolink Lumus

QuantumEntangledAndy commented 6 months ago

This is because brew install openssl@1.1 is keg only which means it is not installed into /usr/local/ but only kept in its keg directory (which macos dosent search)

You can fix this by telling macos where the binary is. There are a few ways to do this. But this is what works for me

cd /neolink/location/whereever/you/put/it
install_name_tool -change @rpath/libssl.1.1.dylib /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib neolink

Which will edit the neolink binary to swap the path from @rpath/libssl.1.1.dylib to /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib which is where brew installs the keg

QuantumEntangledAndy commented 6 months ago

Ok so I have a build of this with updated rpath, this should be addressed it in future releases

ncul777 commented 5 months ago

Thanks a lot for investigating.

I updated that but ran into similar with libcrypto dyld[16317]: Library not loaded: @rpath/libcrypto.1.1.dylib

I only seem to have libcrypto.3.dylib in /usr/local/lib so

I then uninstalled via brew and downloaded/installed the macos pkg from gstreamer site as recommeded in the installation instructions

Neolink now runs and connects to camera!

[2024-04-08T08:35:26Z INFO  neolink] Neolink 459c9255ada7ebda281eba32a8a9b94a30c471f0 release
[2024-04-08T08:35:26Z INFO  neolink::rtsp] Starting RTSP Server at 0.0.0.0:8554
[2024-04-08T08:35:26Z INFO  neolink::rtsp] Lumus: Rtsp Staring
[2024-04-08T08:35:26Z INFO  neolink::utils] Lumus: Connecting to camera at Address: 192.168.0.110
[2024-04-08T08:35:26Z INFO  neolink_core::bc_protocol] Lumus: Trying TCP discovery
[2024-04-08T08:35:26Z INFO  neolink_core::bc_protocol] Lumus: TCP Discovery success at 192.168.0.110:9000
[2024-04-08T08:35:26Z INFO  neolink::utils] Lumus: Logging in
[2024-04-08T08:35:26Z INFO  neolink::utils] Lumus: Connected and logged in
[2024-04-08T08:35:28Z INFO  neolink::common::camthread] Lumus: Camera time is already set: 2024-04-08 9:35:28.0 +00:00:00
[2024-04-08T08:35:30Z INFO  neolink::common::neocam] Lumus: Model Reolink Lumus
[2024-04-08T08:35:30Z INFO  neolink::common::neocam] Lumus: Firmware Version v2.0.0.705_21052800
2024-04-08T08:35:31Z INFO  neolink::rtsp::stream] Lumus: Avaliable at /Lumus/main, /Lumus/Main, /Lumus/mainStream, /Lumus/MainStream, /Lumus/Mainstream, /Lumus/mainstream, /Lumus
[2024-04-08T08:35:32Z INFO  neolink::rtsp::stream] Lumus: Avaliable at /Lumus/sub, /Lumus/Sub, /Lumus/subStream, /Lumus/SubStream, /Lumus/Substream, /Lumus/substream

There is a gstreamer warning on startup which didn't seem have an impact on capturing images (using the command ./neolink image --config=neolink.toml --file-path=output.jpeg Lumus)

(gst-plugin-scanner:28782): GStreamer-WARNING **: 09:25:49.909: Failed to load plugin '/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0/libgstopenjpeg.dylib': dlopen(/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0/libgstopenjpeg.dylib, 0x0002): Library not loaded: @rpath/@rpath/lib/libopenjp2.7.dylib

I'm happy to close this issue.