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

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
Hari Krishna Kakarla 2022 年 9 月 12 日
移動済み: Remo Pillat 2023 年 11 月 10 日

0 投票

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

カテゴリ

製品

リリース

R2022a

質問済み:

2022 年 9 月 8 日

移動済み:

2023 年 11 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by