gazebosim / gz-gui

Builds on top of Qt to provide widgets which are useful when developing robotics applications, such as a 3D view, plots, dashboard, etc, and can be used together in a convenient unified interface.
https://gazebosim.org
Apache License 2.0
76 stars 44 forks source link

libGrid3D.so is installed with RUNPATH set to the build location #627

Open wentasah opened 3 months ago

wentasah commented 3 months ago

Environment

Description

Steps to reproduce

Run the following and observe the output:

$ objdump -x /usr/lib/x86_64-linux-gnu/gz-gui-8/plugins/libGrid3D.so|grep PATH
RUNPATH              /home/jenkins/workspace/gz-gui8-debbuilder/build/gz-gui-8.3.0/obj-x86_64-linux-gnu/lib:
$ objdump -x /usr/lib/x86_64-linux-gnu/gz-gui-8/plugins/libGridConfig.so|grep PATH
# no output

libGrid3D.so has RUNPATH set, while other plugins don't.

Discussion

I came across this problem when building Gazebo with the Nix package manager in this project. Nix builds are automatically checked for inappropriate RUNPATH and fail if one is detected.

The reason why RUNPATH is set for libGrid3D.so is that it just a copy of libGridConfig.so, but installed differently (see here). Due to the fact that it is installed as a file rather than a library, CMake doesn't remove RUNPATH setting during installation.

I tried to figure out, how to convince CMake to install a library under a different name and remove RUNPATH settings, however I didn't find anything straightforward (except building the library twice). RENAME keyword is ignored when installing library targets and I don't see a way to do post-installation changes.

We can work around this in the downstream project, but fixing it here might benefit other users too.

azeey commented 3 months ago

Thanks for flagging this. We likely won't be getting around to this anytime soon, but I've added the help wanted tag