-
Notifications
You must be signed in to change notification settings - Fork 334
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
manual_composition does not search for components in its own directory #424
Comments
IMHO the |
Additional information from my investigation: It's not the RPATH. CMake should have reasonable defaults set. The output of
|
I assumed that cmake was a first-class citizen among the build tools. Maybe I am wrong. The docs remain unclear to me concerning that question. With colcon things are OK, because a setup script in the install folder sets |
Artifacts installed by CMake do not have an You don't need to use If you choose a plain CMake build type you opt-out of those helpers provided by |
AFAIK Artifacts installed by CMake do have an I understand that I am on my own if I want to use plain CMake, but I fear some Please note that opting out of colcon or ament is not for fun, but requiring correct environment variables set before program start is quite a problem in our safety-relevant context. I would really appreciate both approaches could live side by side. |
Thanks to Craig Scott I tend to think I have an explanation: The build system (cmake) does not set Calling A reset via As long as |
I doubt that there is any logic in ament which does that. Please point to it when you find such a thing.
Again, I don't think there is any magic involved. You can easily introspect the command which are being invoked for every package in the
I don't see how the environment variables set by the setup files (which are necessary to use the artifacts) would interfere with your safety-relevant context. Maybe you can elaborate on that a bit more.
If your package provides a shared library installed into
Can you clarify what environment variables you consider to be "ament CMake macros" and what "further shell environment settings"? The answer is probably no, the setup files set a bunch of environment variables and you can't cherry-pick (simply because there was never a need for it). |
The further shell environment settings that enable the export AMENT_CURRENT_PREFIX=/opt/ros/eloquent
export AMENT_PREFIX_PATH=/opt/ros/eloquent
export PYTHONPATH=/opt/ros/eloquent/lib/python3.6/site-packages A subsequent call to mkdir build
cd build
cmake -DCMAKE_PREFIX_PATH=/opt/ros/eloquent ..
make
export LD_LIBRARY_PATH=/opt/ros/eloquent/lib
./manual_composition succeeds.
|
I want a single ROS executable to run as a daemon. The idea that I have to run it via a shell script is possible, but I would like to avoid any of these in favor of simplicity, and simplicity is a key factor here. In an ideal world I could copy a static executable onto a minimal linux and run it at startup. I fear ROS2 might stand in my way here. Also I would like to point to https://www.hpc.dtu.dk/?page_id=1180, which states
|
This is due to to another change in cmake: one has to repeat the following in every component:
Now everything works fine until a ROS2 dependency is loaded. Since ROS2 does not set the @dirk-thomas does anything speak against compiling ROS2 libraries installed to |
You certainly won't need
Because they are installed in a standard location which is implicitly being searched. Since the ROS executable are installed in a non-standard location in your case they need an environment variable to tell where to search for the libraries. This is simply how it works on Linux and is not specific to ROS.
As I mentioned before: nothing in ROS is doing anything magic here. Until you can point to something in ROS which is responsible for it please don't call it "ROS2 might stand in my way". What you are seeing is standard CMake behavior.
In ROS we chose to set the Yes, we could modify the logic to set |
I think I have a problem that stems from LD_LIBRARY_PATH. interfering with CPack. I will elaborate on it later, but you can preview my experiments at https://github.com/daixtrose/composition_sep/blob/master/README.md to get an idea. Run ldd on the installed executable to see the problem. Maybe there is a workaround that I am not aware of. |
I have not found a solution for this issue yet and I am unsure if a solution exists.
I understand that you prefer to have multiple ROS versions side by side and not interfere with each other by running setup scripts which set Yet the price to pay is that a library must not have the same name as a library in So this does not scale and since Please find attached the current version of my CPack experiment for future reference: composition_sep-master.zip |
There is a very straight forward solution to these naming collisions: the name of a package already acts as a namespace (e.g. consider C/C++ header files or Python modules). A package In an environment where multiple packages share the same namespace (which the case for headers, Python modules as well as shared libraries) that kind of consensus is simply necessary to avoid collisions. |
My findings summarizedThe issue can only be mitigated by changing the general approach chosen by ROS, i.e. drop the idea that environment variables (especially The need to have side-by-side installations of different ROS versions can be met without requiring set_target_properties(my_exec
BUILD_RPATH_USE_ORIGIN ON
PROPERTIES INSTALL_RPATH
"$ORIGIN:$ORIGIN/../lib:/opt/ros/<whatever version>/lib:<probably other subdirs>") in each ROS executable and each ROS library (use @loader_path instead of ORIGIN on MAC). I still haven't found the best place to add this to the build process of all ROS2 libraries, so I cannot provide the pull request that @dirk-thomas asked for within a short time period. Intermediate workaroundWithout changing ROS2, the user is required to start the executable via a startup script that sets the The current workaround demonstrated here and attached to this issue: composition_sep-master.zip My wishes summarizedYour mileage may vary, but I consider being forced to run an executable via a startup shell script in order to have it run and load libs correctly as unnecessary and I would appreciate an approach that does not depend on environment variables in general. Also I kind of like to use CPack or other package managers to create Debian and RPM packages and I think this should not me made more difficult than it could be. The same argument applies for being forced to set |
BTW: feel free to add composition_sep or derivations from it to the ROS2 examples. Once this issue is decided upon I can also provide a PR. |
Please consider to make concrete proposals and also contribute necessary changes to achieve your goal of not requiring custom environment variables. |
Is there a central point where you add compiler flags for all ROS2 parts? |
Since some packages are just plain CMake projects there is on central point. The best way to pass CMake arguments to all CMake packages is the command line / environment variables. |
Bug report
Required Info:
gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:hsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.2.1-17ubuntu1~18.04.1' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 9.2.1 20191102 (Ubuntu 9.2.1-17ubuntu1~18.04.1)
Steps to reproduce issue
Expected behavior
An executable
manual_composition
which links to the freshly compiled component libraries.Actual behavior
ldd manual_composition
strace -o gaga -f ./manual_composition
Additional information
None.
The text was updated successfully, but these errors were encountered: