Compiling Elmer FEM using CMake under Ubuntu 20.04.1 LTS

Discussion about building and installing Elmer
Post Reply
kishpishar
Posts: 54
Joined: 17 Jun 2015, 10:04
Antispam: Yes

Compiling Elmer FEM using CMake under Ubuntu 20.04.1 LTS

Post by kishpishar »

Dear All,

I recently upgraded my OS to Ubuntu 20.04.1 LTS and was trying to compile Elmer (elmer-devel version) using the CMake procedure described below at the beginning of the thread:

viewtopic.php?f=2&t=3742

I used cmake-gui (exactly as suggested for Ubuntu 16.04) but ended up having errors at the configuration stage itself. The CMake cache message during the configuration stage:

The Fortran compiler identification is GNU 9.3.0
The C compiler identification is GNU 9.3.0
The CXX compiler identification is GNU 9.3.0
Check for working Fortran compiler: /usr/bin/f95
Check for working Fortran compiler: /usr/bin/f95 -- works
Detecting Fortran compiler ABI info
Detecting Fortran compiler ABI info - done
Checking whether /usr/bin/f95 supports Fortran 90
Checking whether /usr/bin/f95 supports Fortran 90 -- yes
Check for working C compiler: /usr/bin/cc
Check for working C compiler: /usr/bin/cc -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Detecting C compile features
Detecting C compile features - done
Check for working CXX compiler: /usr/bin/c++
Check for working CXX compiler: /usr/bin/c++ -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Checking whether GFortran version >= 4.8 -- yes
Found MPI_C: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so
Found MPI_CXX: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_cxx.so;/usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so
Found MPI_Fortran: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_usempif08.so;/usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_usempi_ignore_tkr.so;/usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_mpifh.so;/usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so
------------------------------------------------
Mesh adaptation 2D/3D looking for [Mmg] tools
Library not found: >MMG_FOUND<
Missing: >MMG_INCLUDE_DIR< , >MMG_LIBRARY<, to compile MMG3DSolver
------------------------------------------------
Looking for Fortran sgemm
Looking for Fortran sgemm - not found
Looking for pthread.h
Looking for pthread.h - found
Performing Test CMAKE_HAVE_LIBC_PTHREAD
Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
Looking for pthread_create in pthreads
Looking for pthread_create in pthreads - not found
Looking for pthread_create in pthread
Looking for pthread_create in pthread - found
Found Threads: TRUE
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find BLAS (missing: BLAS_LIBRARIES)
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.16/Modules/FindBLAS.cmake:810 (find_package_handle_standard_args)
CMakeLists.txt:361 (FIND_PACKAGE)


Configuring incomplete, errors occurred!
See also "/home/kumar/elmer/build/CMakeFiles/CMakeOutput.log".
See also "/home/kumar/elmer/build/CMakeFiles/CMakeError.log".

The other files CMakeOutput.log and CMakeError.log are attached below. Can anyone please help me to identify the problem? Thank you.

-kumar
Attachments
CMakeError.log
(3.81 KiB) Downloaded 308 times
CMakeOutput.log
(72.65 KiB) Downloaded 284 times
wmiller
Posts: 20
Joined: 09 May 2017, 18:05
Antispam: Yes

Re: Compiling Elmer FEM using CMake under Ubuntu 20.04.1 LTS

Post by wmiller »

check if you have installed the developer version of BLAS .

Only then there will be a link from libblas.so to the recent version.
The search function of CMAKE will only find libraries without version extension, i.e. libblas.so.3 would not be found and give an error

Wolfram Miller
kishpishar
Posts: 54
Joined: 17 Jun 2015, 10:04
Antispam: Yes

Re: Compiling Elmer FEM using CMake under Ubuntu 20.04.1 LTS

Post by kishpishar »

Hi Wolfram,

Thanks for your reply. I just did a fresh install of Ubuntu 20.04.1 yesterday on a new hard drive and I haven't installed BLAS separately. I thought that it is included in the mathlibs directory.

So do I need to install BLAS before proceeding with CMake? Can the developer version be installed using the usual sudo apt-get install .. method?

Silly questions indeed, but sorry I'm not familiar with CMake process. Thanks again,

-Kumar
wing
Posts: 11
Joined: 14 Oct 2009, 11:49

Re: Compiling Elmer FEM using CMake under Ubuntu 20.04.1 LTS

Post by wing »

Hi Kumar,

You have to install required libraries and header files before you can build Elmer.
sudo apt-get install libblas-dev will do the job for you. But for your Ubuntu is a fresh installation you may have to repeat the try and error process because there could be more packages to install. Actually Cmake is a good build system in my opinion.

Good luck.

Wing
kishpishar
Posts: 54
Joined: 17 Jun 2015, 10:04
Antispam: Yes

Re: Compiling Elmer FEM using CMake under Ubuntu 20.04.1 LTS

Post by kishpishar »

Thank you, Wing. All I had to do was to install libblas-dev and liblapack-dev before I started Cmake build and then it worked like a charm. If it is a fresh Ubuntu installation, the gnu compilers for fortran, C, C++ and the mpi versions need to be installed but I had installed OpenFOAM before the Elmer installation so the compilers were already there and Cmake didn't have any issues in finding them.

Kumar
npinhao
Posts: 3
Joined: 12 Feb 2017, 14:59
Antispam: Yes
Location: Lisbon

Re: Compiling Elmer FEM using CMake under Ubuntu 20.04.1 LTS

Post by npinhao »

I have try to compile Elmer under Kubuntu 20.04, following the instructions in the README.adoc file and found the following error:
...
-- Package filename: elmerfem-8.4-6b277101-20200825_Linux-x86_64
-- Patch version: 8.4-6b277101
-- Configuring done
CMake Error at cmake/Modules/AddModules.cmake:27 (ADD_LIBRARY):
No SOURCES given to target: CMakeFiles
Call Stack (most recent call first):
cmake/Modules/AddModules.cmake:64 (ADD_ELMER_MODULE)
fem/src/modules/CMakeLists.txt:5 (ADD_ELMER_MODULES)

If I understand well the configuration went well but the makefile is not built. Any suggestions?

Also the README.adoc file could be improved if the lines in blue are moved to the Compiling: section as they apply to any OS and not just to macOS

=== Compiling:


==== macOS:

* download this repository either az a zip file via GitHub or using `git clone https://github.com/ElmerCSC/elmerfem.git`
* go to the downloaded directory `mkdir build` and `cd build`

* Install HomeBrew
...
Post Reply