Libelektra: Build Server: CMAKE_INSTALL_PREFIX=/usr

Created on 1 Feb 2019  路  6Comments  路  Source: ElektraInitiative/libelektra

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?

build low priority question

All 6 comments

Current configuration

  • Cirrus CI jobs use the default CMAKE_INSTALL_PREFIX=/usr/local
  • Travis CI Linux jobs use a local folder inside the build directory
  • Travis CI macOS jobs use the default
  • Jenkins builds use a local folder inside the Workspace
  • I don't think every build/job does install Elektra

(@sanssecours, @ingwinlu please correct me, if am wrong)

Things to consider

  • Normally directories below /usr require root permission
  • Travis and Cirrus support sudo (at least on some of the supported OSs)
  • Jenkins uses docker therefore sudo may be problematic
  • Having one or more build jobs with a custom CMAKE_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.

RPATH

  • Using -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.
  • It should be fine to use -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.
  • The one problem that remains, is that we actually force CMake to use RPATH in all of our builds, even for installing. The CMake documentation suggests a different approach.
  • The question at the basis of all this is: Should Elektra be a fully relocatable package or not? In my opinion we should try to be fully relocatable, if possible. Not least, because it can make testing Elektra easier.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

raphi011 picture raphi011  路  32Comments

KurtMi picture KurtMi  路  85Comments

PhilippGackstatter picture PhilippGackstatter  路  45Comments

haraldg picture haraldg  路  65Comments

markus2330 picture markus2330  路  28Comments