9

I am trying to install CLHEP 2.3.4.4 and I am stuck, getting an error in make install:

[ 99%] Built target exctest3 
[ 99%] Built target exctestNothrow
[100%] Built target testzmex
Install the project...
-- Install configuration: "RelWithDebInfo"
-- Installing: /usr/local/bin/clhep-config
CMake Error at cmake_install.cmake:36 (file):
  file INSTALL cannot copy file
  "/home/ivan/CLHEP/2.3.4.4/CLHEP/2.3.4.4-build/clhep-config" to
  "/usr/local/bin/clhep-config".
Makefile:105: recipe for target 'install' failed
make: *** [install] Error 1

What can I do to fix this?

2 Answers 2

10

Try sudo make install.

To access the /usr directory of your installation to store system-wide files there, the installer needs root privileges. Therefore you can not just run plain make install as your normal user account but need to use sudo to elevate privileges.

3
  • What if I don't want root privileges and only want to compile for the current user?
    – User Rebo
    Dec 19, 2020 at 11:52
  • @UserRebo Maybe you can try this.
    – karim
    Feb 10, 2022 at 7:12
  • try sudo make install where??? Apr 5, 2023 at 7:35
2

If want to install without root / sudo try DCMAKE_INSTALL_PREFIX option:

mkdir -p $HOME/opt
cmake -DCMAKE_INSTALL_PREFIX=$HOME/opt .
make
make install

Consider adding folder to PATH, in order to use it by name only

export PATH="$HOME/opt/bin:$PATH" # for binaries
export LD_LIBRARY_PATH="$HOME/opt/lib:$LD_LIBRARY_PATH" # for libs
export CPATH="$HOME/opt/include:$CPATH" # for includes

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .