ros1_bridge: ros1_bridge fails to build from source
Bug report
Required Info:
- Operating System:
- Ubuntu 18.04
- Installation type:
ros1_bridgefrom source. ROS Melodic and ROS2 Crystal by deb
- Version or commit hash:
961ddee6b76bcb670ce3cb939d125044de820102
- DDS implementation:
- Fast-RTPS
Steps to reproduce issue
- Clone https://github.com/PX4/px4_ros_com
masterbranch to a ROS2 workspace; - Clone https://github.com/PX4/px4_msgs
masterbranch to the same ROS2 workspace; - Clone https://github.com/PX4/px4_ros_com
ros1to a ROS1 workspace; - Clone https://github.com/PX4/px4_msgs
ros1branch to the same ROS1 workspace; - Build both workspaces using
colcon; - Clone the
ros1_bridgeto the ROS2 workspace; - Issue the following commands before building the
ros1_bridge, by the same order:
unset ROS_DISTRO
source /opt/ros/melodic/setup.bash
source /opt/ros/crystal/setup.bash # or local_setup.bash
# source the ROS workspaces
source <ros1_ws_dir>/install/setup.bash
source <ros2_ws_dir>/install/local_setup.bash
- Build the
ros1_bridgeusingcolcon build --symlink-install --packages-select ros1_bridge --cmake-force-configure.
Expected behavior
It’s expected that the ros1_bridge builds successfully. A notice that the above works when using the ROS2 Bouncy release.
Actual behavior
Output from the console:
ROS_DISTRO was set to 'melodic' before. Please make sure that the environment does not mix paths from different distributions.
Starting >>> ros1_bridge
-- Found rmw: 0.6.1 (/opt/ros/crystal/share/rmw/cmake)
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Override CMake install command with custom implementation using symlinks instead of copying resources
-- Found rosidl_adapter: 0.6.2 (/opt/ros/crystal/share/rosidl_adapter/cmake)
-- Found rclcpp: 0.6.2 (/opt/ros/crystal/share/rclcpp/cmake)
-- Found rmw_implementation_cmake: 0.6.1 (/opt/ros/crystal/share/rmw_implementation_cmake/cmake)
-- Found ament_lint_auto: 0.6.3 (/opt/ros/crystal/share/ament_lint_auto/cmake)
-- Added test 'copyright' to check for copyright in CMake / C / C++ / Python code
-- Added test 'cppcheck' to perform static code analysis on C / C++ code
-- Added test 'cpplint' to check C / C++ code against the Google style
-- Added test 'flake8' to check Python code syntax and style conventions
-- Added test 'lint_cmake' to check CMake code style
-- Added test 'pep257' to check Python code against some of the style conventions in PEP 257
-- Added test 'uncrustify' to check C / C++ code style
-- Added test 'xmllint' to check XML markup files
-- Found px4_msgs: 0.1.0 (/home/nuno/PX4/px4_ros_com_ros2/install/px4_msgs/share/px4_msgs/cmake)
-- Found action_msgs: 0.6.2 (/opt/ros/crystal/share/action_msgs/cmake)
-- Using CATKIN_DEVEL_PREFIX: /home/nuno/PX4/px4_ros_com_ros2/build/ros1_bridge/devel
-- Using CMAKE_PREFIX_PATH: /home/nuno/PX4/px4_ros_com_ros2/install/px4_msgs;/home/nuno/PX4/px4_ros_com_ros2/install/px4_ros_com;/home/nuno/PX4/px4_ros_com_ros1/install/px4_ros_com;/home/nuno/PX4/px4_ros_com_ros1/install/px4_msgs;/opt/ros/melodic;/opt/ros/crystal
-- This workspace overlays: /home/nuno/PX4/px4_ros_com_ros1/install/px4_ros_com;/home/nuno/PX4/px4_ros_com_ros1/install/px4_msgs;/opt/ros/melodic
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/nuno/PX4/px4_ros_com_ros2/build/ros1_bridge/test_results
-- Found gtest: gtests will be built
-- Using Python nosetests: /usr/bin/nosetests3
-- catkin 0.7.14
Traceback (most recent call last):
File "/home/nuno/PX4/px4_ros_com_ros2/build/ros1_bridge/catkin_generated/generate_cached_setup.py", line 22, in <module>
code = generate_environment_script('/home/nuno/PX4/px4_ros_com_ros2/build/ros1_bridge/devel/env.sh')
File "/opt/ros/melodic/lib/python2.7/dist-packages/catkin/environment_cache.py", line 62, in generate_environment_script
env_after = ast.literal_eval(output.decode('utf8'))
File "/usr/lib/python3.6/ast.py", line 48, in literal_eval
node_or_string = parse(node_or_string, mode='eval')
File "/usr/lib/python3.6/ast.py", line 35, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
File "<unknown>", line 1
ROS_DISTRO was set to 'crystal' before. Please make sure that the environment does not mix paths from different distributions.
^
SyntaxError: invalid syntax
CMake Error at /opt/ros/melodic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
execute_process(/usr/bin/python3
"/home/nuno/PX4/px4_ros_com_ros2/build/ros1_bridge/catkin_generated/generate_cached_setup.py")
returned error code 1
Call Stack (most recent call first):
/opt/ros/melodic/share/catkin/cmake/all.cmake:198 (safe_execute_process)
/opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:20 (include)
/opt/ros/melodic/share/genmsg/cmake/genmsg-extras.cmake:12 (find_package)
/opt/ros/melodic/share/genmsg/cmake/genmsgConfig.cmake:197 (include)
/opt/ros/melodic/share/actionlib_msgs/cmake/actionlib_msgs-extras.cmake:2 (find_package)
/opt/ros/melodic/share/actionlib_msgs/cmake/actionlib_msgsConfig.cmake:197 (include)
CMakeLists.txt:81 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/nuno/PX4/px4_ros_com_ros2/build/ros1_bridge/CMakeFiles/CMakeOutput.log".
See also "/home/nuno/PX4/px4_ros_com_ros2/build/ros1_bridge/CMakeFiles/CMakeError.log".
--- stderr: ros1_bridge
Traceback (most recent call last):
File "/home/nuno/PX4/px4_ros_com_ros2/build/ros1_bridge/catkin_generated/generate_cached_setup.py", line 22, in <module>
code = generate_environment_script('/home/nuno/PX4/px4_ros_com_ros2/build/ros1_bridge/devel/env.sh')
File "/opt/ros/melodic/lib/python2.7/dist-packages/catkin/environment_cache.py", line 62, in generate_environment_script
env_after = ast.literal_eval(output.decode('utf8'))
File "/usr/lib/python3.6/ast.py", line 48, in literal_eval
node_or_string = parse(node_or_string, mode='eval')
File "/usr/lib/python3.6/ast.py", line 35, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
File "<unknown>", line 1
ROS_DISTRO was set to 'crystal' before. Please make sure that the environment does not mix paths from different distributions.
^
SyntaxError: invalid syntax
CMake Error at /opt/ros/melodic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
execute_process(/usr/bin/python3
"/home/nuno/PX4/px4_ros_com_ros2/build/ros1_bridge/catkin_generated/generate_cached_setup.py")
returned error code 1
Call Stack (most recent call first):
/opt/ros/melodic/share/catkin/cmake/all.cmake:198 (safe_execute_process)
/opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:20 (include)
/opt/ros/melodic/share/genmsg/cmake/genmsg-extras.cmake:12 (find_package)
/opt/ros/melodic/share/genmsg/cmake/genmsgConfig.cmake:197 (include)
/opt/ros/melodic/share/actionlib_msgs/cmake/actionlib_msgs-extras.cmake:2 (find_package)
/opt/ros/melodic/share/actionlib_msgs/cmake/actionlib_msgsConfig.cmake:197 (include)
CMakeLists.txt:81 (find_package)
---
Failed <<< ros1_bridge [ Exited with code 1 ]
Summary: 0 packages finished [1.09s]
1 package failed: ros1_bridge
1 package had stderr output: ros1_bridge
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 49 (18 by maintainers)
The error message sounds like your environment is setup incorrectly. Please follow the standard steps to build the
ros1_bridgeand avoid reusing terminal between the builds / workspaces. Also avoid sourcing multiple setup files as described above.Out of my head I would suggest:
source /opt/ros/melodic/setup.bash<ros1_ws_dir>source /opt/ros/crystal/setup.bash # or local_setup.bash<ros2_ws_dir>source <ros1_ws_dir>/install/setup.bashsource <ros2_ws_dir>/install/setup.bash/opt/ros/crystal<ros1_bridge>