No rule to make target python3.9a when running ros2genmsg

10 次查看(过去 30 天)
Hi,
I am trying to read a ros2 bag file into Matlab. Since this bag file contains custom msgs, I understand that I need to run ros2genmsg on the directories containing the packages with the definitions of theses msgs.
  1. Freshly installed Ubuntu 20.04
  2. Installed python3.9, python3.9-dev
  3. set pyenv to the python3.9 path
  4. run ros2genmsg on directory
  5. Matlab starts building the msg interfaces
  6. Make fails with make[2]: *** No rule to make target '/home/user/.matlab/R2022a/ros2/glnxa64/venv/lib/libpython3.9.a', needed by 'rosidl_generator_py/XXXXXXXXmsgs/libXXXXXXXXmsgs__python.so'. Stop.
What am I doing wrong?
Identifying message files in folder '/home/user/packages/my_msg'..Done.
Validating message files in folder '/home/user/packages/my_msg'..Done.
[2/2] Generating MATLAB interfaces for custom message packages... Done.
Running colcon build in folder '/home/user/packages/my_msg/matlab_msg_gen/glnxa64'.
Build in progress. This may take several minutes...Error using ros.internal.ROSProjectBuilder/buildPackage
Error building package: build log.
Error in ros2genmsg (line 279)
buildPackage(builder, [], ' --merge-install', colconMakeArgs); %other messages might need to be present in the same directory
Error in ground_non_ground (line 2)
ros2genmsg("/home/user/packages/my_msg")
  1 个评论
Max Hochlenert
Max Hochlenert 2022-9-12
编辑:Max Hochlenert 2022-9-12
Hi Hari,
your seconds suggestion did the trick. I had installed a pre-built version of python3.9 before, that had appearently not been compiled with the --enable-shared option.
I followed this manual: https://linuxize.com/post/how-to-install-python-3-9-on-ubuntu-20-04/ to compile my own python3.9 and set the configure option --enable-shared. Then I deleted the temporary matlab files in the package directory, and now it works.
Thank you.

请先登录,再进行评论。

回答(1 个)

Hari Krishna Kakarla
移动:Remo Pillat 2023-11-10
Hi Max,
It looks like, this is an issue with MATLAB Installation. I see that you have installed python3.9-dev. Please install python3.9-venv as well and re-create the python virtual environment.
  1. Install python 3.9-venv
  2. Point pyenv to installed python in MATLAB.
  3. ros.ros2.internal.createOrGetLocalPython(true)
Now ros2genmsg should work. If you are encountering the same error again, then you might need to re-install your python by setting "--enable-shared" flag:
  1. PYTHON_CONFIGURE_OPTS="--enable-shared"
  2. Now, re-install the required python.
  3. ros.ros2.internal.createOrGetLocalPython(true)
After doing above steps, ros2genmsg should work. I hope this solves the problem. Please let me know if you are still encountering the errors.
Thanks
Hari

类别

Help CenterFile Exchange 中查找有关 COM Component Integration 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by