rosgenmsg can find CMake in R2021a but not in R2021b

8 views (last 30 days)
Hello,
This week I tried to install the stable version of MATLAB R2021b in windows, but found that rosgenmsg could not find CMake. But there is no problem in ubuntu system.
>> !where cmake
C:\Program Files\CMake\bin\cmake.exe
>> !cmake --version
cmake version 3.21.3
CMake suite maintained and supported by Kitware (kitware.com/cmake).
>> folderpath = "C:\Users\xinxi\Documents\MATLAB\***"
folderpath =
"C:\Users\xinxi\Documents\MATLAB\***"
>> rosgenmsg(folderpath)
Identifying message files in folder 'C:/Users/xinxi/Documents/MATLAB/***'..Done.
Validating message files in folder 'C:/Users/xinxi/Documents/MATLAB/***'..Done.
[0/2] Generating MATLAB interfaces for custom message packages... 0%Error using ros.internal.utilities.getCMakeBinaryPath (line 24)
Could not find CMake in your system. Please install CMake version 3.15.5 or higher and rerun the
command.
Error in ros.internal.CatkinBuilder.getCMakePath (line 83)
[aPath, aVersion] = ros.internal.utilities.getCMakeBinaryPath(ros.internal.CatkinBuilder.CMAKEMINVERSION);
Error in ros.internal.ROSProjectBuilder (line 408)
h.CMakePath = h.getCMakePath();
Error in ros.internal.CatkinBuilder (line 25)
h@ros.internal.ROSProjectBuilder(varargin{:});
Error in rosgenmsg (line 287)
builder = ros.internal.CatkinBuilder(genDir, pkgInfos{iPkg});
My computer also has MATLAB R2021a installed. I tried to run rosgenmsg but without any errors. I have before also used the preview version of R2021b, and there was no problem.
  2 Comments
Walter Roberson
Walter Roberson on 28 Sep 2021
Which CMake version do you have installed on the Windows machine? And did you add it to you Windows PATH environment variables, and add CMAKE_PREFIX_PATH to your environment variables ?
Xin Xing
Xin Xing on 28 Sep 2021
I have written in the description. I have latest CMake version 3.21.3 installed and added it to environment variables. And MATLAB can find CMake through !where cmake und !cmake --version.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 29 Sep 2021
I looked at the code for ros.internal.utilities.getCMakeBinaryPath() . It looks to me as if it cannot work on MS Windows. I have reported the problem to Mathworks.
  7 Comments
