필터 지우기
필터 지우기

ros2genmsg error building package

조회 수: 24 (최근 30일)
Harun Leto
Harun Leto 2022년 8월 25일
답변: g. a. 2023년 12월 6일
I'm trying to have my custom ros2 interfaces working with Matlab but face issues with the ros2genmsg command:
>> ros2genmsg('/home/andre/Desktop/ros_ws/src')
Identifying message files in folder '/home/andre/Desktop/ros_ws/src'..Done.
Warning: Could not locate 'libpython*.so' library.
> In ros.ros2.internal.createOrGetLocalPython (line 252)
In ros2genmsg (line 84)
Validating message files in folder '/home/andre/Desktop/ros_ws/src'..Warning: Could not locate 'libpython*.so' library.
> In ros.ros2.internal.createOrGetLocalPython (line 252)
In ros.ros2.internal.runros2py (line 12)
In ros.ros2.internal.validateMsg (line 11)
In ros2genmsg (line 91)
Done.
[0/2] Generating MATLAB interfaces for custom message packages... 0%Warning: Could not locate 'libpython*.so' library.
> In ros.ros2.internal.createOrGetLocalPython (line 252)
In ros.ros2.internal/ColconBuilder/setupPythonAndCmakeTools (line 49)
In ros.internal/ROSProjectBuilder (line 411)
In [2/2] Generating MATLAB interfaces for custom message packages... Done.
Running colcon build in folder '/home/andre/Desktop/ros_ws/src/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
Before trying the ros2genmsgs command I needed to make a few changes:I'm on Ubuntu 22.04 so I have python 3.10. I know it's not compatible with my Matlab version 2022a. So I installed python 3.9 and made a virtual env. I then used pyenv function to target this virtual environment with the compatible Python version on it as shown here:
pyenv('Version', '/home/andre/py39/bin/python')
ans =
PythonEnvironment with properties:
Version: "3.9"
Executable: "/home/andre/py39/bin/python"
Library: "libpython3.9.so.1.0"
Home: "/home/andre/py39"
Status: NotLoaded
ExecutionMode: OutOfProcess
I feel like the warnings: Warning: Could not locate 'libpython*.so' library may probably be linked to the problem as when I read the build log of the package building I see this:
/usr/bin/cmake: /usr/local/MATLAB/R2022a/bin/glnxa64/libcurl.so.4: no version information available (required by /usr/bin/cmake)
/usr/bin/cmake: /usr/local/MATLAB/R2022a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /usr/bin/cmake)
/usr/bin/cmake: /usr/local/MATLAB/R2022a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /lib/x86_64-linux-gnu/libjsoncpp.so.25)
I've tried different python versions, Matlab versions (even the prerelease) but I can't figure how to solve the problem.
Any idea?
  댓글 수: 4
Karthik Reddy Vennapureddy
Karthik Reddy Vennapureddy 2022년 8월 26일
편집: Karthik Reddy Vennapureddy 2022년 8월 26일
Hi Haroun,
To Fix the warnings related to libcurl.so.4 and libstdc++.so.6, close if there are any open MATLAB sessions, and please follow the steps below as mentioned in this answer.
export LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/usr/lib/x86_64-linux-gnu/libcurl.so"
matlab
To Fix the warnings related to "Could not locate 'libpython*.so' library.", change the file "matlab/toolbox/ros/utilities/+ros/+internal/+utilities/findPyLibDir.m", in line 37
cmd = ['"' pyexec '" -c "from distutils.sysconfig import get_config_var; print get_config_var(''LIBDIR'')"'];
to
cmd = ['"' pyexec '" -c "from distutils.sysconfig import get_config_var; print(get_config_var(''LIBDIR''))"'];
and change line 48 from below
cmd = ['"' pyexec '" -c "from distutils.sysconfig import get_config_var; print get_config_var(''LIBPL'')"'];
to
cmd = ['"' pyexec '" -c "from distutils.sysconfig import get_config_var; print(get_config_var(''LIBPL''))"'];
After following above steps, if you still encounter any build failure while doing ros2genmsg, please share with us the entire build log.
Thanks,
Karthik Reddy
Harun Leto
Harun Leto 2022년 8월 30일
Hi,
Changing the files located in "matlab/toolbox/ros/utilities/+ros/+internal/+utilities/findPyLibDir.m" made the warning "Could not locate 'libpython*.so' library." files disappear! Thank you.
I tried running the commands to see if it solved the problem:
>> ros.internal.createOrGetLocalPython(true)
Removing previous version of Python virtual environment..Done.
Creating a Python virtual environment...Done.
Adding required Python packages to virtual environment....Done.
ans =
'/root/.matlab/R2022a/ros1/glnxa64/venv/bin/python3'
>> ros2genmsg('/home/andre/Desktop/ros_ws/src')
Identifying message files in folder '/home/andre/Desktop/ros_ws/src'..Done.
Validating message files in folder '/home/andre/Desktop/ros_ws/src'..Done.
[2/2] Generating MATLAB interfaces for custom message packages... Done.
Running colcon build in folder '/home/andre/Desktop/ros_ws/src/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
When I open the build log I see:
/usr/bin/cmake: /usr/local/MATLAB/R2022a/bin/glnxa64/libcurl.so.4: no version information available (required by /usr/bin/cmake)
/usr/bin/cmake: /usr/local/MATLAB/R2022a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /usr/bin/cmake)
/usr/bin/cmake: /usr/local/MATLAB/R2022a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /lib/x86_64-linux-gnu/libjsoncpp.so.25)
So same errors as before.
I then tried fixing the warnings related to libcurl.so.4 and libstdc++.so.6 as you said using
export LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/usr/lib/x86_64-linux-gnu/libcurl.so"
matlab
It turns out that it makes matlab crash when launched now, you can find the crash report attached.
Thank you for your time

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

답변 (1개)

g. a.
g. a. 2023년 12월 6일
Hi,
the warning disappears, thanks. In my case (Matlab 2022a with Ubuntu 20.04) the file findPyLib.m was in a different directory, namely:
/usr/local/MATLAB/R2022a/toolbox/ros/utilities/+ros/+internal/+utilities
best,
g.

카테고리

Help CenterFile Exchange에서 Python Package Integration에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by