You are not logged in.

#1 2019-10-30 10:11:51

Registered: 2018-04-04
Posts: 11

[solved] pkgbuild cmake install cannot copy file

Ive ported my application from qmake to cmake. It works when I build and install locally.
But it does not work when I have updated it on the AUR...
It seems like the cmake install is not gaining root permissions?

My project repo:

Install the project...
-- Install configuration: ""
-- Installing: /usr/bin/audiobook
CMake Error at cmake_install.cmake:47 (file):
  file INSTALL cannot copy file
  to "/usr/bin/audiobook".

Last edited by DBAGibbz (2019-10-31 05:38:52)


#2 2019-10-30 11:50:42

From: Netherlands, Europe
Registered: 2005-10-04
Posts: 7,359

Re: [solved] pkgbuild cmake install cannot copy file

PKGBUILDs never have root rights, the real question is why cmake wants to write to /usr/bin at all .

Are you building with yay or makepkg ?
If yay, does makepkg report the same errror ?

please post outputs from a makepkg build with --log added .

Multi-init booting with apg Openrc and systemd coexisting
Automounting : not needed, i prefer pmount
Aur helpers : makepkg + my own local repo === rarely need them


#3 2019-10-30 12:51:10

Inspector Parrot
Registered: 2011-11-29
Posts: 22,272

Re: [solved] pkgbuild cmake install cannot copy file

The problem is in your CMakeLists.txt where you explicitly specify to install two files to the root filesystem rather than a relative path:

# Do platform specific post target stuff
    install(FILES res/io.bitshift.audiobook.desktop DESTINATION /usr/share/applications ) # /usr/share?
    install(FILES res/io.bitshift.audiobook.svg DESTINATION /usr/share/pixmaps ) # /usr/share?
Cmake docs wrote:


Specify the directory on disk to which a file will be installed. If a full path (with a leading slash or drive letter) is given it is used directly. If a relative path is given it is interpreted relative to the value of the CMAKE_INSTALL_PREFIX variable. The prefix can be relocated at install time using the DESTDIR mechanism explained in the CMAKE_INSTALL_PREFIX variable documentation.

EDIT: though this is also not the cause of this error, it would cause subsequent problems.  This error, I believe, is due to not passing DESTDIR to the make install command in the PKGBUILD.  You use INSTALL_ROOT, but I can't find this in the cmake docs (though I don't know much about cmake).

Last edited by Trilby (2019-10-30 12:54:54)

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman


#4 2019-10-31 05:38:38

Registered: 2018-04-04
Posts: 11

Re: [solved] pkgbuild cmake install cannot copy file

Okay thanks for the help!

I was thinking I needed to copy my files into these folders myself (hence needing root), however I realised that the package manager actually does that automatically!

Ive managed to get it working by specifying the DESTDIR="$pkgdir" and cleaning up the cmake file to relative paths.


Board footer

Powered by FluxBB