Skip to content

Commit 70879ff

Browse files
authored
Fix for building after sourcing ROS setup script (#63)
* Remove global ROS variables from environment before build Unsets `AMENT_PREFIX_PATH` and removes `/opt/ros/$(ROS_DISTRO)/bin` from `PATH` before building micro_ros_src, in case they've been set by the ROS setup scripts beforehand. * Added note to README about running in a clean shell environment Build can have issues if ROS 2 setup script has been sourced, so made a note of that here.
1 parent 810b55a commit 70879ff

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This component has been tested in ESP-IDF v4.1, v4.2 and v4.3 with ESP32, ESP32-
44

55
## Dependencies
66

7-
This componentes needs `colcon` in order to build micro-ROS packages:
7+
This component needs `colcon` in order to build micro-ROS packages:
88

99
<!-- apt install lsb-release git -->
1010
```bash
@@ -23,7 +23,9 @@ pip3 install catkin_pkg lark-parser empy
2323

2424
## Usage
2525

26-
You can clone this repo directly in the `components` folder of your project
26+
You can clone this repo directly in the `components` folder of your project.
27+
28+
If you encounter issues during the build process, ensure that you are running in a clean shell environment _without_ the ROS 2 setup script sourced.
2729

2830
## Example
2931

libmicroros.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ $(EXTENSIONS_DIR)/micro_ros_src/src:
7575

7676
$(EXTENSIONS_DIR)/micro_ros_src/install: $(EXTENSIONS_DIR)/esp32_toolchain.cmake $(EXTENSIONS_DIR)/micro_ros_dev/install $(EXTENSIONS_DIR)/micro_ros_src/src
7777
cd $(UROS_DIR); \
78+
unset AMENT_PREFIX_PATH; \
79+
PATH=$(subst /opt/ros/$(ROS_DISTRO)/bin,,$(PATH)); \
7880
. ../micro_ros_dev/install/local_setup.sh; \
7981
colcon build \
8082
--merge-install \

0 commit comments

Comments
 (0)