Page 3 of 6

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Posted: 09 Feb 2015, 20:53
by urb4nm
Hey Anil,
I also have 4.8.2 version (4.8.2-15 Red Hat).

Regards
Michal Urbanski

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Posted: 09 Feb 2015, 21:21
by annier
Hi Michal,
In reference to the message for your context,

Code: Select all

libelmersolver.so: undefined reference to `_gfortran_execute_command_line_i4'
,
the possible workout may be the "things related to gfortran compiling for the fortran module(s) of elmer".

Can you list out the location of:
-elmerfem(source) directory.
-elmer build directory and the Cmake fortran module directory.
-elmer installation directory?
The use of Cmake-gui can help you easily find all these locations in its screen.


Yours
Anil Kunwar

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Posted: 09 Feb 2015, 23:37
by urb4nm
Hey Anil,

Thank you for your help, here you go:

Elmer src:

Code: Select all

/home/murbanski/elmerfem-code_new/elmerfem
[murbanski@rs elmerfem]$ ls -al
total 120
drwxr-xr-x. 25 root root  4096 Feb  9 15:39 .
drwxr-xr-x.  4 root root  4096 Feb  9 15:39 ..
drwxr-xr-x.  3 root root  4096 Feb  9 15:39 buildtools
drwxr-xr-x.  4 root root  4096 Feb  9 15:39 cmake
-rw-r--r--.  1 root root 10308 Feb  9 15:39 CMakeLists.txt
drwxr-xr-x.  2 root root  4096 Feb  9 15:39 cpack
drwxr-xr-x.  4 root root  4096 Feb  9 15:39 eio
drwxr-xr-x.  6 root root  4096 Feb  9 15:39 elmergrid
drwxr-xr-x. 10 root root  4096 Feb  9 15:39 ElmerGUI
drwxr-xr-x.  5 root root  4096 Feb  9 15:39 ElmerGUIlogger
drwxr-xr-x.  5 root root  4096 Feb  9 15:39 ElmerGUItester
drwxr-xr-x.  9 root root  4096 Feb  9 15:39 elmerice
drwxr-xr-x.  4 root root  4096 Feb  9 15:39 elmerparam
drwxr-xr-x.  7 root root  4096 Feb  9 15:39 fem
drwxr-xr-x.  6 root root  4096 Feb  9 15:39 fhutiter
drwxr-xr-x.  6 root root  4096 Feb  9 15:39 front
drwxr-xr-x.  8 root root  4096 Feb  9 15:39 .git
-rw-r--r--.  1 root root    18 Feb  9 15:39 .gitignore
drwxr-xr-x.  6 root root  4096 Feb  9 15:39 hutiter
drwxr-xr-x.  2 root root  4096 Feb  9 15:39 license_texts
drwxr-xr-x.  4 root root  4096 Feb  9 15:39 matc
drwxr-xr-x.  4 root root  4096 Feb  9 15:39 mathlibs
drwxr-xr-x.  4 root root  4096 Feb  9 15:39 meshgen2d
drwxr-xr-x.  7 root root  4096 Feb  9 15:39 misc
drwxr-xr-x.  7 root root  4096 Feb  9 15:39 post
-rw-r--r--.  1 root root  1404 Feb  9 15:39 README.txt
drwxr-xr-x.  5 root root  4096 Feb  9 15:39 umfpack
drwxr-xr-x.  3 root root  4096 Feb  9 15:39 utils
Elmer build:

Code: Select all

/home/murbanski/elmerfem-code_new/build
[murbanski@rs build]$ ls -al
total 204
drwxr-xr-x. 12 root root  4096 Feb  9 17:01 .
drwxr-xr-x.  4 root root  4096 Feb  9 15:39 ..
-rw-r--r--.  1 root root 35953 Feb  9 15:40 CMakeCache.txt
drwxr-xr-x.  6 root root  4096 Feb  9 18:06 CMakeFiles
-rw-r--r--.  1 root root  2413 Feb  9 15:40 cmake_install.cmake
-rw-r--r--.  1 root root  3715 Feb  9 15:40 CPackConfig.cmake
-rw-r--r--.  1 root root  4128 Feb  9 15:40 CPackSourceConfig.cmake
-rw-r--r--.  1 root root   435 Feb  9 15:40 CTestTestfile.cmake
drwxr-xr-x.  4 root root  4096 Feb  9 17:01 elmergrid
-rw-r--r--.  1 root root   624 Feb  9 15:58 error.log
drwxr-xr-x.  5 root root  4096 Feb  9 17:01 fem
drwxr-xr-x.  4 root root  4096 Feb  9 17:01 fhutiter
drwxr-xr-x.  2 root root  4096 Feb  9 18:06 fmodules
drwxr-xr-x.  3 root root  4096 Feb  9 17:01 license_texts
-rw-r--r--.  1 root root 95215 Feb  9 17:01 Makefile
drwxr-xr-x.  4 root root  4096 Feb  9 17:01 matc
drwxr-xr-x.  4 root root  4096 Feb  9 17:01 mathlibs
drwxr-xr-x.  4 root root  4096 Feb  9 17:01 meshgen2d
drwxr-xr-x.  4 root root  4096 Feb  9 17:01 umfpack
Cmake fortran module directory:

Code: Select all

/home/murbanski/elmerfem-code_new/build/fmodules
[murbanski@rs fmodules]$ ls -al
total 8
drwxr-xr-x.  2 root root 4096 Feb  9 18:06 .
drwxr-xr-x. 12 root root 4096 Feb  9 17:01 ..
Elmer installation directory:

Code: Select all

/opt/elmer_wave
[murbanski@rs elmer_wave]$ ls -al
total 8
drwxr-xr-x.  2 root root 4096 Feb  9 15:03 .
drwxr-xr-x. 10 root root 4096 Feb  9 15:03 ..
I am not using Cmake-gui, as right now I have only non-gui ssh access to target computer.

Regards
Michal Urbanski

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Posted: 10 Feb 2015, 07:10
by annier
Hi Michal,
Can you once try changing the installation prefix path from:

Code: Select all

#cmake -DWITH_ELMERGUI:BOOL=FALSE -DWITH_MPI:BOOL=FALSE -DCMAKE_INSTALL_PREFIX=/opt/elmer_wave/ ../elmerfem
to

Code: Select all

#cmake -DWITH_ELMERGUI:BOOL=FALSE -DWITH_MPI:BOOL=FALSE -DCMAKE_INSTALL_PREFIX=/usr/local  ../elmerfem
?


Yours
Anil Kunwar

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Posted: 10 Feb 2015, 08:36
by urb4nm
Hey Anil,

I have changed installation path to '/usr/local', unfortunately the error persisted:

Code: Select all

Linking Fortran shared library libelmersolver.so
[ 74%] Built target elmersolver
[ 74%] Generating GebhardtFactors.F90
Scanning dependencies of target GebhardtFactors
[ 75%] Building Fortran object fem/src/CMakeFiles/GebhardtFactors.dir/GebhardtFactors.F90.o
Linking Fortran executable GebhardtFactors
libelmersolver.so: undefined reference to `_gfortran_execute_command_line_i4'
collect2: error: ld returned 1 exit status
fem/src/CMakeFiles/GebhardtFactors.dir/build.make:108: recipe for target 'fem/src/GebhardtFactors' failed
make[2]: *** [fem/src/GebhardtFactors] Error 1
CMakeFiles/Makefile2:590: recipe for target 'fem/src/CMakeFiles/GebhardtFactors.dir/all' failed
make[1]: *** [fem/src/CMakeFiles/GebhardtFactors.dir/all] Error 2
Makefile:146: recipe for target 'all' failed
Regards
Michal Urbanski

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Posted: 10 Feb 2015, 13:04
by annier
Hi Michal,
This is the configuration and generation log (obtained via cmake-gui) for my context:

