intel / libvpl

Intel® Video Processing Library (Intel® VPL) API, dispatcher, and examples
https://intel.github.io/libvpl/
MIT License
262 stars 80 forks source link

Intel® VPL does not consider install prefix as a library search path #119

Closed twelho closed 1 month ago

twelho commented 5 months ago

Currently, oneVPL relies on a fixed list of paths and some environment variables for locating its libraries. This caused an issue in OBS Studio, where the install prefix used in the Flatpak build (Linux/x86_64) is not being searched for libraries. See https://github.com/obsproject/obs-studio/pull/10047 for details.

In summary, this results in MFX_ERR_NOT_FOUND being returned from MFXCreateSession, implemented on libvpl's side in mfx_dispatcher_vpl.cpp. Internally, CreateSession fails in mfx_dispatcher_vpl_loader.cpp due to m_implInfoList being empty. That list is populated by QueryLibraryCaps, which in turn requires m_libInfoList to be populated. This happens in BuildListOfCandidateLibs, which ultimately checks the following paths for the libraries, in from highest to lowest priority:

  1. ONEVPL_PRIORITY_PATH environment variable
  2. LD_LIBRARY_PATH environment variable
  3. /usr/lib/x86_64-linux-gnu
  4. /lib
  5. /usr/lib
  6. /lib64
  7. /usr/lib64
  8. ONEVPL_SEARCH_PATH environment variable
  9. /opt/intel/mediasdk/lib
  10. /opt/intel/mediasdk/lib64

As argued for in https://github.com/obsproject/obs-studio/pull/10047, this list should unconditionally contain the install prefix, which in this case is /app/lib. Setting, for example, ONEVPL_SEARCH_PATH=/app/lib is considered a workaround, not a solution.

jonrecker commented 5 months ago

Thanks for the input. VPL dispatcher searches for runtime libraries in a set of known paths plus additional locations specified with environment variables, as listed above. More info is here in the programing guide. The install location for VPL dispatcher itself (this repository) is not included as a default search path, since the runtime libraries which it loads are built from different repositories and may not be installed to the same path. However, this is something we will consider adding with the next update of VPL API.

akwrobel commented 1 month ago

Hi @twelho This is issue is now resolved in our latest release. https://github.com/intel/libvpl/releases/tag/v2.11.0

jonrecker commented 1 month ago

Specifically, if -D ENABLE_LIBDIR_IN_RUNTIME_SEARCH=ON is added during cmake configuration, then CMAKE_INSTALL_FULL_LIBDIR will be added to the runtime library search locations.