Install Simple-2.5 (therefore cmake-3.8 and gcc-4.9.2) on Cent OS 7

One could imagine to install a program called Simple should be simple. And I don’t doubt it, if you have exactly the system requirements that you can find described here. Maybe I need to read more papers, but it is definitely not so simple. Let’s go through it.

Single-particle IMage Processing Linux Engine can be downloaded here after filling up the corresponding information. Once I have it unzipped and in the location of choice, it’s time to check the requirements.  First, since I’m a busy man, I try “directly”:

/usr/local/simple2.5/build ## > cmake ../
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
 CMake 3.2 or higher is required. 
You are running version 2.8.12.2
-- Configuring incomplete, errors occurred!

I’m tempted to edit the function mentioned and force the program to compile. But since that is usually my last resource, I will go for an update of cmake first. My default cmake behavior is:

cmake --version
cmake version 2.8.12.2
which cmake
/bin/cmake

And that will be the goal of my installation. I download a conservative version from cmake.org and place it on the desired location. Then I follow more or less the nice HOWTO found on Xinyustudio blog: that is, untar,  ./bootstrap, gmake. At the end, instead of adding it to our bashrc or similar, I make a module. My module looks like:

#%Module1.0#######################################
## modules cmake-3.8.2
## modulefiles/cmake-3.8.2. Sample gcc module
##
proc ModulesHelp { } {
 global version modroot
puts stderr "cmake-3.8.2 - set cmake 3.8.2 "
}
module-whatis "Sets the environment for using cmake-3.8.2"
# for Tcl script use only
set topdir /usr/local/cmake-3.8.2
set version 3.8.2
set sys linux86
setenv CMAKE_V "3.8.2"
prepend-path PATH $topdir/bin
prepend-path MANPATH $topdir/man
prepend-path LD_LIBRARY_PATH $topdir/lib

And when I load it, I get what I want:

 > module load cmake-3.8.2 
 > cmake --version
cmake version 3.8.2
CMake suite maintained and supported by Kitware 
(kitware.com/cmake).
 > which cmake
/usr/local/cmake-3.8.2/bin/cmake

Let’s go ahead, load the module and compile simple.

/usr/local/simple2.5 ## > cd build/
/usr/local/simple2.5/build ## > module load cmake-3.8.2 
/usr/local/simple2.5/build ## > cmake ../
-- The Fortran compiler identification is GNU 4.8.5
-- The C compiler identification is GNU 4.8.5
...
CMake Error at cmake/SimpleFortranOptions.cmake:146 (message):
 SIMPLE requires gfortran 4.9 to 5.4

We need another gfortran also. I follow what we found on github, then I try to make a module that should overwrite the default gcc. But it doesn’t seem somehow to work, or I don’t manage to install it properly. When I type gcc –version or similar, I still get

gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11)

So how can we get it? By enabling devtoolsets. As it is written on the post, we do:

yum install centos-release-scl-rh
yum install devtoolset-3-gcc devtoolset-3-gcc-c++  
yum install devtoolset-3-gcc-gfortran
scl enable devtoolset-3 bash
gcc --version
gcc (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6)
gfortran --version
GNU Fortran (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6

We got it! Now back to “simple”! I open a new shell,  load my module, load my devtoolset  (note that the order is important) and try to cmake it… without success. This seems to be because of the already partially compiled code. The fix is simple (JA JA): we remove the folder, unzip the program anew and place it again where the other was. So, once everything is in place, from the beginning:

module load cmake-3.8.2 
scl enable devtoolset-3 bash
tar -xvzf simple2.5.tgz 
mkdir build
cd build/
cmake ../
-- The Fortran compiler identification is GNU 4.9.2
-- The C compiler identification is GNU 4.9.2
... a lot of things going on here...
-- Configuring done
-- Generating done
-- Build files have been written to:
/usr/local/simple2.5/build
make -j install
Scanning dependencies of target simple_args
[ 0%] Built target simple_args
Scanning dependencies of target SIMPLE2.5
[ 0%] Building Fortran object ...
... a lot of building going on  here, 
....we skip them and go to the final message...
Installation complete.
=============================================
Please ensure the following variables are set 
properly in add2.*rc file: 
 SIMPLE_EMAIL SIMPLE_QSYS SIMPLE_PATH SIMPLE_SOURCE_PATH 
To use SIMPLE, append the relevant add2.* 
to your HOME shell rc file: 
 bash$ cat add2.bashrc >> ~/.bashrc 
 tcsh$ cat add2.tcshrc >> ~/.tcshrc 
==============================================
For minimal installation to work correctly add:
/usr/local/simple2.5/build/bin and
/usr/local/simple2.5/build/scripts
 to your PATH environment variable.
==============================================

Now we write a module for it, that looks like this:

%Module1.0####################################
##
## modules simple-2.5
##
## modulefiles/simple-2.5. Sample gcc module
##
proc ModulesHelp { } {
 global version modroot
puts stderr "simple-2.5 - sets simple 2.5"
}
module-whatis "Sets the environment for using simple-2.5 "
# for Tcl script use only
set topdir /usr/local/simple2.5 
set version 2.5
set sys linux86
setenv SIMPLE_V "2.5"
prepend-path PATH $topdir/build/scripts/
prepend-path PATH $topdir/build/bin/
prepend-path MANPATH $topdir/man
prepend-path LD_LIBRARY_PATH $topdir/lib

Or something on that line. Be careful with the paths, since they are tricky. As an user, I load the module and I run simple_test_install. And it works. We’ll see if I see any results from the users…

 

Advertisements

About bitsanddragons

A traveller, an IT professional and a casual writer
This entry was posted in bits, centos, linux. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s