Skip to content

Commit a5efaf9

Browse files
NaGeLBaileyTabby
andauthored
Fix onnxruntime clash with BackgroundRemoval (#303)
* Fix onnxruntime clash with BackgroundRemoval * Fix formatting of FetchOnnxruntime.cmake to make the linter happy --------- Co-authored-by: Tabitha Cromarty <tabby@brightmoon.online>
1 parent 35b0abf commit a5efaf9

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

.github/scripts/.Aptfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ package 'nvidia-opencl-dev'
1212
package 'ocl-icd-opencl-dev'
1313
package 'opencl-headers'
1414
package 'pkg-config'
15+
package 'patchelf'

cmake/FetchOnnxruntime.cmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,16 @@ else()
8787
target_include_directories(${CMAKE_PROJECT_NAME} SYSTEM PUBLIC "${onnxruntime_SOURCE_DIR}/include")
8888
install(FILES ${Onnxruntime_INSTALL_LIBS} DESTINATION "${CMAKE_INSTALL_LIBDIR}/obs-plugins/${CMAKE_PROJECT_NAME}")
8989
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN/${CMAKE_PROJECT_NAME}")
90+
91+
find_program(PATCHELF_EXE patchelf)
92+
if(PATCHELF_EXE)
93+
add_custom_command(
94+
TARGET ${CMAKE_PROJECT_NAME}
95+
POST_BUILD
96+
COMMAND ${PATCHELF_EXE} --replace-needed libonnxruntime.so.1 libonnxruntime.so.${Onnxruntime_VERSION}
97+
$<TARGET_FILE:${CMAKE_PROJECT_NAME}>
98+
COMMENT "Fixing ONNX dependency name for portability")
99+
else()
100+
message(WARNING "patchelf not found! The binary will still look for libonnxruntime.so.1")
101+
endif()
90102
endif()

flatpak/com.obsproject.Studio.Plugin.LocalVocal.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,19 @@ modules:
202202
chmod 755 ${FLATPAK_DEST}/uic-wrapper
203203
sources: []
204204

205+
# patchelf - for direct so version linking
206+
- name : patchelf
207+
buildsystem: simple
208+
build-commands:
209+
- install -D patchelf ${FLATPAK_DEST}/bin/patchelf
210+
sources:
211+
- type: archive
212+
url: https://github.com/NixOS/patchelf/releases/download/0.18.0/patchelf-0.18.0-x86_64.tar.gz
213+
strip-components: 2
214+
sha256: ce84f2447fb7a8679e58bc54a20dc2b01b37b5802e12c57eece772a6f14bf3f0
215+
cleanup:
216+
- /bin/patchelf
217+
- /bin
205218
# OBS LocalVocal - Main plugin
206219
- name: obs-localvocal
207220
buildsystem: cmake-ninja

0 commit comments

Comments
 (0)