From a8a9a8312df3ef3f29ef26215b4d2f35bb1fafb6 Mon Sep 17 00:00:00 2001 From: BrianLakstins <2887390+BrianLakstins@users.noreply.github.com> Date: Tue, 11 Nov 2025 09:16:25 -0500 Subject: [PATCH 1/5] Update Docker Container used for dev with needed versions of libraries --- .devcontainer/Dockerfile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 15b241c1..b1ed0fd8 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,15 +1,18 @@ -FROM ubuntu:22.04 +FROM ubuntu:24.04 # Avoid interactive prompts during package install ENV DEBIAN_FRONTEND=noninteractive +# Install Node.js 20.x from NodeSource repository (required for selenium-webdriver and other packages) +RUN apt-get update && apt-get install -y curl ca-certificates gnupg \ + && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ + && apt-get install -y nodejs + # Install required packages RUN apt-get update && apt-get install -y \ build-essential \ cmake \ libsqlite3-dev \ - nodejs \ - npm \ pkg-config \ libavcodec-dev \ libavformat-dev \ @@ -20,6 +23,8 @@ RUN apt-get update && apt-get install -y \ libcjson-dev \ libwolfssl-dev \ libssl-dev \ + file \ + systemd \ && apt-get clean # Create a non-root user for VS Code From 88a3e0b400bf6572220f84f4b0307f7c7fea15c1 Mon Sep 17 00:00:00 2001 From: BrianLakstins <2887390+BrianLakstins@users.noreply.github.com> Date: Tue, 11 Nov 2025 09:17:48 -0500 Subject: [PATCH 2/5] Run devcontainer as root and add volumes for build folders so they will be more Linux when the folders are actually on Windows --- .devcontainer/devcontainer.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b470b8ed..33af14f4 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -12,5 +12,10 @@ ], "forwardPorts": [], "postCreateCommand": "npm install", - "remoteUser": "vscode" + "remoteUser": "root", + "mounts": [ + "source=${localWorkspaceFolderBasename}-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume", + "source=${localWorkspaceFolderBasename}-web-node_modules,target=${containerWorkspaceFolder}/web/node_modules,type=volume", + "source=${localWorkspaceFolderBasename}-build,target=${containerWorkspaceFolder}/build,type=volume" + ] } \ No newline at end of file From 7edd099570ce61fd489a57cbfaaa69b05ad41b9c Mon Sep 17 00:00:00 2001 From: BrianLakstins <2887390+BrianLakstins@users.noreply.github.com> Date: Tue, 11 Nov 2025 09:18:14 -0500 Subject: [PATCH 3/5] Ignore the root node_modules folder --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 30ea8f3e..836466d8 100644 --- a/.gitignore +++ b/.gitignore @@ -86,6 +86,7 @@ Makefile /external # node modules +node_modules/ web/node_modules/ # Web build artifacts (built during CI/CD, not checked in) From 30a86dd219e25b50b0baa521170a5dd7b9d23d43 Mon Sep 17 00:00:00 2001 From: BrianLakstins <2887390+BrianLakstins@users.noreply.github.com> Date: Tue, 11 Nov 2025 09:45:21 -0500 Subject: [PATCH 4/5] Update references to libcjson-dev libraries and cJSON.h file so they are not external to the github folder. --- CMakeLists.txt | 27 ++++++++++++++----- include/storage/storage_manager_streams.h | 2 +- .../storage/storage_manager_streams_cache.h | 2 +- src/core/logger_json.c | 2 +- src/storage/storage_manager_streams.c | 2 +- src/storage/storage_manager_streams_cache.c | 2 +- src/video/go2rtc/go2rtc_api.c | 2 +- tests/CMakeLists.txt | 6 +++++ 8 files changed, 32 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5913e14f..5cb7c2b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,13 +150,26 @@ else() endif() # Find cJSON -find_package(cJSON QUIET) -if(NOT cJSON_FOUND) - # If not found via find_package, try pkg-config - pkg_check_modules(CJSON cjson) - if(NOT CJSON_FOUND) - message(STATUS "cJSON not found via find_package or pkg-config, will use bundled version") - set(CJSON_BUNDLED TRUE) +pkg_check_modules(CJSON QUIET libcjson) +if(CJSON_FOUND) + # Use pkg-config result (CJSON_LIBRARIES is automatically set) + message(STATUS "Found cJSON via pkg-config: ${CJSON_LIBRARIES}") +else() + # Try alternative pkg-config name + pkg_check_modules(CJSON QUIET cjson) + if(CJSON_FOUND) + message(STATUS "Found cJSON via pkg-config (alternative): ${CJSON_LIBRARIES}") + else() + # Try find_package as last resort + find_package(cJSON QUIET) + if(cJSON_FOUND) + set(CJSON_LIBRARIES cjson) + set(CJSON_FOUND TRUE) # Set this for consistency + message(STATUS "Found cJSON via find_package") + else() + message(STATUS "cJSON not found via pkg-config or find_package, will use bundled version") + set(CJSON_BUNDLED TRUE) + endif() endif() endif() diff --git a/include/storage/storage_manager_streams.h b/include/storage/storage_manager_streams.h index 9e631275..09e8dda7 100644 --- a/include/storage/storage_manager_streams.h +++ b/include/storage/storage_manager_streams.h @@ -6,7 +6,7 @@ #ifndef LIGHTNVR_STORAGE_MANAGER_STREAMS_H #define LIGHTNVR_STORAGE_MANAGER_STREAMS_H -#include "../../external/cjson/cJSON.h" +#include /** * Stream storage usage information diff --git a/include/storage/storage_manager_streams_cache.h b/include/storage/storage_manager_streams_cache.h index eda158aa..0826cbc0 100644 --- a/include/storage/storage_manager_streams_cache.h +++ b/include/storage/storage_manager_streams_cache.h @@ -8,7 +8,7 @@ #include #include "storage/storage_manager_streams.h" -#include "../../external/cjson/cJSON.h" +#include /** * Initialize the storage manager streams cache diff --git a/src/core/logger_json.c b/src/core/logger_json.c index 150ea668..504b9891 100644 --- a/src/core/logger_json.c +++ b/src/core/logger_json.c @@ -11,7 +11,7 @@ #include "core/logger.h" #include "core/logger_json.h" -#include "../external/cjson/cJSON.h" +#include // JSON logger state static struct { diff --git a/src/storage/storage_manager_streams.c b/src/storage/storage_manager_streams.c index d1b299ec..22a7c0dc 100644 --- a/src/storage/storage_manager_streams.c +++ b/src/storage/storage_manager_streams.c @@ -16,7 +16,7 @@ #include "storage/storage_manager_streams.h" #include "core/logger.h" #include "core/config.h" -#include "../../external/cjson/cJSON.h" +#include /** * Get storage usage per stream diff --git a/src/storage/storage_manager_streams_cache.c b/src/storage/storage_manager_streams_cache.c index 21db697b..2790bad6 100644 --- a/src/storage/storage_manager_streams_cache.c +++ b/src/storage/storage_manager_streams_cache.c @@ -16,7 +16,7 @@ #include "storage/storage_manager.h" #include "core/logger.h" #include "core/config.h" -#include "../../external/cjson/cJSON.h" +#include // Forward declarations for functions from storage_manager_streams.c extern int get_stream_storage_usage(const char *storage_path, stream_storage_info_t *stream_info, int max_streams); diff --git a/src/video/go2rtc/go2rtc_api.c b/src/video/go2rtc/go2rtc_api.c index 4de8372c..460ba687 100644 --- a/src/video/go2rtc/go2rtc_api.c +++ b/src/video/go2rtc/go2rtc_api.c @@ -17,7 +17,7 @@ #include #include #include -#include "../../external/cjson/cJSON.h" +#include // API client configuration static char *g_api_host = NULL; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e07be9ee..54bbf5ff 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -56,6 +56,8 @@ if(ENABLE_SOD) ) if(CJSON_BUNDLED) target_link_libraries(test_sod_unified cjson_lib) + elseif(CJSON_FOUND) + target_link_libraries(test_sod_unified ${CJSON_LIBRARIES}) endif() target_link_libraries(test_sod_voc @@ -74,6 +76,8 @@ if(ENABLE_SOD) ) if(CJSON_BUNDLED) target_link_libraries(test_sod_voc cjson_lib) + elseif(CJSON_FOUND) + target_link_libraries(test_sod_voc ${CJSON_LIBRARIES}) endif() # Set output directory for test binaries @@ -136,6 +140,8 @@ target_link_libraries(test_stream_detection ) if(CJSON_BUNDLED) target_link_libraries(test_stream_detection cjson_lib) +elseif(CJSON_FOUND) + target_link_libraries(test_stream_detection ${CJSON_LIBRARIES}) endif() if(ENABLE_SOD) From 03e10513fb0cd371aff4661fcc8909c7688d9bad Mon Sep 17 00:00:00 2001 From: BrianLakstins <2887390+BrianLakstins@users.noreply.github.com> Date: Tue, 11 Nov 2025 09:53:35 -0500 Subject: [PATCH 5/5] Remove volume mounts because running as root user seems to have fixed any permission issues --- .devcontainer/devcontainer.json | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 33af14f4..594f3e1d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -12,10 +12,5 @@ ], "forwardPorts": [], "postCreateCommand": "npm install", - "remoteUser": "root", - "mounts": [ - "source=${localWorkspaceFolderBasename}-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume", - "source=${localWorkspaceFolderBasename}-web-node_modules,target=${containerWorkspaceFolder}/web/node_modules,type=volume", - "source=${localWorkspaceFolderBasename}-build,target=${containerWorkspaceFolder}/build,type=volume" - ] + "remoteUser": "root" } \ No newline at end of file