Skip to content
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

cmake build: don't hardcode absolute paths in install DESTINATIONs #684

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fogti
Copy link

@fogti fogti commented Sep 4, 2022

Fixes #683

@lxbsz
Copy link
Collaborator

lxbsz commented Sep 5, 2022

This seems incorrect:

Currently the install paths will be:

Install the project...
-- Install configuration: ""
-- Up-to-date: /usr/lib64/libtcmu.so.2.2
-- Up-to-date: /usr/lib64/libtcmu.so.2
-- Up-to-date: /usr/lib64/libtcmu.so
-- Up-to-date: /usr/bin/tcmu-runner
-- Up-to-date: /usr/lib64/tcmu-runner/handler_file_optical.so
-- Up-to-date: /usr/lib64/tcmu-runner/handler_file_zbc.so
-- Up-to-date: /usr/lib64/tcmu-runner/handler_rbd.so
-- Up-to-date: /usr/lib64/tcmu-runner/handler_qcow.so
-- Up-to-date: /etc/tcmu//tcmu.conf.old
-- Installing: /etc/tcmu//tcmu.conf
-- Up-to-date: /etc/logrotate.d/tcmu-runner.bak/tcmu-runner
-- Installing: /etc/logrotate.d/tcmu-runner
-- Up-to-date: /usr/share/dbus-1/system-services/org.kernel.TCMUService1.service
-- Up-to-date: /etc/dbus-1/system.d/tcmu-runner.conf
-- Up-to-date: /usr/lib/systemd/system/tcmu-runner.service
-- Up-to-date: /usr/share/man/man8/tcmu-runner.8

With this:

Install the project...
-- Install configuration: ""
-- Installing: /usr/lib64/libtcmu.so.2.2
-- Up-to-date: /usr/lib64/libtcmu.so.2
-- Up-to-date: /usr/lib64/libtcmu.so
-- Installing: /usr/bin/tcmu-runner
-- Set runtime path of "/usr/bin/tcmu-runner" to ""
-- Installing: /usr/lib64/tcmu-runner/handler_file_optical.so
-- Installing: /usr/lib64/tcmu-runner/handler_file_zbc.so
-- Installing: /usr/lib64/tcmu-runner/handler_rbd.so
-- Installing: /usr/lib64/tcmu-runner/handler_qcow.so
-- Installing: /data/tcmu-runner/etc/tcmu/tcmu.conf
-- Installing: /data/tcmu-runner/etc/logrotate.d/tcmu-runner
-- Up-to-date: /usr/share/dbus-1/system-services/org.kernel.TCMUService1.service
-- Installing: /usr/etc/dbus-1/system.d/tcmu-runner.conf
-- Installing: /usr/lib/systemd/system/tcmu-runner.service
-- Installing: /usr/share/man/man8/tcmu-runner.8

@fogti
Copy link
Author

fogti commented Sep 5, 2022

ok, this means ${CMAKE_INSTALL_SYSCONFDIR} gets at one point resolved to /data/tcmu-runner/etc and at another to /usr/etc, both of which are surprising..., although I don't know why exactly.

might be fixable using set(CMAKE_INSTALL_SYSCONFDIR CACHE PATH /etc) or so...

@fogti
Copy link
Author

fogti commented Sep 5, 2022

I have replaced the confusing usage of file(INSTALL) with more appropriate commands... And regarding the interpretation of CMAKE_INSTALL_SYSCONFDIR the problem exists that both ${CMAKE_INSTALL_PREFIX}/etc and /etc are reasonable choices, and it should be specified anyways...

Fixes open-iscsi#683

> Currently, the CMakeLists.txt and *.conf_install.cmake.in files contain
> absolute install paths, that is, not relative to ${CMAKE_INSTALL_PREFIX}.
> This makes packaging this program unusually hard.

Signed-off-by: Alain Zscheile <[email protected]>
@fogti
Copy link
Author

fogti commented Sep 5, 2022

and I now changed the usage from ${CMAKE_INSTALL_SYSCONFDIR} to ${CMAKE_INSTALL_FULL_SYSCONFDIR}, which should have the correct value.

@lxbsz
Copy link
Collaborator

lxbsz commented Sep 6, 2022

Install the project...
-- Install configuration: ""
-- Installing: /usr/lib64/libtcmu.so.2.2
-- Up-to-date: /usr/lib64/libtcmu.so.2
-- Up-to-date: /usr/lib64/libtcmu.so
-- Installing: /usr/bin/tcmu-runner
-- Set runtime path of "/usr/bin/tcmu-runner" to ""
-- Installing: /usr/lib64/tcmu-runner/handler_file_optical.so
-- Installing: /usr/lib64/tcmu-runner/handler_file_zbc.so
-- Installing: /usr/lib64/tcmu-runner/handler_rbd.so
-- Installing: /usr/lib64/tcmu-runner/handler_qcow.so
CMake Error at tcmu.conf_install.cmake:4 (install):
  install command is not scriptable
Call Stack (most recent call first):
  cmake_install.cmake:157 (include)


make: *** [Makefile:106: install] Error 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't hardcode absolute install prefixes
2 participants