log4cplus file cannot create directory administrative privileges

2.2k Views Asked by At

I am trying to install Log4Cplus using Cmake.

First I downloaded log4cplus into a directory called 3rdparty

git clone https://github.com/log4cplus/log4cplus.git --recursive

Later in the common CMakeLists.txt I did the following

cmake_minimum_required (VERSION 3.4)
enable_testing()
include(USR_macros_and_functions.cmake)

project (unixpackages)
USR_init_project(unixpackages)
#other packages ...
add_subdirectory(3rdParty/log4cplus)
 #other packages ...
USR_add_build_repo_targets()

The problem is that when I try build I get the following error:

-- Installing: /home/compilation/UnixPackagesFareShopping/Output_API/Lib/libvalidator.so
-- Removed runtime path from "/home/compilation/UnixPackagesFareShopping/Output_API/Lib/libvalidator.so"
CMake Error at 3rdParty/log4cplus/src/cmake_install.cmake:36 (file):
  file cannot create directory: /usr/local/lib64/cmake/log4cplus.  Maybe need
  administrative privileges.
Call Stack (most recent call first):
  3rdParty/log4cplus/cmake_install.cmake:37 (include)
  cmake_install.cmake:48 (include)

I understand that I don't have the right to install it into /usr/local/lib64/cmake/ but the problem is that i don't know where I should change the path to point it to a directory where I have the rights to install it into.

I tried looking to see if i can find lib64 in all the configue and cmake files I only found this

./configure:  # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,
./configure:  # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,
./m4/libtool.m4:  # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,

I am new to cmake so sorry for the question

1

There are 1 best solutions below

0
Kevin On

As commented, you can adjust the installation location using CMake, just use the CMAKE_INSTALL_PREFIX variable (see answers to this question). You can set this variable to somewhere you have access to, so the software is eventually installed in that location instead.

You can set the CMAKE_INSTALL_PREFIX variable on the command line when calling cmake, or in the CMake file itself before any calls to project, as you have done:

set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/3rdParty/log4cplusclea)