feat: setup_local.sh — reproduce the docker stages natively on the host#6
Merged
Conversation
…he host
Some workshop attendees can't (or don't want to) use Docker — Mac
users without Docker Desktop, hosts with NVIDIA Container Toolkit
issues, restricted environments. Add a setup_local.sh at the repo
root that runs the same sequence of stages the Dockerfile does, on
the host's filesystem, by calling the existing docker/scripts/*.sh
with the right env vars:
1. install_deps.sh (apt: gz-harmonic, ROS 2 packages, build deps)
2. build_opencv.sh (OpenCV 4.10 from source)
3. build_ros_deps.sh (Micro-XRCE-DDS, px4_msgs,
px4-ros2-interface-lib, etc.)
4. build_px4.sh (PX4 v1.16 SITL)
5. install_qgc.sh (QGroundControl v5.0.8 AppImage)
6. colcon build (the workshop workspace)
The docker/scripts/*.sh are parameterised so the same files are used
by both the Dockerfile (default paths /OpenCV, /root/px4_ros_ws,
/home/${USER}) and setup_local.sh ($HOME/-rooted layout):
* install_deps.sh accepts SUDO="" (Docker, default) or SUDO=sudo
(local) so apt commands work in both contexts
* build_opencv.sh OPENCV_BUILD_DIR (default /OpenCV)
* build_ros_deps.sh PX4_ROS_WS (default /root/px4_ros_ws)
* build_px4.sh PX4_BUILD_DIR (default /home/${USER})
* install_qgc.sh QGC_INSTALL_DIR (default /home/${USER})
setup_local.sh detects Ubuntu 22.04/24.04 vs macOS, refuses macOS by
default (ROS 2 Humble + Gazebo Harmonic don't have first-class macOS
support; recommends Docker via OrbStack/Colima/Lima instead), and
supports per-stage --skip-* flags for re-runs.
The first cut of setup_local.sh refused macOS based on a too-strong
claim that ROS 2 + Gazebo Harmonic don't run there. Verified against
REP-2000 and the Gazebo docs, the picture is more nuanced:
* ROS 2 Humble is Tier 3 on macOS (community-supported, source-build
only, supported through May 2027).
* Gazebo Harmonic has official Homebrew binaries via osrf/simulation
for Big Sur / Monterey; macOS 15 has known OGRE build issues.
Rework the macOS branch so the script:
* detects macOS version + arch and prints accurate status info with
upstream links;
* installs Homebrew prereqs and gz-harmonic via the osrf/simulation tap;
* runs the OpenCV-from-source stage (cmake handles macOS fine);
* builds PX4 v1.16 SITL — build_px4.sh now dispatches Tools/setup/
ubuntu.sh on Linux and Tools/setup/macos.sh on Darwin;
* downloads the official QGroundControl-installer.dmg into the prefix
instead of writing a placeholder log;
* skips the ROS 2 deps + workshop-workspace stages with a clear note
pointing to docs.ros.org's macOS source install guide (those are
the only stages that genuinely require a working ROS 2 Humble);
* still recommends the Docker path on macOS for the easy route.
Also makes the in-place PX4 init.d-posix/rcS patch idempotent (the
script can now be re-run without `git apply` failing because the
patch is already applied).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For attendees who can't (or don't want to) use Docker — macOS without Docker Desktop, hosts hitting NVIDIA Container Toolkit / GPU forwarding issues, restricted environments — add a
setup_local.shat the repo root that runs the same stages the Dockerfile does, against the host's filesystem.It calls the existing
docker/scripts/*.shso there is one source of truth for the install logic. The scripts are parameterised so the Dockerfile path is unchanged (defaults match the previous hard-coded values), andsetup_local.shjust sets a few env vars to redirect the artifacts under$HOME:SUDO""(root)sudoOPENCV_BUILD_DIR/OpenCV$HOME/OpenCVPX4_ROS_WS/root/px4_ros_ws$HOME/px4_ros_wsPX4_BUILD_DIR/home/${USER}$HOMEQGC_INSTALL_DIR/home/${USER}$HOMEsetup_local.shsupports--skip-deps / --skip-opencv / --skip-ros-deps / --skip-px4 / --skip-qgc / --skip-wsso it's safe to re-run. The PX4 rcS patch is now idempotent so re-running doesn't fail withpatch already applied.Platform support
Tools/setup/ubuntu.sh+ makebrew tap osrf/simulation && brew install gz-harmonic …+ PX4 brew depsTools/setup/macos.sh+ make (build_px4.shnow dispatches onuname -s)QGroundControl-installer.dmg, mounts it, copies the.appinto the prefix--skip-*after building ROS 2 by handSo on macOS the script does the parts it CAN do (Gazebo Harmonic, OpenCV, PX4 SITL, QGC.app) and is explicit about the parts that need manual follow-up. The macOS section also prints the recommended Docker path (OrbStack / Colima / Lima / Docker Desktop) at the top, which is the fastest route for workshop attendees with a tight schedule.
Verified
bash -non every modified script.ros:humble-ros-basecontainer the new env defaults resolve to the original Dockerfile paths (so the docker image build is unaffected; same artifacts at the same locations) and all scripts parse cleanly.