From 03c32c66f6ac6d670ca12bbf7a871df40a0ecea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Math=C3=A9o=20Taillandier?= <123255318+Matheo-13@users.noreply.github.com> Date: Fri, 2 Oct 2026 19:51:26 +0200 Subject: [PATCH] fix(build): move gz_env.sh out of rootfs (#28977) --- ROMFS/px4fmu_common/init.d-posix/px4-rc.gzsim | 13 +++++++------ docs/en/sim_gazebo_gz/index.md | 2 +- src/modules/simulation/gz_bridge/CMakeLists.txt | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ROMFS/px4fmu_common/init.d-posix/px4-rc.gzsim b/ROMFS/px4fmu_common/init.d-posix/px4-rc.gzsim index 25123f767e1..f133bc25bdc 100644 --- a/ROMFS/px4fmu_common/init.d-posix/px4-rc.gzsim +++ b/ROMFS/px4fmu_common/init.d-posix/px4-rc.gzsim @@ -3,12 +3,13 @@ # Setup gz environment variables. This comes first because on macOS it # also puts the gz from Tools/setup/macos/pixi.toml on PATH. -if [ -f ./gz_env.sh ]; then - . ./gz_env.sh - -elif [ -f ../gz_env.sh ]; then - . ../gz_env.sh -fi + if [ -f ./gz_env.sh ]; then + . ./gz_env.sh + elif [ -f ../gz_env.sh ]; then + . ../gz_env.sh + elif [ -f ../../gz_env.sh ]; then + . ../../gz_env.sh + fi # Enforce minimum gz version as Harmonic (gz-sim8) MIN_GZ_VERSION="8.0.0" diff --git a/docs/en/sim_gazebo_gz/index.md b/docs/en/sim_gazebo_gz/index.md index a4b00d883d1..a3f5aabc90b 100644 --- a/docs/en/sim_gazebo_gz/index.md +++ b/docs/en/sim_gazebo_gz/index.md @@ -357,7 +357,7 @@ See [Simulation > Environment Configuration](../simulation/index.md#environment- The PX4 Gazebo worlds and models databases [can be found on GitHub here](https://github.com/PX4/PX4-gazebo-models). ::: info -`gz_env.sh.in` is compiled and made available in `$PX4_DIR/build/px4_sitl_default/rootfs/gz_env.sh` +`gz_env.sh.in` is compiled and made available in `$PX4_DIR/build/px4_sitl_default/gz_env.sh` ::: ### Examples diff --git a/src/modules/simulation/gz_bridge/CMakeLists.txt b/src/modules/simulation/gz_bridge/CMakeLists.txt index d96a39bc668..3daa074b2a4 100644 --- a/src/modules/simulation/gz_bridge/CMakeLists.txt +++ b/src/modules/simulation/gz_bridge/CMakeLists.txt @@ -140,7 +140,7 @@ if (gz-transport_FOUND) # Setup the environment variables: PX4_GZ_MODELS, PX4_GZ_WORLDS, GZ_SIM_RESOURCE_PATH # @ONLY disables ${VAR} substitution so that shell $VAR references in the # template are passed through untouched. - configure_file(gz_env.sh.in ${PX4_BINARY_DIR}/rootfs/gz_env.sh @ONLY) + configure_file(gz_env.sh.in ${PX4_BINARY_DIR}/gz_env.sh @ONLY) else() # Fallback targets with helpful error messages when Gazebo deps are missing.