KDE app does not install after 'make install'
Question
I have just started having a go at developing a small KDE app as a test for myself and I have had some problems fathoming how to use cmake which I have largely overcome. Currently my app builds ok (i.e. cmake && make run without errors). However running 'make install' gives the following error:
kemra102@kaon:~/projects/kquickformat/build> make install
[ 0%] Built target kquickformat_automoc
Scanning dependencies of target kquickformat
[ 50%] Building CXX object src/CMakeFiles/kquickformat.dir/kquickformat_automoc.o
Linking CXX executable kquickformat
[100%] Built target kquickformat
Linking CXX executable CMakeFiles/CMakeRelink.dir/kquickformat
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/bin/kquickformat
CMake Error at src/cmake_install.cmake:38 (FILE):
file INSTALL cannot copy file
"/home/kemra102/projects/kquickformat/build/src/CMakeFiles/CMakeRelink.dir/kquickformat"
to "/usr/local/bin/kquickformat".
Call Stack (most recent call first):
cmake_install.cmake:37 (INCLUDE)
make: *** [install] Error 1
Any ideas as nothing seems obvious to myself?
Solution
To install to default locations you usually need root privileges. So either use sudo make install
, or rerun cmake
specifying an installation prefix where you have write permission. For example, I use:
cmake -DCMAKE_INSTALL_PREFIX=$HOME/install/
If you do that, remember also to set all Qt and KDE related environment variables, otherwise the application you installed will not be working properly or at all. I usually call a shell function that does something like:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/install/lib
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$HOME/install/lib/pkgconfig
export KDEDIR=$HOME/install
export KDEDIRS=$KDEDIR
export XDG_DATA_DIRS=$XDG_DATA_DIRS:$HOME/install
export QT_PLUGIN_PATH=$QT_PLUGIN_PATH:$HOME/install/plugins
OTHER TIPS
Your user account does not (at least, should not) have write access to /usr/local/bin
. Try sudo make install
.