Hello,
I am facing the error with the buildPackage in rosgenmsg command.
The error I am getting is as follows:
<
Build in progress. This may take several minutes...Error using ros.internal.ROSProjectBuilder/buildPackage (line 552)
Error building package: build log.
Error in rosgenmsg (line 483)
buildPackage(builder, [], 'install', catkinMakeArgs); %other messages might need to be present in the same directory
>
When I checked the build log, it shows:
<
-- Configuring incomplete, errors occurred! See also "E:/catkin_ws/src/matlab_msg_gen_ros1/win64/build/CMakeFiles/CMakeOutput.log". Base path: E:\catkin_ws\src\matlab_msg_gen_ros1\win64 Source space: E:\catkin_ws\src\matlab_msg_gen_ros1\win64\src Build space: E:\catkin_ws\src\matlab_msg_gen_ros1\win64\build Devel space: E:\catkin_ws\src\matlab_msg_gen_ros1\win64\devel Install space: E:\catkin_ws\src\matlab_msg_gen_ros1\win64\install #### #### Running command: "cmake E:\catkin_ws\src\matlab_msg_gen_ros1\win64\src -DBoost_NAMESPACE=mwboost -DCATKIN_ENABLE_TESTING=off -DCMAKE_CXX_COMPILER=cl.exe -DCMAKE_C_COMPILER=cl.exe -DCMAKE_LINKER=link.exe -DMSVC_TOOLSET_VERSION=141 -DCMAKE_PREFIX_PATH=C:\Program Files\MATLAB\R2021b\sys\ros1\win64\ros1;C:/Program Files/MATLAB/R2021b/toolbox/ros/mlroscpp/custom_messages -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS_RELEASE=/MD /Od /Ob2 /DNDEBUG -DCATKIN_DEVEL_PREFIX=E:\catkin_ws\src\matlab_msg_gen_ros1\win64\devel -DCMAKE_INSTALL_PREFIX=E: \catkin_ws\src\matlab_msg_gen_ros1\win64\install -G Ninja" in "E:\catkin_ws\src\matlab_msg_gen_ros1\win64\build" #### Invoking "cmake" failed
>
Could anyone support? I am not sure what's the issue in this case.

댓글 수: 19

Jagadeesh Konakalla
Jagadeesh Konakalla 2022년 5월 31일
Hi Bharath,
Please attach the entire log file. Looks like some configuration issue.
Which version of MATLAB that you are using ?
Please run the following command in the MATLAB command window and share the generated log file with us.
ros.internal.generateSupportFile
With regards,
Jagadeesh K.
Bharath Mahadikar
Bharath Mahadikar 2022년 5월 31일
Hi Jagadeesh,
Please find attached both the build log and the support file.
Looking forward to your response. Thanks in advance.
Best regards,
Bharath
Jagadeesh Konakalla
Jagadeesh Konakalla 2022년 5월 31일
Thanks for sharing the required log files.
From the log, i can say that CMAKE is confused with the Python in the folllowing path. The following path has spaces in the path because of which CMAKE is throwing error which is not understandable.
C:\Users\Bharath B Mahadikar\AppData\Local\Microsoft\WindowsApps\python.exe
May i know from where you installed the Python 2.7 on your windows machine? Looks like you have two versions of Python.
Path 1 : C:\Python27
Path 2: C:\Users\Bharath B Mahadikar\AppData\Local\Microsoft\WindowsApps\python.exe
If the path 1 is correct python, can you add C:\Python27 to PATH environment variable of Windows. Please make sure that Path 1 is higher on search path than the Path 2.
After the above change, please restart the MATLAB and let me know if the rosgenmsg works or not.
Thanks,
Jagadeesh K
Bharath Mahadikar
Bharath Mahadikar 2022년 5월 31일
Hello,
I did try this now, and restarted MATLAB and the system, but I still get the same error.
Attaching the log and support file again. Is something else the issue?
Thanks,
Bharath
Mridul Agrawal
Mridul Agrawal 2022년 5월 31일
편집: Mridul Agrawal 2022년 5월 31일
Hi, I was also facing the same error while i was creating ROS custom messages :
""Build in progress. This may take several minutes...Error using ros.internal.ROSProjectBuilder/buildPackage (line 552)
Error building package: build log.
Error in rosgenmsg (line 483)
buildPackage(builder, [], 'install', catkinMakeArgs); %other messages might need to be present in the same directory""
I did try to take help from below link :
which in a way says path length might be the issue.
Workaround tried which worked is :
  1. ROS message folder i directly put in my system D drive as ......."D:\Your_Folder_name
  2. Now add this folder in MATLAB path
  3. Try to run command rosgenmsg("D:\Your_Folder_name") ......(which i suppose you want to do actually)