tfg
tfg on 11 Nov 2021
Edited: tfg on 11 Nov 2021
this workaround does not work for me.
After installing msys and configuring PATH as described, the initial error is gone, and cmake can be found.
colcon however fails to build.
Below is my output when running the official example 'ROS2CustomMessagesExample.mlx' for MATLAB R2021b on Windows 10.
Any thoughts on this?
I have to admit, that I am rather disappointed, that rather simple and once running features of the toolbox are broken with a new release and that seemingly nobody even tested this on all platforms before the release.
Identifying message files in folder 'C:/Users/GLT2ABT/Documents/MATLAB/Examples/R2021b/ros/ROS2CustomMessagesExample/custom'.Done.
Validating message files in folder 'C:/Users/GLT2ABT/Documents/MATLAB/Examples/R2021b/ros/ROS2CustomMessagesExample/custom'.Done.
[3/3] Generating MATLAB interfaces for custom message packages... Done.
Running colcon build in folder 'C:/Users/GLT2ABT/Documents/MATLAB/Examples/R2021b/ros/ROS2CustomMessagesExample/custom/matlab_msg_gen/win64'.
Build in progress. This may take several minutes...
Error using ros.internal.ROSProjectBuilder/buildPackage (line 552)
Error building package: **********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.38
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86_x64'
colcon.colcon_core.entry_point ERROR Exception loading extension 'colcon_core.environment_variable.powershell_command': No module named 'colcon_core.shell.template'
Traceback (most recent call last):
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\entry_point.py", line 98, in load_entry_points
extension_type = load_entry_point(entry_point)
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\entry_point.py", line 140, in load_entry_point
return entry_point.load()
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\pkg_resources\__init__.py", line 2434, in load
return self.resolve()
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\pkg_resources\__init__.py", line 2440, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_powershell\shell\powershell.py", line 17, in
from colcon_core.shell.template import expand_template
ModuleNotFoundError: No module named 'colcon_core.shell.template'
[1.523s] colcon.colcon_core.entry_point ERROR Exception loading extension 'colcon_core.shell.powershell': No module named 'colcon_core.shell.template'
Traceback (most recent call last):
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\entry_point.py", line 98, in load_entry_points
extension_type = load_entry_point(entry_point)
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\entry_point.py", line 140, in load_entry_point
return entry_point.load()
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\pkg_resources\__init__.py", line 2434, in load
return self.resolve()
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\pkg_resources\__init__.py", line 2440, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_powershell\shell\powershell.py", line 17, in
from colcon_core.shell.template import expand_template
ModuleNotFoundError: No module named 'colcon_core.shell.template'
Starting >>> example_b_msgs
[1.526s] colcon.colcon_core.entry_point ERROR Exception loading extension 'colcon_core.shell.bat': No module named 'colcon_core.shell.template'
Traceback (most recent call last):
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\entry_point.py", line 98, in load_entry_points
extension_type = load_entry_point(entry_point)
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\entry_point.py", line 140, in load_entry_point
return entry_point.load()
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\pkg_resources\__init__.py", line 2434, in load
return self.resolve()
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\pkg_resources\__init__.py", line 2440, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\shell\bat.py", line 16, in
from colcon_core.shell.template import expand_template
ModuleNotFoundError: No module named 'colcon_core.shell.template'
[1.530s] colcon.colcon_core.entry_point ERROR Exception loading extension 'colcon_core.shell.sh': No module named 'colcon_core.shell.template'
Traceback (most recent call last):
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\entry_point.py", line 98, in load_entry_points
extension_type = load_entry_point(entry_point)
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\entry_point.py", line 140, in load_entry_point
return entry_point.load()
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\pkg_resources\__init__.py", line 2434, in load
return self.resolve()
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\pkg_resources\__init__.py", line 2440, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\shell\sh.py", line 16, in
from colcon_core.shell.template import expand_template
ModuleNotFoundError: No module named 'colcon_core.shell.template'
[1.535s] colcon.colcon_core.entry_point ERROR Exception loading extension 'colcon_core.shell.powershell': No module named 'colcon_core.shell.template'
Traceback (most recent call last):
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\entry_point.py", line 98, in load_entry_points
extension_type = load_entry_point(entry_point)
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\entry_point.py", line 140, in load_entry_point
return entry_point.load()
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\pkg_resources\__init__.py", line 2434, in load
return self.resolve()
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\pkg_resources\__init__.py", line 2440, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_powershell\shell\powershell.py", line 17, in
from colcon_core.shell.template import expand_template
ModuleNotFoundError: No module named 'colcon_core.shell.template'
[1.542s] colcon.colcon_core.entry_point ERROR Exception loading extension 'colcon_core.shell.bat': No module named 'colcon_core.shell.template'
Traceback (most recent call last):
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\entry_point.py", line 98, in load_entry_points
extension_type = load_entry_point(entry_point)
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\entry_point.py", line 140, in load_entry_point
return entry_point.load()
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\pkg_resources\__init__.py", line 2434, in load
return self.resolve()
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\pkg_resources\__init__.py", line 2440, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\shell\bat.py", line 16, in
from colcon_core.shell.template import expand_template
ModuleNotFoundError: No module named 'colcon_core.shell.template'
[1.547s] colcon.colcon_core.entry_point ERROR Exception loading extension 'colcon_core.shell.sh': No module named 'colcon_core.shell.template'
Traceback (most recent call last):
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\entry_point.py", line 98, in load_entry_points
extension_type = load_entry_point(entry_point)
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\entry_point.py", line 140, in load_entry_point
return entry_point.load()
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\pkg_resources\__init__.py", line 2434, in load
return self.resolve()
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\pkg_resources\__init__.py", line 2440, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\shell\sh.py", line 16, in
from colcon_core.shell.template import expand_template
ModuleNotFoundError: No module named 'colcon_core.shell.template'
[1.547s] colcon.colcon_cmake.task.cmake.build ERROR Could not find a shell extension for the command environment
Failed <<< example_b_msgs [ Exited with code 1 ]
Summary: 0 packages finished [0.47s]
1 package failed: example_b_msgs
2 packages not processed
[6.660s] colcon.colcon_core.entry_point ERROR Exception loading extension 'colcon_core.shell.powershell': No module named 'colcon_core.shell.template'
Traceback (most recent call last):
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\entry_point.py", line 98, in load_entry_points
extension_type = load_entry_point(entry_point)
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\entry_point.py", line 140, in load_entry_point
return entry_point.load()
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\pkg_resources\__init__.py", line 2434, in load
return self.resolve()
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\pkg_resources\__init__.py", line 2440, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_powershell\shell\powershell.py", line 17, in
from colcon_core.shell.template import expand_template
ModuleNotFoundError: No module named 'colcon_core.shell.template'
[6.664s] colcon.colcon_core.entry_point ERROR Exception loading extension 'colcon_core.shell.bat': No module named 'colcon_core.shell.template'
Traceback (most recent call last):
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\entry_point.py", line 98, in load_entry_points
extension_type = load_entry_point(entry_point)
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\entry_point.py", line 140, in load_entry_point
return entry_point.load()
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\pkg_resources\__init__.py", line 2434, in load
return self.resolve()
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\pkg_resources\__init__.py", line 2440, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\shell\bat.py", line 16, in
from colcon_core.shell.template import expand_template
ModuleNotFoundError: No module named 'colcon_core.shell.template'
[6.667s] colcon.colcon_core.entry_point ERROR Exception loading extension 'colcon_core.shell.sh': No module named 'colcon_core.shell.template'
Traceback (most recent call last):
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\entry_point.py", line 98, in load_entry_points
extension_type = load_entry_point(entry_point)
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\entry_point.py", line 140, in load_entry_point
return entry_point.load()
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\pkg_resources\__init__.py", line 2434, in load
return self.resolve()
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\pkg_resources\__init__.py", line 2440, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "C:\Users\GLT2ABT\AppData\Roaming\MathWorks\MATLAB\R2021b\ros2\win64\venv\lib\site-packages\colcon_core\shell\sh.py", line 16, in
from colcon_core.shell.template import expand_template
ModuleNotFoundError: No module named 'colcon_core.shell.template'
.
Error in ros2genmsg (line 276)
buildPackage(builder, [], ' --merge-install', colconMakeArgs); %other messages might need to be present in the same directory
Josh Chen
Josh Chen on 9 Dec 2021
Hi @tfg,
Sorry about the late response and the trouble caused by this issue. An update that addressed this issue has been released, please feel free to update your MATLAB to the latest version if you haven't done so.
This error message seems not related to the cmake issue. We've seen this before when python virtual environment used by MATLAB got corrupted.
Could you please recreate the python virtual environment using the following command and then follow the example to generate ROS 2 custom messages again?
>> ros.ros2.internal.createOrGetLocalPython(true)
Thanks,
Josh

Sign in to comment.

More Answers (0)

Categories

Find more on Custom Message Support in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!