Code: Select all

The Fortran compiler identification is GNU
The C compiler identification is GNU 4.8.2
The CXX compiler identification is GNU 4.8.2
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
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
Found MPI_C: /usr/lib/libmpi.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libhwloc.so  
Found MPI_CXX: /usr/lib/libmpi_cxx.so;/usr/lib/libmpi.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libhwloc.so  
Found MPI_Fortran: /usr/lib/libmpi_f90.so;/usr/lib/libmpi_f77.so;/usr/lib/libmpi.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libhwloc.so  
Looking for Fortran sgemm
Looking for Fortran sgemm - found
Looking for include file pthread.h
Looking for include file pthread.h - found
Looking for pthread_create
Looking for pthread_create - not found
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  
A library with BLAS API found.
A library with BLAS API found.
Looking for Fortran cheev
Looking for Fortran cheev - found
A library with LAPACK API found.
Checking whether /usr/bin/f95 supports CONTIGUOUS
Checking whether /usr/bin/f95 supports CONTIGUOUS -- yes
Checking whether /usr/bin/f95 supports EXECUTE_COMMAND_LINE
Checking whether /usr/bin/f95 supports EXECUTE_COMMAND_LINE -- yes
Looking for include file inttypes.h
Looking for include file inttypes.h - found
Looking for sys/types.h
Looking for sys/types.h - found
Looking for stdint.h
Looking for stdint.h - found
Looking for stddef.h
Looking for stddef.h - found
Check size of long
Check size of long - done
------------------------------------------------
  BLAS library:   /usr/lib/libblas.so
  LAPACK library: /usr/lib/liblapack.so;/usr/lib/libblas.so
