From 1f2a2d22a2c94527a40056a38733306218dfa38f Mon Sep 17 00:00:00 2001 From: Artturin Date: Tue, 25 Nov 2025 21:36:01 +0200 Subject: [PATCH] mjpg-streamer: Fix `input_uvc.so: undefined symbol: resolutions_help` And change the `cd mjpg-streamer-experimental` to be later so we can use patches without needing to change the paths in them. --- .../fix-undefined-symbol-error.patch | 29 +++++++++++++++++++ pkgs/by-name/mj/mjpg-streamer/package.nix | 13 +++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 pkgs/by-name/mj/mjpg-streamer/fix-undefined-symbol-error.patch diff --git a/pkgs/by-name/mj/mjpg-streamer/fix-undefined-symbol-error.patch b/pkgs/by-name/mj/mjpg-streamer/fix-undefined-symbol-error.patch new file mode 100644 index 000000000000..771389bfb3ea --- /dev/null +++ b/pkgs/by-name/mj/mjpg-streamer/fix-undefined-symbol-error.patch @@ -0,0 +1,29 @@ +From 7b24e2a593a0029c6f555c9001be87a34eceecc6 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Tue, 6 Aug 2024 17:04:55 +0200 +Subject: [PATCH] Export all symbols of mjpg_streamer binary + +Fixes runtime error with stripped binary + + dlopen: /usr/lib/mjpg-streamer/input_uvc.so: undefined symbol: resolutions_help + +Source: http://lists.busybox.net/pipermail/buildroot/2024-August/759732.html + +Signed-off-by: Bernd Kuhls +--- + mjpg-streamer-experimental/CMakeLists.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/mjpg-streamer-experimental/CMakeLists.txt b/mjpg-streamer-experimental/CMakeLists.txt +index cf26620e..3ff12cdf 100644 +--- a/mjpg-streamer-experimental/CMakeLists.txt ++++ b/mjpg-streamer-experimental/CMakeLists.txt +@@ -92,6 +92,7 @@ set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + add_executable(mjpg_streamer mjpg_streamer.c + utils.c) + ++set_property(TARGET mjpg_streamer PROPERTY ENABLE_EXPORTS ON) + target_link_libraries(mjpg_streamer pthread dl) + install(TARGETS mjpg_streamer DESTINATION bin) + + diff --git a/pkgs/by-name/mj/mjpg-streamer/package.nix b/pkgs/by-name/mj/mjpg-streamer/package.nix index d94775bf61dc..34f28d7bbaf0 100644 --- a/pkgs/by-name/mj/mjpg-streamer/package.nix +++ b/pkgs/by-name/mj/mjpg-streamer/package.nix @@ -17,14 +17,23 @@ stdenv.mkDerivation { sha256 = "1cl159svfs1zzzrd3zgn4x7qy6751bvlnxfwf5hn5fmg4iszajw7"; }; + patches = [ + # https://patchwork.ozlabs.org/project/buildroot/patch/20240808192126.1767471-1-bernd@kuhls.net/#3373402 + # https://github.com/jacksonliam/mjpg-streamer/pull/401 + ./fix-undefined-symbol-error.patch + ]; + prePatch = '' - cd mjpg-streamer-experimental - substituteInPlace ./CMakeLists.txt --replace-fail "cmake_minimum_required(VERSION 2.8.3)" "cmake_minimum_required(VERSION 2.8.3...3.10)" + substituteInPlace ./mjpg-streamer-experimental/CMakeLists.txt --replace-fail "cmake_minimum_required(VERSION 2.8.3)" "cmake_minimum_required(VERSION 2.8.3...3.10)" ''; nativeBuildInputs = [ cmake ]; buildInputs = [ libjpeg ]; + preConfigure = '' + cd mjpg-streamer-experimental + ''; + postFixup = '' patchelf --set-rpath "$(patchelf --print-rpath $out/bin/mjpg_streamer):$out/lib/mjpg-streamer" $out/bin/mjpg_streamer '';