How to solve errors from ros2genmsg about libcurl and libpython3.7m.a in R2021b?

3 views (last 30 days)
I'm using ROS2 and MATLAB R2021b on Ubuntu 20.04.
When I try to build a message(tf2_msgs) by ros2genmsg, I failed with an error and got error logs like below.
/usr/bin/cmake: /usr/local/MATLAB/R2021b/bin/glnxa64/libcurl.so.4: no version information available (required by /usr/bin/cmake)
/usr/bin/cmake: /usr/local/MATLAB/R2021b/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /usr/bin/cmake)
/usr/bin/cmake: /usr/local/MATLAB/R2021b/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /lib/x86_64-linux-gnu/libjsoncpp.so.1)
I found some solutions for the error about libcurl.so.
https://jp.mathworks.com/matlabcentral/answers/623103-matlab-2020b-rosgenmsg-can-t-find-cmake#comment_1088683
https://jp.mathworks.com/matlabcentral/answers/623103-matlab-2020b-rosgenmsg-can-t-find-cmake#answer_753184
These solution could overcome the above error about libcurl.so.
However, I met a new error about python after that.
/usr/bin/ld: /home/<username>/.matlab/R2021b/ros2/glnxa64/venv/lib/libpython3.7m.a(abstract.o): relocation R_X86_64_PC32 against symbol `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
How can I escape this error and use ros2genmsg?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 29 May 2023
Edited: MathWorks Support Team on 29 May 2023
Generally, the error about `_Py_NotImplementedStruct' often resolves by re-installing python with setting '--enable-shared' option.
https://stackoverflow.com/questions/42582712/relocation-r-x86-64-32s-against-py-notimplementedstruct-can-not-be-used-when
You can check whether your python is installed with 'enable-shared' option or not by $ ./python3 -m sysconfig command in the directory which python is installed (like "~/.pyenv/versions/3.7.**").
If the python isn't installed with the option, setting PYTHON_CONFIGURE_OPTS variable like below and re-installing python might be a solution.
$ env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.7.12

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!