compiler error during ros code generation
Show older comments
Running colcon build in folder '/test'.
Build in progress. This may take several minutes...Error building package: build_log.
Error(s) encountered while building "mynode2"
------------------------------------------------------------------------
Build error: C++ compiler produced errors. See the Build Log for further details.
More information
Code generation failed: View Error Report
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Mex is configured to use Microsoft Visual 2022 for C++, I have also switched to the 2019 option. I have reason to believe that this had to do with changes made in the latest 2023b release. I generated code with the 2023a a while back, but with the same compiler setting I am now seeing compiler errors in 2023b. The Python environment is created with v3.10.
I am testing code generation with the following basic ROS2 publisher node.
function mynode2
%#codegen
%setenv('RMW_IMPLEMENTATION','rmw_cyclonedds_cpp')
domainID = 10;
Name = "/PosePrintNode";
PoseNode = ros2node(Name, domainID);
pose_sub = ros2publisher(PoseNode, ...
"/chatter","geometry_msgs/Pose");
% Display X position
msg = ros2message("geometry_msgs/Pose");
while (1)
msg.position.x = rand(1);
fprintf("Position = %f\n",msg.position.x)
send(pose_sub,msg)
end
end
4 Comments
Josh Chen
on 19 Sep 2023
Hi Andinet,
With this exact same code and the following configuration setting, I am not able to reproduce this issue on my R2023b MATLAB:
>> cfg = coder.config('exe');
>> cfg.Hardware = coder.hardware('Robot Operating System 2 (ROS 2)');
>> cfg.HardwareImplementation.ProdHWDeviceType = 'Intel->x86-64 (Windows64)';
>> cfg.Hardware.BuildAction = 'Build and load';
>> codegen mynode2 -config cfg
Is there any log got generated? The error message says "See Build Log for further details", is there any hyperlink associate with it?
Thanks,
Josh
Andinet
on 19 Sep 2023
Denis Gurchenkov
on 20 Sep 2023
The error log you posteed contains this: View Error Report
This is a hyperlink that should open a UI window, and at the bottom, there is a "build log" tab. Can you look there, what is the contents?
Andinet
on 22 Sep 2023
Answers (1)
Denis Gurchenkov
on 26 Sep 2023
0 votes
Hi Andinet, I suspect there is some kind of cmake configuraiton issue on your system. Google search for "could not find pkgconfig" gives links like this one:
Categories
Find more on ROS Node Generation and Deployment in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!