Disclamer Note : I did not see your log files, probably there might be some other issues, but command window errors was similar, the method i mentioned might not be working for you in that case
I able to solve same issue now by this and sucessfully able to build it and created ROS messages. Let me know if this helped you as well.
Thanks
Mridul Agrawal
Bharath Mahadikar
Bharath Mahadikar 2022년 5월 31일
Thank you.
I will try these methods and see if this works.
Regards,
Bharath
Jagadeesh Konakalla
Jagadeesh Konakalla 2022년 5월 31일
Hi Bharath,
Can you please run the following command before you do as above suggested. Let me know the output of the following on your MATLAB.
ros.internal.createOrGetLocalPython(true)
Thanks,
Jagadeesh K
Bharath Mahadikar
Bharath Mahadikar 2022년 5월 31일
Hi Jagadeesh,
I get the following error.
<
Creating a Python virtual environment..Done.
Error using ros.internal.createOrGetLocalPython (line 142)
Could not create Python virtual environment: C:\Python27\python.exe: can't open file 'C:\Users\Bharath': [Errno 2] No such file or directory
. Verify there is sufficient space on disk and retry the command.
>
I think this is again an error due to the path having spaces. I was initiallly getting this error too, but I found a work around for this in the comments of the following linkand used it:
Regards,
Bharath
Jagadeesh Konakalla
Jagadeesh Konakalla 2022년 5월 31일
Thanks for the update. On my end i was getting error when spaces are present in prefdir. Now i understood that you fixed the issues following the link. Let me know how it works when you use the prefdir without space.
Bharath Mahadikar
Bharath Mahadikar 2022년 5월 31일
I followed the link you shared for changing the prefdir by making a .bat file with a new path, but I still am getting the same error. I don't know if there is a workaround for the User name having spaces with python.
Also @Mridul Agrawal, I am following the same approach too, with a small path for ros. Its mostly the spaces thats causing the error, but thank you.
Jagadeesh Konakalla
Jagadeesh Konakalla 2022년 5월 31일
How did you launch the MATLAB ?
Please share the error log.
Bharath Mahadikar
Bharath Mahadikar 2022년 5월 31일
I made a batch file (newpath.bat) and open this file to start MATLAB. This batch file consists of:
set MATLAB_PREFDIR=E:\4AT100
"C:\Program Files\MATLAB\R2021b\bin\matlab.exe"
The build log is attached again.
Regards,
Bharath
Jagadeesh Konakalla
Jagadeesh Konakalla 2022년 5월 31일
Hi Bharath,
From the new log, i still see that, python environement is created in the same folder.
You may need to delete the matlab_msg_gen_ros1 folder before you do rosggenmsg in the MATLAB.
Please type prefdir command in the MATLAB and make sure that it returns the E:\4AT100.
Then do run ros.internal.createOrGetLocalPython(true).
If the above command is succeful, then run rosgenmsg.
Thanks,
Jagadeesh K.
Bharath Mahadikar
Bharath Mahadikar 2022년 5월 31일
Hey Jagadeesh,
Yes it works now! Thank you so much for the support!
Best regards,
Bharath
Mario Cervantes Hernandez
Mario Cervantes Hernandez 2023년 11월 3일
I have the same message error but I do not have an username "with spaces" I am wondered if you could help me on this issue?
Hello, I need to run the command "rosgenmsg". I am using Windows 10, Visual Studio 2017, Python 2.7.18 and Cmake 3.15.5 as Matlab recommends for each version.
but I have the following error:
[1/1] Generating MATLAB interfaces for custom message packages... Done.
Running catkin build in folder 'C:/Users/username/Documents/Hexa2023/matlab_msg_gen_ros1/win64'.
Build in progress. This may take several minutes...Error using ros.internal.ROSProjectBuilder/buildPackage (line 552)
Error building package: build log.
Error in rosgenmsg (line 483)
buildPackage(builder, [], 'install', catkinMakeArgs); %other messages might need to be present in the same directory
Jagadeesh Konakalla
Jagadeesh Konakalla 2023년 11월 3일
Can you please send me the error log ? Which version of MATLAB that yoiu are using ?
zn
zn 2025년 3월 9일
I am having the same issue. I have checked spaces in the directory of prefdir. And ros.internal.createOrGetLocalPython(true) is also done. But it appears to have the same error:
buildPackage(builder, [], 'install', catkinMakeArgs); %other messages might need to be present in the same directory.
Jagadeesh Konakalla
Jagadeesh Konakalla 2025년 3월 10일
Hi Zn,
Your error looks different.
Can you try to build custom messages in the new folder and give a try ? It could be issue with previously generated build folder.
Aslo, can you ensure that you use the latest version of 2023b MATLAB release ?
Thanks,
Jagadeesh K
zn
zn 2025년 3월 10일
The problem is solved! Cause for that is unrecognized characters in .msg.
Using rosgenmsg with a .msg contained unusual characters (like Chinese) is forbidden, even in comments (after %).
Thanks,
zn

댓글을 달려면 로그인하십시오.

 채택된 답변

Jagadeesh Konakalla
Jagadeesh Konakalla 2022년 5월 31일
이동: Remo Pillat 2023년 3월 2일

0 개 추천

Hi Bharath,
We create a python virtual environement in MATLAB preferences directory (prefdir). In your case, the preference directory has sapces. Please note that your username has spaces.
C:\Users\Bharath B Mahadikar\AppData\\Roaming\MathWorks\MATLAB\R2022b
From the CMAKE log, i see that error says that
B was unexpected this time.
The issue looks like some python script is not able to handle spaces in the Path where the python virtual environment is created. This issue looks specific to Windows platform only.
One workaround is to change MATLAB preference directory for your 2021b MATLAB.
You can give a try and let me know if that works for you.
Thanks,
Jagadeesh K.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Network Connection and Exploration에 대해 자세히 알아보기

질문:

2022년 5월 30일

댓글:

zn
2025년 3월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by