ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Ros2 windows10 colcon build fails on ros2_example_ws tutorial [closed]

asked 2019-03-04 15:03:40 -0500

JamesSpider gravatar image

I am trying to follow the tutorials for working with ROS 2 Crystal. I completed instructions for installing ROS 2 Crystal on a windows 10 machine using the instructions here The installation appeared to be ok as the talker and listener functioned correctly.

I then followed these instructions but colcon build failed in building the workspace (output below).

I sourced using call C:\dev\ros2-windows\local_setup.bat

before running colcon build --symlink-install

I'm not sure what's going wrong. I'm a beginner and would appreciate some pointers in the right direction. Thanks

Starting >>> examples_rclcpp_minimal_action_client
Starting >>> examples_rclcpp_minimal_action_server
Starting >>> examples_rclcpp_minimal_client
Starting >>> examples_rclcpp_minimal_composition
--- stderr: examples_rclcpp_minimal_action_client
Traceback (most recent call last):
  File "c:\python37\lib\site-packages\colcon_core\executor\__init__.py", line 91, in __call__
    rc = await self.task(*args, **kwargs)
  File "c:\python37\lib\site-packages\colcon_core\task\__init__.py", line 92, in __call__
    return await task_method(*args, **kwargs)
  File "c:\python37\lib\site-packages\colcon_ros\task\ament_cmake\build.py", line 72, in build
    additional_hooks=additional_hooks)
  File "c:\python37\lib\site-packages\colcon_cmake\task\cmake\build.py", line 85, in build
    rc = await self._reconfigure(args, env)
  File "c:\python37\lib\site-packages\colcon_cmake\task\cmake\build.py", line 151, in _reconfigure
    'VisualStudioVersion is not set, '
RuntimeError: VisualStudioVersion is not set, please run within a Visual Studio Command Prompt.
---
Failed   <<< examples_rclcpp_minimal_action_client      [ Exited with code 1 ]
--- stderr: examples_rclcpp_minimal_action_server
Traceback (most recent call last):
  File "c:\python37\lib\site-packages\colcon_core\executor\__init__.py", line 91, in __call__
    rc = await self.task(*args, **kwargs)
  File "c:\python37\lib\site-packages\colcon_core\task\__init__.py", line 92, in __call__
    return await task_method(*args, **kwargs)
  File "c:\python37\lib\site-packages\colcon_ros\task\ament_cmake\build.py", line 72, in build
    additional_hooks=additional_hooks)
  File "c:\python37\lib\site-packages\colcon_cmake\task\cmake\build.py", line 85, in build
    rc = await self._reconfigure(args, env)
  File "c:\python37\lib\site-packages\colcon_cmake\task\cmake\build.py", line 151, in _reconfigure
    'VisualStudioVersion is not set, '
RuntimeError: VisualStudioVersion is not set, please run within a Visual Studio Command Prompt.
---
Failed   <<< examples_rclcpp_minimal_action_server      [ Exited with code 1 ]
--- stderr: examples_rclcpp_minimal_client
Traceback (most recent call last):
  File "c:\python37\lib\site-packages\colcon_core\executor\__init__.py", line 91, in __call__
    rc = await self.task(*args, **kwargs)
  File "c:\python37\lib\site-packages\colcon_core\task\__init__.py", line 92, in __call__
    return await task_method(*args, **kwargs)
  File "c:\python37\lib\site-packages\colcon_ros\task\ament_cmake\build.py", line 72, in build
    additional_hooks=additional_hooks)
  File "c:\python37\lib\site-packages\colcon_cmake\task\cmake\build.py", line 85, in build
    rc = await self._reconfigure(args, env)
  File "c:\python37\lib\site-packages\colcon_cmake\task\cmake\build.py", line 151, in _reconfigure
    'VisualStudioVersion is not set, '
RuntimeError: VisualStudioVersion is not set, please run within a Visual Studio Command Prompt.
---
Failed   <<< examples_rclcpp_minimal_client     [ Exited with code 1 ]
Aborted  <<< examples_rclcpp_minimal_composition

Summary: 0 packages finished [2.75s]
  3 packages failed: examples_rclcpp_minimal_action_client examples_rclcpp_minimal_action_server examples_rclcpp_minimal_client
  1 package aborted: examples_rclcpp_minimal_composition
  3 packages had stderr output: examples_rclcpp_minimal_action_client examples_rclcpp_minimal_action_server examples_rclcpp_minimal_client
  9 packages not processed
VisualStudioVersion is not set, please run within a Visual Studio Command Prompt.e
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by JamesSpider
close date 2019-04-07 11:51:15.098830

1 Answer

Sort by » oldest newest most voted
1

answered 2019-04-02 16:40:33 -0500

marguedas gravatar image

On Windows, to use Visual Studio from the command-line you need to be in a "visual studio environment".

To do so you can either:

  • open the visual studio prompt by hitting the windows key and then search for native, it should offer you an application named something like x64 Native Tools Command Prompt for VS 2017

or:

  • open a regular cmd window, and setup the environment by running:

    call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
    

Note that the exact path of the files or name of the application can be different on your computer.

edit flag offensive delete link more

Comments

1

Thanks Marguedas. That's really useful.

An alternative approach appears to be to set up Visual Studio Command prompt as an external tool in Visual Studio ( see "Run the command prompt from inside Visual Studio" in this link link text ) - then running Visual Studio as administrator [ I achieved this by right clicking on the Visual Studio icon on my taskbar, then right clicking on Visual Studio in the popup menu, then clicking on "run as administrator" in the next popup menu, - then running the Visual Studio command prompt ( under the visual studio tools menu). The workspace built fine for me when I did that.

JamesSpider gravatar image JamesSpider  ( 2019-04-07 11:50:06 -0500 )edit

for anyone else who ends up here....there is a visual studio code extension that works on windows now: https://marketplace.visualstudio.com/...

flynneva gravatar image flynneva  ( 2021-04-12 11:13:23 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-03-04 15:03:40 -0500

Seen: 4,535 times

Last updated: Apr 02 '19