------------------------------------------------
  Fortran compiler:        /usr/bin/f95
  Fortran flags:           
------------------------------------------------
  C compiler:              /usr/bin/cc
  C flags:                 
------------------------------------------------
  MPI Fortran:             TRUE
  MPI Fortran compiler:    /usr/bin/mpif90
  MPI Fortran flags:       
  MPI Fortran include dir: /usr/lib/openmpi/include;/usr/lib/openmpi/lib
  MPI Fortran libraries:   /usr/lib/libmpi_f90.so;/usr/lib/libmpi_f77.so;/usr/lib/libmpi.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libhwloc.so
  MPI Fortran link flags:  
------------------------------------------------
  MPI C:             TRUE
  MPI C compiler:    /usr/bin/mpicc
  MPI C flags:       
  MPI C include dir: /usr/lib/openmpi/include;/usr/lib/openmpi/include/openmpi
  MPI C libraries:   /usr/lib/libmpi.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libhwloc.so
  MPI C flags:       
------------------------------------------------
------------------------------------------------
  Package filename: elmerfem-7.0-f9436c7-20150210_Linux-x86_64 
  Patch version: 7.0-f9436c7 
Configuring done
Generating done
Some remarks after i compared this log with yours:
1. I don't see mpi related comments on your configuration and generation log. have you installed openmpi in your machine? If you haven't installed it, you need to install it. If you have installed it, Cmake hasn't found its path. So, it is necessary to give additional cmake prefix path for openmpi in the cmake configure and generate command to locate the openmpi path as:

Code: Select all

#cmake -DWITH_ELMERGUI:BOOL=FALSE \
 -DWITH_MPI:BOOL=FALSE  \
 -DCMAKE_PREFIX_PATH=<path_to_openmpi_installation>  \
 -DCMAKE_INSTALL_PREFIX=/opt/elmer_wave/  ../elmerfem
2. Although i don't know what effects it can make, the cmake finds BLAS and LAPACK libraries in /usr/lib/ in my context whereas it finds these libraries in /usr/lib64/ in your context. The matters somehow related to lib64 (however not under Cmake installation) are discussed in this thread.

Yours
Anil Kunwar

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Posted: 10 Feb 2015, 14:44
by kataja
Hi all,

thanks to david_coe for those patches. There is a rudimentary cmake build script for ElmerClips also.

I tried compiling elmer on a centos 6.2 virtual machine and the following proved succesful
  • Install at least gfortran-4.8, gcc-4.8 and binutils from Tru Huynh's devtoolset-2 (http://people.centos.org/tru/devtools-2/, see the readme file for details)
  • Start a devtoolset-2 enabled bash session:

    Code: Select all

    scl register /opt/rh/devtoolset-2
    scl enable devtoolset-2 bash
    
  • Navigate to build dir and execute

    Code: Select all

    FC=$(which gfortran) cmake -DWITH_MPI=FALSE <path-to-elmer-source>
    make
    
