As found during #2350, it seems like we use non-standard installation paths.
Is there no way to use a standard CMAKE_INSTALL_PREFIX and avoid the -Wl,-rpath in the examples? If we cannot use CMAKE_INSTALL_PREFIX=/usr, an entry in /etc/ld.so.conf.d/ should fix the problem?
CMAKE_INSTALL_PREFIX=/usr/local(@sanssecours, @ingwinlu please correct me, if am wrong)
/usr require root permissionCMAKE_INSTALL_PREFIX is actually a good thing in my opinion. We mention using it in our documentation so we should make sure it actually works.-Wl,-rpath is only problematic, when the executable should be portable and may be used on a system with a different configuration. That is why CMake uses it by default when building and directly executing applications, but strips it for the install step. -Wl,-rpath in our example. The README mentions the problems and, if you actually want to build an application for distribution you would customize the Makefile anyway. You would probably also already know about the problems with RPATH.Yes, Elektra should be a fully relocatable package.
Currently, this can be easily done by setting TARGET_PLUGIN_FOLDER to an empty string or by adding the plugin folder to /etc/ld.so.conf
The rpath solution could be fixed (to be relocatable) by using $ORIGIN (something similar is also available for Mac OS X). rpath has the advantage that Elektra's plugins do not pollute the standard library paths. But rpath is not always available or discouraged by some distributions. See also #1275
@kodebach So there is no way to avoid the -Wl,-rpath?
I am pretty sure there is a way. I just didn't look into it further yet, because it takes quite some time to test the changes on all supported systems. I also didn't think this was a priority since the configuration works for now.
Can we close this or is it worth to further investigate this issue?
I think the RPATH discussion plays a role in @robaerd's efforts to create better packages. I also think we should have at least one build job that tries to install Elektra into /usr like a package would do.