1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Windows上のROS 2でcolcon buildが失敗するのにエラーメッセージが出てこない場合

Last updated at Posted at 2021-09-04

Windows上(WSLではないです)でROS 2のcolcon buildをしようとしたのですがビルドが通りませんでした.
それだけではなく,直接的なエラーメッセージが出力されず,対処できませんでした.
これに対する対処法を備忘録かねて書きます.

環境

記事執筆時の環境です.

  • Windows 11
  • ROS 2 foxy

対処法

以下のQ&Aに対処法があります.
ROS2 colcon build on windows no error message shown when it failed - ROS Answers

以下のように記載されています.

Unfortunately the Visual Studio compiler outputs error messages to stdout instead of stderr. By default colcon build hides the stdout output and only shows stderr output.

すなわち,ビルドを行うVSのコンパイラがstdoutにエラーメッセージを出す一方,colconstdoutを出力しないため,エラーメッセージが見えない状態になっているようです.

これは,colcon build時に次のようにオプションをつけてやると解決します.

colcon build --event-handlers console_cohesion+

なお,このままだと日本語が出力された際にPythonの文字コードエラーが出てしまうので,以下のコマンドでコンソールの文字コードを変更する

chcp 65001

か,PowerShell起動時に文字コードがUTF-8になるよう変更を加えてやる必要があります.

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?