-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't link in /librcl_interfaces__rosidl_generator_py.so due to it not linking in libpython #119
Comments
Update: force linking in the output of |
Hi @tony-p - could you please try again with the recently built updated packages? |
Tried again very naively and same issue occurs however checked and is taking build 3 instead of 5 of |
Dug a little deeper, and now have the build 5 and end up with the same errors. Further the Further I encountered the following issues:
ldd -r .pixi/env/lib/librcl_interfaces__rosidl_generator_py.so
linux-vdso.so.1 (0x00007ffc8c0c7000)
libbuiltin_interfaces__rosidl_generator_py.so => /home/tonypaulussen/workspaces/Workcell-Automation-Core/.pixi/env/lib/./libbuiltin_interfaces__rosidl_generator_py.so (0x00007f375c73b000)
librcl_interfaces__rosidl_generator_c.so => /home/tonypaulussen/workspaces/Workcell-Automation-Core/.pixi/env/lib/./librcl_interfaces__rosidl_generator_c.so (0x00007f375c721000)
librosidl_runtime_c.so => /home/tonypaulussen/workspaces/Workcell-Automation-Core/.pixi/env/lib/./librosidl_runtime_c.so (0x00007f375c715000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f375c4e6000)
libbuiltin_interfaces__rosidl_generator_c.so => /home/tonypaulussen/workspaces/Workcell-Automation-Core/.pixi/env/lib/././libbuiltin_interfaces__rosidl_generator_c.so (0x00007f375c4de000)
librcutils.so => /home/tonypaulussen/workspaces/Workcell-Automation-Core/.pixi/env/lib/././librcutils.so (0x00007f375c4c7000)
/lib64/ld-linux-x86-64.so.2 (0x00007f375c751000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f375c4c2000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f375c4bd000)
undefined symbol: PyObject_GetAttrString (/home/tonypaulussen/workspaces/Workcell-Automation-Core/.pixi/env/lib/./libbuiltin_interfaces__rosidl_generator_py.so)
undefined symbol: PyObject_SetAttrString (/home/tonypaulussen/workspaces/Workcell-Automation-Core/.pixi/env/lib/./libbuiltin_interfaces__rosidl_generator_py.so)
undefined symbol: _Py_Dealloc (/home/tonypaulussen/workspaces/Workcell-Automation-Core/.pixi/env/lib/./libbuiltin_interfaces__rosidl_generator_py.so)
undefined symbol: PyLong_FromLong (/home/tonypaulussen/workspaces/Workcell-Automation-Core/.pixi/env/lib/./libbuiltin_interfaces__rosidl_generator_py.so)
undefined symbol: PyLong_AsLong (/home/tonypaulussen/workspaces/Workcell-Automation-Core/.pixi/env/lib/./libbuiltin_interfaces__rosidl_generator_py.so)
undefined symbol: PyImport_ImportModule (/home/tonypaulussen/workspaces/Workcell-Automation-Core/.pixi/env/lib/./libbuiltin_interfaces__rosidl_generator_py.so)
undefined symbol: PyObject_CallObject (/home/tonypaulussen/workspaces/Workcell-Automation-Core/.pixi/env/lib/./libbuiltin_interfaces__rosidl_generator_py.so)
undefined symbol: PyLong_AsUnsignedLong (/home/tonypaulussen/workspaces/Workcell-Automation-Core/.pixi/env/lib/./libbuiltin_interfaces__rosidl_generator_py.so)
undefined symbol: PyLong_FromUnsignedLong (/home/tonypaulussen/workspaces/Workcell-Automation-Core/.pixi/env/lib/./libbuiltin_interfaces__rosidl_generator_py.so)
undefined symbol: PyList_New (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyLong_FromUnsignedLongLong (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyBuffer_Release (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyLong_AsUnsignedLongLong (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyObject_GetAttrString (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyUnicode_AsUTF8String (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyBytes_FromStringAndSize (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyObject_SetAttrString (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyBuffer_ToContiguous (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: _Py_Dealloc (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyExc_RuntimeError (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyErr_SetString (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyFloat_FromDouble (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PySequence_Size (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyObject_CheckBuffer (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyBool_FromLong (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyLong_AsSize_t (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyImport_ImportModule (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyObject_CallObject (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyList_SetItem (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyObject_CallFunctionObjArgs (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyObject_Size (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyUnicode_DecodeUTF8 (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: _Py_TrueStruct (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyObject_GetBuffer (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyLong_AsUnsignedLong (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyLong_FromUnsignedLong (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyLong_AsLongLong (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PyLong_FromLongLong (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so)
undefined symbol: PySequence_Fast (.pixi/env/lib/librcl_interfaces__rosidl_generator_py.so) |
I wonder if this should be public:
Any ideas @traversaro @wolfv? |
I've just pushed 7d0d8be which I have locally confirmed fixes this issue. If you rebuild ros-humble-rosidl-generator-py and then ros-humble-rcl-interfaces the issue will go away. Unfortunately at the moment I have not the capacity to build this in CI; but it would be easy to do (please see Contributing guidelines if you'd like to open a PR @tony-p). |
Great thanks, will try find some time to try soon (also limited capacity) and if fixes and have time will definitely look into the CI build |
Hi, what's left to get this across the finish line? I'm pretty blocked by this issue and would be happy to help. |
I suggest to read the thread in this PR #169 In short the PR ended up reverting the change due to downstream build dependency issues. Wolf rewrote the cmake to more modern standards, but I haven't had the chance to rebuild try if that also fixed the issue (so that would be step 1). Given that the python libraries are still not public, I fear the issue may still be there. The issue for the downstream builds was that they failed to find python as dependency (as opposed to missing symbols), One (hacky?) solution to that was to include rosidl_generator as a dependency purely as it has a additional exported cmake file that includes finding the python dependencies (
So if it doesn't work with the updates from Wolf, when the interface pacakges are themselves a dependency, they need to be able to give this information through, ideally in a cleaner way then adding another dependency that happens to do that. As a short term hack fix in your own builds that are causing issues you can add something like the following to force the un found packages to be linked if(UNIX)
# Hack to link in missing/can't find libraries on linux
execute_process(COMMAND bash "-c" "echo $(python3-config --ldflags --embed)" OUTPUT_VARIABLE BUILD_PYTHON_LINK_FLAGS)
separate_arguments(FORCE_LINK_FLAGS UNIX_COMMAND ${BUILD_PYTHON_LINK_FLAGS})
list(APPEND FORCE_LINK_FLAGS
-lstd_msgs__rosidl_generator_py
)
add_link_options(${FORCE_LINK_FLAGS})
endif() |
Can you clarify what you mean by "include rosidl_generator as a dependency"? Do you mean as a package.xml dependency, an ament_cmake dependency, a pure CMake dependency, or a source build within the same workspace - or some combination of those? Just adding it as a source build in my workspace doesn't seem to help (I assume because the other packages don't have direct dependencies on it, so it's not resolved to be built first) |
An ament dependency in the cmake file that is used to generate the interfaces that are built into a conda package. So this is how I managed to fix it for the conda builds: So this is actually during the packaging process, once you get to your own builds, the last hack I presented above is (as far as I have found) the only way I have found to resolve the issue. If you want to look into fixing it properly, this is a good resource as to how to start https://robostack.github.io/Contributing.html |
I will look into fixing it properly. Do we have a hunch on what the source of this issue is? Is there some "magic" being done by Ament, etc. when using these packages from the upstream that RoboStack doesn't do (and is probably correct in not doing)? It would be good to know if there's a gotcha here that will recur elsewhere. |
The problem is that python is not an ament package, and so not in the ament index. Ament handles the finding of recursive dependencies, so long as they are in the index (from what I understand). When a library is linked private (on linux) it isn't added on the rpath, so isn't necessarily required to be known by child dependencies, but (in this case) the local implementation that is 2 dependencies removed from the privately linked python libs, it tries to ensure that all symbols are defined, but then finds symbols that don't seem to have an implementation which are provided by the python library. When the python libs are linked public, a direct implementing library needs to explicitly link the python library, but then it needs to be found by cmake, and cmake hasn't "found" python with a At least that is my rough understanding. It may be that the package building environment has the python libraries/symbols always available/findable which is why it doesn't cause an issue for building packages. |
Thanks for that explanation. I'm starting to take a deeper dive into the actual patches being applied to the CMake here to better understand the differences between the upstream and RoboStack's version. I'm still trying to get up-to-date on the state of this project - when you earlier said "I haven't had the chance to rebuild try if that also fixed the issue" w/r/t @wolfv's changes, does that mean those changes are not yet public on the Conda channel? If so, is there something blocking that that y'all could use help with? If the Conda packages are outdated that seems higher priority to me than getting this fixed, though to make my application work with RoboStack I'll need this. I have way too many dependencies to be able to shoehorn the linking workaround into all of them, so the underlying issue will need fixed (which I'm happy to do or have a member of my team do). |
I think the last published full humble rebuild was nearly a year ago (Jan/Feb). Not sure if you are aware of the rattler-build/pixi vs boa/micromamba ecosystems, but Wolf started migrating to the recipe formats used by rattler-build in a branch of Vinca. He used jazzy as his test target and there he ran into the issues caused by making the python dependency public and reverted the public/private and updated the cmake patch in general. |
My investigation into RoboStack is also somewhat tied into an investigation of Pixi, so I should probably learn the rattler stuff along the way. Does that jazzy build system work need to be backported to Humble to make it easier for the two to be continuously maintained? I'd like to be on Jazzy, but I have customers stuck on earlier versions of Ubuntu that can't run Jazzy (which is one of the reasons I'm looking into RoboStack in the first place). |
Sure, thanks! The latest attempt to rebuild humble is conda-forge/ompl-feedstock#39 . The blocking issue there is that we were not able to upgrade to the latest boost in ompl, as with the latest boost macos tests fail. Hopefully I will try to look into that in the next weeks, as also in my organization we will really like to unblock the humble rebuild. |
@EzraBrooks I just read from #222 that you are an Apple Silicon users. So if you want to look into conda-forge/ompl-feedstock#43 feel free to do so! |
Just saw this question wasn't answered. I think as soon as it works for jazzy, I think the intention is also to roll it out for humble. I think the only backport work that would be required is updating the contribution instructions, and the additional recipes that have been made by hand. I think a number of those recipes will also be useful for jazzy and likely almost the same |
The second part of the patch assumes that python install dir is absolute and not relative, so it should be dropped. |
I think making python publicly linked and ament_export_dependencies the rosidl_generators should be sufficient |
This is based on quite an old version of the patch so would apply the parts I suggested to the latest version that wolf made |
We have to be careful for not linking against Python on osx |
I recently looked into this for another project, and I guess we should link |
I think it is only needed for linux so can ensure it only happens for linux. Msvc doesn’t seem to care about privately vs publicly linked |
Solution to issue cannot be found in the documentation.
Issue
I'm having an issue on linux (humble) that when it tries to link in the
librcl_interfaces__rosidl_generator_py.so
it is missing a number of symbols resulting in undefined reference symbolsenv/lib/librcl_interfaces__rosidl_generator_py.so: undefined reference to `PyLong_AsSize_t'
It is essentially the same problem as this https://robotics.stackexchange.com/questions/25039/generated-rosidl-generator-py-so-files-issue
And it is the same for the robostack provided version, however the workarounds don't seem to work and I think it is because it is already too late and should have been applied to these packages or the ones in between.
Would patching the
librcl_interfaces__rosidl_generator_py
build to force link in libpython3 be the best solution here?Installed packages
Environment info
The text was updated successfully, but these errors were encountered: