make install failed on linux

Discussion about building and installing Elmer
Post Reply
spacedout
Posts: 177
Joined: 30 Mar 2020, 23:27
Antispam: Yes

make install failed on linux

Post by spacedout »

In the elmer folder, I first downloaded the latest elmerfem in branch devel using GitHub

Then, I typed the commands

mkdir install
mkdir build
cd build

cmake -DWITH_ELMERGUI:BOOL=FALSE -DWITH_OpenMP:BOOL=TRUE -DWITH_MPI:BOOL=TRUE -DCMAKE_INSTALL_PREFIX= ../install ../elmerfem

up to now everything is OK. Next,

make install

ends with:

Install the project...
-- Install configuration: "RelWithDebInfo"
CMake Error at matc/src/cmake_install.cmake:52 (file):
file cannot create directory: /lib/elmersolver. Maybe need administrative
privileges.
Call Stack (most recent call first):
matc/cmake_install.cmake:47 (include)
cmake_install.cmake:47 (include)


make: *** [Makefile:130: install] Error 1


So the install folder remains empty. Quite mysterious to me.
kevinarden
Posts: 2315
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: make install failed on linux

Post by kevinarden »

can you go inside the install folder and do

mkdir /lib/elmersolver
spacedout
Posts: 177
Joined: 30 Mar 2020, 23:27
Antispam: Yes

Re: make install failed on linux

Post by spacedout »

No can do. Yields same error. Now I discovered that the servers I was allotted some disk space on already have some older installations of Elmer.
I am seriously beginning to consider the possibility that the server setup thinks I am trying to install Elmer on their own disk space which no regular customer like me has any administrative rights to write on. Do you think I should contact them about this problem ?
kevinarden
Posts: 2315
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: make install failed on linux

Post by kevinarden »

You need a location you have write privilege to, or have admin privs.
You can choose any location to install Elmer in, but you have to be able to create directories and files in that location.
spacedout
Posts: 177
Joined: 30 Mar 2020, 23:27
Antispam: Yes

Re: make install failed on linux

Post by spacedout »

Well of course I have access to own workspace where i successfully executed mkdir install and other subfolders. The question is why the command

make install

ignores those valid subfolders and instead points to places on the disk where it has no business to go to.
kevinarden
Posts: 2315
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: make install failed on linux

Post by kevinarden »

you said you can't do this when you go inside the install folder and do

mkdir /lib/elmersolver

the command is just trying to do the same thing

so you need to solve why you can't create /lib/elmersolver inside the install folder

if you go one level above the install folder and do a
ls -l
what do you see?
spacedout
Posts: 177
Joined: 30 Mar 2020, 23:27
Antispam: Yes

Re: make install failed on linux

Post by spacedout »

With ls -l, I see folders

build
install
elmerfem

and I have rights rwx for each

next if I do

cd install
mkdir lib
cd lib
mkdir elmersolver

there is no problem. They are all created.
Are you telling me that the command

make install

is trying to do the same thing ?

Now you look at the error printout I reported earlier:
...

CMake Error at matc/src/cmake_install.cmake:52 (file):
file cannot create directory: /lib/elmersolver.
....

This is obvious. It cannot create something that does not belong to my path ( my path is /home/belm/elmer )

I believe the explanation lies in the following:

If you look at the start of file matc/src/cmake_install.cmake

# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "")
endif()

I bet it sets the prefix to ""

so that later in the same file at line 52:

file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/elmersolver" TYPE SHARED_LIBRARY FILES "/home/belm/elmer/build/matc/src/libmatc.so")

it erroneously points to /lib/elmersolver instead of /home/belm/elmer/lib/elmersolver


So the question is why the prefix is undefined when

matc/src/cmake_install.cmake

is called

The answer probably lies in my .bash_profile. Perhaps you know what I should export as environment variables but at any rate I will experiment with a few settings and get back to you soon
kevinarden
Posts: 2315
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: make install failed on linux

Post by kevinarden »

it is supposed to relative that is what ../install means
-DCMAKE_INSTALL_PREFIX= ../install ../elmerfem
the ../install means go up one directory from my current one, since I am in build when I do make install
spacedout
Posts: 177
Joined: 30 Mar 2020, 23:27
Antispam: Yes

Re: make install failed on linux

Post by spacedout »

This is so silly.

I simply deleted the space between -DCMAKE_INSTALL_PREFIX= and ../install in the config command

cmake -DWITH_ELMERGUI:BOOL=FALSE -DWITH_OpenMP:BOOL=TRUE -DWITH_MPI:BOOL=TRUE -DCMAKE_INSTALL_PREFIX= ../install ../elmerfem

and now the subsequent

make install

works perfectly! The install folder contains everything that is required for proper operation.
raback
Site Admin
Posts: 4832
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: make install failed on linux

Post by raback »

Hi,

I must say that for a tiny detail like this the complaint of cmake was not very helpful. Not easy to catch. Great that you found the issue!

-Peter
Post Reply