From e8c3e0f8c28eb395e39fcb1e4aaa850d3869565f Mon Sep 17 00:00:00 2001 From: Russell Gilbert Date: Tue, 17 Feb 2026 17:13:16 +0000 Subject: [PATCH] Updates RobotNode build and deployment process. Simplifies the RobotNode build process by linking directly to system gpiod libraries instead of including a local copy. This reduces redundancy and ensures compatibility with the system's gpiod installation. Adds a deployment script for easier deployment to the robot, streamlining the update process. Also introduces a script to automatically fix symlinks during cross-compilation, ensuring that links resolve correctly on the target system. --- src/RobotNode/CMakeLists.txt | 11 ++++++++--- src/RobotNode/version.txt | 2 +- utils/deploy_dixon | 22 ++++++++++++++++++++++ utils/fix_links.py | 23 +++++++++++++++++++++++ 4 files changed, 54 insertions(+), 4 deletions(-) create mode 100755 utils/deploy_dixon create mode 100644 utils/fix_links.py diff --git a/src/RobotNode/CMakeLists.txt b/src/RobotNode/CMakeLists.txt index 294759f..2362a0c 100644 --- a/src/RobotNode/CMakeLists.txt +++ b/src/RobotNode/CMakeLists.txt @@ -41,13 +41,18 @@ configure_file(Version.h.in "${CMAKE_CURRENT_BINARY_DIR}/Version.h") # Consolidated Include Paths target_include_directories(dixon PRIVATE "${CMAKE_CURRENT_BINARY_DIR}" # For generated Version.h - "${CMAKE_CURRENT_SOURCE_DIR}/extern/libgpiod/include" # For libgpiod headers +# "${CMAKE_CURRENT_SOURCE_DIR}/extern/libgpiod/include" # For libgpiod headers ) +# Link the gpiod libraries +#target_link_libraries(dixon PRIVATE +# "${CMAKE_CURRENT_SOURCE_DIR}/extern/libgpiod/aarch64/libgpiodcxx.so.2" +# "${CMAKE_CURRENT_SOURCE_DIR}/extern/libgpiod/aarch64/libgpiod.so.3") + # Link the gpiod libraries target_link_libraries(dixon PRIVATE - "${CMAKE_CURRENT_SOURCE_DIR}/extern/libgpiod/aarch64/libgpiodcxx.so.2" - "${CMAKE_CURRENT_SOURCE_DIR}/extern/libgpiod/aarch64/libgpiod.so.3") + gpiodcxx + gpiod) # Tell the linker: "Trust me, the Pi has the rest of the C++ and C libraries" target_link_options(dixon PRIVATE "-Wl,--allow-shlib-undefined") \ No newline at end of file diff --git a/src/RobotNode/version.txt b/src/RobotNode/version.txt index 3f11ef6..c1cf2f9 100644 --- a/src/RobotNode/version.txt +++ b/src/RobotNode/version.txt @@ -1 +1 @@ -1.0.27 \ No newline at end of file +1.0.33 \ No newline at end of file diff --git a/utils/deploy_dixon b/utils/deploy_dixon new file mode 100755 index 0000000..0388985 --- /dev/null +++ b/utils/deploy_dixon @@ -0,0 +1,22 @@ +#!/bin/bash + +# Configuration +LOCAL_BIN="$HOME/dev/Dixon/src/RobotNode/cmake-build-pi5-debug/dixon" +REMOTE_TARGET="russellg59@192.168.1.224" +REMOTE_DIR="/home/russellg59/dixon" +REMOTE_EXE="$REMOTE_DIR/dixon" + +# Check if the monster PC actually finished the build +if [ ! -f "$LOCAL_BIN" ]; then + echo "Error: Binary not found at $LOCAL_BIN" + exit 1 +fi + +echo "Cleaning remote path and pushing binary..." + +# Remove the target first to prevent the 'directory' bug, then push and fix permissions +ssh $REMOTE_TARGET "rm -rf $REMOTE_EXE" +scp "$LOCAL_BIN" $REMOTE_TARGET:"$REMOTE_EXE" +ssh $REMOTE_TARGET "chmod +x $REMOTE_EXE" + +echo "Deployment complete: $REMOTE_EXE" diff --git a/utils/fix_links.py b/utils/fix_links.py new file mode 100644 index 0000000..12a6105 --- /dev/null +++ b/utils/fix_links.py @@ -0,0 +1,23 @@ +import os +import sys + +def fix_links(root_dir): + root_dir = os.path.abspath(root_dir) + for root, dirs, files in os.walk(root_dir): + for name in files + dirs: + path = os.path.join(root, name) + if os.path.islink(path): + target = os.readlink(path) + if target.startswith('/'): + # Calculate the relative path from the current folder back to the sysroot + relative_to_sysroot = os.path.relpath(root_dir, root) + new_target = os.path.normpath(os.path.join(relative_to_sysroot, target.lstrip('/'))) + print(f"Fixing: {path} -> {new_target}") + os.unlink(path) + os.symlink(new_target, path) + +if __name__ == "__main__": + if len(sys.argv) < 2: + print("Usage: python3 fix_links.py ") + else: + fix_links(sys.argv[1])