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

make install attempts to write to /etc regardless of specified destination directory #524

Open
xiota opened this issue Jun 7, 2023 · 2 comments

Comments

@xiota
Copy link

xiota commented Jun 7, 2023

Describe the bug

After successfully downloading and building the 4.2.0 source tarball, attempting to install with either make install or cmake --install produces errors.

  • Errors differ depending on which command is run.
  • I am setting DESTDIR to redirect output to a specified directory for packaging.
  • Building with make or cmake --build build does not seem to make a difference.
  • A few weeks ago, with a pre-4.2.0 git checkout (1c49926), make install was able to run, but produced the same error as running cmake --install from the tarball. A recent git checkout (cb176c3) has the same behavior.

To Reproduce

$ cmake -B build -S "hal-4.2.0" \
    -D CMAKE_BUILD_TYPE=Release \
    -D CMAKE_INSTALL_PREFIX='/usr'
...

$ cmake --build build
...

$ pkgdir="$PWD/pkg"
$ mkdir -p "$pkgdir"

$ make DESTDIR="$pkgdir" install

make: *** No rule to make target 'install'.  Stop.

$ DESTDIR="$pkgdir" cmake --install build
...

-- Copy file /usr/share/hal/ld_conf/hal.conf to /etc/ld.so.conf.d/
Error copying file "hal.conf" to "/etc/ld.so.conf.d/".
-- Running: ldconfig
ldconfig: Can't create temporary cache file /etc/ld.so.cache~: Permission denied
CMake Warning at build/post_install.cmake:11 (message):
  ldconfig failed
Call Stack (most recent call first):
  build/cmake_install.cmake:147 (include)

...

Expected behavior

  • Files should be installed to DESTDIR without error.
  • Files should not (attempt to) be installed outside of DESTDIR.
  • make and cmake --install should behave the same.
@xiota
Copy link
Author

xiota commented Jun 8, 2023

make install with git checkout (cb176c3) does not have the same error as when trying to install from the 4.2.0 tarball. However, it does have the same error message as cmake --install from the tarball. I found old logs, and the same error did occur previously (pre-4.2.0 git 1c49926).

-- Copy file /usr/share/hal/ld_conf/hal.conf to /etc/ld.so.conf.d/
Error copying file "hal.conf" to "/etc/ld.so.conf.d/".
-- Running: ldconfig
ldconfig: Can't create temporary cache file /etc/ld.so.cache~: Permission denied
CMake Warning at build/post_install.cmake:11 (message):
  ldconfig failed
Call Stack (most recent call first):
  build/cmake_install.cmake:147 (include)

@RenWal RenWal changed the title Cannot install from 4.2.0 source tarball make install attempts to write to /etc regardless of specified destination directory Jun 8, 2023
@xiota
Copy link
Author

xiota commented Jun 13, 2023

I believe the problem may be:

execute_process(COMMAND ${CMAKE_COMMAND} -E copy hal.conf /etc/ld.so.conf.d/)

Perhaps changing the line to the following would fix it:

 execute_process(COMMAND ${CMAKE_COMMAND} -E copy hal.conf "$ENV{DESTDIR}/etc/ld.so.conf.d/") 

I have not tested the change because of the length of time building takes.

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

No branches or pull requests

1 participant