I hope this helps!

Cheers,
Juhani

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Posted: 10 Feb 2015, 16:04
by xborras7
Hej!

I tried what you suggested:

[root@CE-CLYX01 build]# cmake -DWITH_ELMERGUI:BOOL=FALSE -DWITH_MPI:BOOL=FALSE -DCMAKE_INSTALL_PREFIX=/opt/Elmer_cmake_1 ../elmerfem


The message I got:

Code: Select all

-- A library with BLAS API found.
-- A library with BLAS API found.
-- A library with LAPACK API found.
-- Checking whether /usr/bin/f95 supports CONTIGUOUS
-- Checking whether /usr/bin/f95 supports CONTIGUOUS -- no
-- Checking whether /usr/bin/f95 supports EXECUTE_COMMAND_LINE
-- Checking whether /usr/bin/f95 supports EXECUTE_COMMAND_LINE -- no
-- ------------------------------------------------
--   BLAS library:   /usr/lib64/libblas.so
--   LAPACK library: /usr/lib64/liblapack.so;/usr/lib64/libblas.so
-- ------------------------------------------------
--   Fortran compiler:        /usr/bin/f95
--   Fortran flags:           
-- ------------------------------------------------
--   C compiler:              /usr/bin/cc
--   C flags:                 
-- ------------------------------------------------
--   Fortran compiler:  /usr/bin/f95
-- ------------------------------------------------
--   C compiler:        /usr/bin/cc
-- ------------------------------------------------
--   C++ compiler:      /usr/bin/c++
-- ------------------------------------------------
-- ------------------------------------------------
--   Package filename: elmerfem-7.0-d1c250a-20150209_Linux-x86_64 
--   Patch version: 7.0-d1c250a 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/xavier/Downloads/Software/Elmer_CMAKE/build
I am also using the devstoolset-2:
$ scl enable devtoolset-2 bash

So I have the following GCC version:
$ gcc -v

Code: Select all

[root@CE-CLYX01 build]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/opt/rh/devtoolset-2/root/usr --mandir=/opt/rh/devtoolset-2/root/usr/share/man --infodir=/opt/rh/devtoolset-2/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/dev/shm/home/centos/rpm/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/isl-install --with-cloog=/dev/shm/home/centos/rpm/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/cloog-install --with-mpc=/dev/shm/home/centos/rpm/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/mpc-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC) 
I already tried:
1) Installing mpi and mpidev
2) Using cmake-GUI (see snaps attached)
3) [root@CE-CLYX01 build]# cmake -DWITH_ELMERGUI:BOOL=FALSE -DWITH_MPI:BOOL=FALSE -DCMAKE_INSTALL_PREFIX=/usr/local ../elmerfem
4) [root@CE-CLYX01 build]# cmake -DWITH_ELMERGUI:BOOL=FALSE -DWITH_MPI:BOOL=FALSE -DCMAKE_INSTALL_PREFIX=../install ../elmerfem

I am having the same error. Nothing changed. I do not know what else I can try.

Any new idea? Thanks in advance,

/Xavier

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Posted: 10 Feb 2015, 16:13
by kataja
Cmake seems to detect /usr/bin/f95 as fortran compiler. Try

Code: Select all

$ export FC=gfortran
$ export CC=gcc
$ cmake -DWITH_ELMERGUI:BOOL=FALSE -DWITH_MPI:BOOL=FALSE -DCMAKE_INSTALL_PREFIX=../install ../elmerfem
Also, you should run that cmake command in a clean build directory.

Note that "FC=gfortran" at the beginning of the command.

-Juhani

Re: Installing Elmer in Ubuntu 14.04 using Cmake

Posted: 10 Feb 2015, 16:33
by urb4nm
Dear Juhani,

It seems, that in my case "FC=$(which gfortran)" export did the trick. It now compiles an runs flawlessly.

Thank you Anil for your help, it did solve some problems of mine.

Regards
Michal Urbanski