ros2genmsg error building package
22 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Karthik Reddy Vennapureddy
il 26 Ago 2022
Modificato: Karthik Reddy Vennapureddy
il 26 Ago 2022
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
Risposte (1)
g. a.
il 6 Dic 2023
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.
0 Commenti
Vedere anche
Categorie
Scopri di più su Custom Message Support in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!