Scons will not recognize Sundials libraries for installation on RHEL 5

166 views
Skip to first unread message

Shane Hesprich

unread,
Jul 12, 2016, 4:59:55 PM7/12/16
to Cantera Users' Group
I had an individual ask if I could install a Cantera on a computing cluster running RHEL 5.6. He is currently using Cantera 2.1.1 on his laptop and wanted the same version on the cluster. I installed sundials 2.4.0 using

./configure CFLAGS=-fPIC --prefix=xxx/sundials-2.4.0 \ 
--with-blas=xxx/libblas.so.3 --with-lapcak=xxx/liblapack.so.3

followed by make and sudo make install.
No errors.

I am attempting to install cantera using the following script I wrote myself

#!/bin/bash

SUNDIALSHOME='/groups/hpc-share/sundials/sundials-2.4.0'

echo "listing inside sundials home"
ls $SUNDIALSHOME
echo "listing inside sundials include"
ls $SUNDIALSHOME/include
echo "listing inside sundials lib"
ls $SUNDIALSHOME/lib


scons build prefix='/exports/apps/cantera/2.1.1' \
python_package='new' \
python_cmd='/exports/apps/anaconda/1.7/bin/python' \
python_prefix='/exports/apps/anaconda/1.7/pkgs/' \
python3_package='n' \
use_sundials='y' \
sundials_include="$SUNDIALSHOME/include/" \
sundials_libdir="$SUNDIALSHOME/lib/" \
blas_lapack_libs='lapack,blas' \
boost_inc_dir='/exports/apps/boost/1.55/include' \
boost_lib_dir='/exports/apps/boost/1.55/lib' \
extra_lib_dirs='/usr/lib/liblapack.so.3':'/usr/lib64/libblas.so.3' \
VERBOSE='yes'

The output gives me this:

listing inside sundials home
bin  include  lib  LICENSE
listing inside sundials include
cvode  cvodes  ida  idas  kinsol  nvector  sundials
listing inside sundials lib
libsundials_cvode.a    libsundials_fcvode.a   libsundials_fkinsol.a         libsundials_fnvecserial.a   libsundials_idas.a     libsundials_nvecparallel.a
libsundials_cvodes.a   libsundials_fida.a     libsundials_fnvecparallel.a   libsundials_ida.a           libsundials_kinsol.a   libsundials_nvecserial.a
scons: Reading SConscript files ...
Configuration variables read from 'cantera.conf' and command line:
    prefix = '/exports/apps/cantera/2.1.1'
    python_package = 'new'
    python_prefix = '/exports/apps/anaconda/1.7/pkgs/'
    python3_package = 'n'
    use_sundials = 'y'
    sundials_include = '/group/hpc-share/sundials/sundials-2.4.0/include/'
    sundials_libdir = '/group/hpc-share/sundials/sundials-2.4.0/lib/'
    blas_lapack_libs = 'lapack,blas'
    extra_lib_dirs = '/usr/lib/liblapack.so.3:/usr/lib64/libblas.so.3'
    boost_inc_dir = '/exports/apps/boost/1.55/include'
    boost_lib_dir = '/exports/apps/boost/1.55/lib'
    VERBOSE = True

INFO: Using '/usr/bin/gfortran' to build the Fortran 90 interface
Checking for C++ header file cmath... yes
Checking for C header file sys/times.h... yes
Checking for C header file unistd.h... yes
Checking whether erf is declared... yes
Checking for C++ header file boost/math/special_functions/erf.hpp... yes
Checking for CVodeCreate(CV_BDF, CV_NEWTON) in C++ library sundials_cvodes... no
Checking for double x; log(x) in C library None... no
INFO: Found Cython version 0.19.1 for Python 2.x.
INFO: Building the new Python package using numpy.
WARNING: Couldn't find '3to2'. Python examples will not work correctly.
ERROR: Unable to find Sundials headers and / or libraries.
See 'config.log' for details.


if I do a "cat config.log" I get:

file~/src/cantera-2.1.1/SConstruct,line 781:
        Configure(confdir = .sconf_temp)
scons: Configure: Checking for C++ header file cmath... 
.sconf_temp/conftest_0.cpp <-
  |
  |#include <cmath>
  |
  |
g++ -o .sconf_temp/conftest_0.o -c -ftemplate-depth-128 -pthread -O3 -DNDEBUG -finline-functions -Wno-inline -g -I/exports/apps/boost/1.55/include -I/group/hpc-share/sundials/sundials-2.4.0/include .sconf_temp/conftest_0.cpp
scons: Configure: yes

scons: Configure: Checking for C header file sys/times.h... 
.sconf_temp/conftest_1.c <-
  |
  |#include "sys/times.h"
  |
  |
gcc -o .sconf_temp/conftest_1.o -c -pthread -O3 -DNDEBUG -finline-functions -Wno-inline -g -I/exports/apps/boost/1.55/include -I/group/hpc-share/sundials/sundials-2.4.0/include .sconf_temp/conftest_1.c
scons: Configure: yes

scons: Configure: Checking for C header file unistd.h... 
.sconf_temp/conftest_2.c <-
  |
  |#include "unistd.h"
  |
  |
gcc -o .sconf_temp/conftest_2.o -c -pthread -O3 -DNDEBUG -finline-functions -Wno-inline -g -I/exports/apps/boost/1.55/include -I/group/hpc-share/sundials/sundials-2.4.0/include .sconf_temp/conftest_2.c
scons: Configure: yes

scons: Configure: Checking whether erf is declared... 
.sconf_temp/conftest_3.cpp <-
  |#include <math.h>
  |int main()
  |{
  |#ifndef erf
  |    (void) erf;
  |#endif
  |    ;
  |    return 0;
  |}
  |
g++ -o .sconf_temp/conftest_3.o -c -ftemplate-depth-128 -pthread -O3 -DNDEBUG -finline-functions -Wno-inline -g -I/exports/apps/boost/1.55/include -I/group/hpc-share/sundials/sundials-2.4.0/include .sconf_temp/conftest_3.cpp
scons: Configure: yes

scons: Configure: Checking for C++ header file boost/math/special_functions/erf.hpp... 
.sconf_temp/conftest_4.cpp <-
  |
  |#include <boost/math/special_functions/erf.hpp>
  |
  |
g++ -o .sconf_temp/conftest_4.o -c -ftemplate-depth-128 -pthread -O3 -DNDEBUG -finline-functions -Wno-inline -g -I/exports/apps/boost/1.55/include -I/group/hpc-share/sundials/sundials-2.4.0/include .sconf_temp/conftest_4.cpp
In file included from /exports/apps/boost/1.55/include/boost/fusion/tuple/tuple.hpp:22,
                 from /exports/apps/boost/1.55/include/boost/fusion/tuple.hpp:10,
                 from /exports/apps/boost/1.55/include/boost/fusion/include/tuple.hpp:10,
                 from /exports/apps/boost/1.55/include/boost/math/tools/tuple.hpp:89,
                 from /exports/apps/boost/1.55/include/boost/math/special_functions/detail/igamma_inverse.hpp:13,
                 from /exports/apps/boost/1.55/include/boost/math/special_functions/gamma.hpp:1696,
                 from /exports/apps/boost/1.55/include/boost/math/special_functions/erf.hpp:15,
                 from .sconf_temp/conftest_4.cpp:2:
/exports/apps/boost/1.55/include/boost/fusion/tuple/detail/preprocessed/tuple.hpp:21:7: warning: no newline at end of file
scons: Configure: yes

.sconf_temp/conftest_5.cpp <-
  |#include <boost/version.hpp>
  |#include <iostream>
  |int main(int argc, char** argv) {
  |    std::cout << BOOST_LIB_VERSION << std::endl;
  |    return 0;
  |}
  |
scons: Configure: Checking for CVodeCreate(CV_BDF, CV_NEWTON) in C++ library sundials_cvodes... 
.sconf_temp/conftest_6.cpp <-
  |
  |
  |#include "cvodes/cvodes.h"
  |int
  |main() {
  |  CVodeCreate(CV_BDF, CV_NEWTON);
  |return 0;
  |}
  |
scons: Configure: no

scons: Configure: Checking for double x; log(x) in C library None... 
.sconf_temp/conftest_7.c <-
  |
  |
  |#include "math.h"
  |
  |int
  |main() {
  |  double x; log(x);
  |return 0;
  |}
  |
scons: Configure: no

I also tried looking inside the cvodes.h file. Using "cat $SUNDIALSHOME/include/cvodes/cvodes.h | grep CVodeCreate" I get:

 *     CVodeCreate
 * CVodeCreate (lmm, iter),
 * Symbolic constants for the lmm and iter parameters to CVodeCreate
 * Function : CVodeCreate
 * CVodeCreate creates an internal memory block for a problem to
 * If successful, CVodeCreate returns a pointer to initialized
 * If an initialization error occurs, CVodeCreate prints an error
SUNDIALS_EXPORT void *CVodeCreate(int lmm, int iter);
 * cvode_mem is pointer to CVODE memory returned by CVodeCreate.
 *                    CVodeCreate has not been called).
 * cvode_mem is a pointer to CVODES memory returned by CVodeCreate
 * cvode_mem is pointer to CVODES memory returned by CVodeCreate
 * after CVodeCreate, and before CVode.  The arguments are:
 * cvode_mem = pointer to CVODE memory returned by CVodeCreate.
 * returned by CVodeCreate.
 * cvode_mem returned by CVodeCreate.
 * cvode_mem returned by CVodeCreate.
 * pointer cvode_mem returned by CVodeCreate.
 *           CVodeCreate.
 *                 calling CVodeCreate) failed to set one of the
 *           CVodeCreate.
 * by calling CVodeCreateB). The CVODES memory for the forward and 
 * CVodeCreateB, 
SUNDIALS_EXPORT int CVodeCreateB(void *cvode_mem, int lmmB, int iterB, int *which);
 * through calls to CVodeCreateB through a sequence of forward-backward

So the file cvodes.h does exist and it does have a function called CVodeCreate

Next I checked the files in .sconf_temp. If I do "ls .sconf_test" I get:

conftest_0.cpp  conftest_0.o  conftest_1.c  conftest_1.o  conftest_2.c  conftest_2.o  conftest_3.cpp  conftest_3.o  conftest_4.cpp  conftest_4.o  conftest_5.cpp  conftest_6.cpp  conftest_7.c

Then I tried checking to see if the compiler can find the cvodes.h header. I did the following.

mkdir ../test
cp -r .sconf_temp ../test/.sconf_temp
cd ../test
g++ -o .sconf_temp/conftest_6.o -c -ftemplate-depth-128 -pthread -O3 -DNDEBUG -finline-functions -Wno-inline -g -I/exports/apps/boost/1.55/include -I/group/hpc-share/sundials/sundials-2.4.0/include .sconf_temp/conftest_6.cpp
ls .sconf_temp

and I get

conftest_0.cpp  conftest_1.c  conftest_2.c  conftest_3.cpp  conftest_4.cpp  conftest_5.cpp  conftest_6.o
conftest_0.o    conftest_1.o  conftest_2.o  conftest_3.o    conftest_4.o    conftest_6.cpp  conftest_7.c

Which means the compiler can find the header and compile the conftest_6.o successfully. 

Can anyone help me from here?

Thanks,
Shane

p.s. I am running scons 2.1.0 and python 2.7.5

Ray Speth

unread,
Jul 13, 2016, 12:06:39 PM7/13/16
to Cantera Users' Group
Shane,

I think the problem is your definition of 'extra_lib_dirs'. As implied by the name, it should be a list of directories, not of library names. You can see that something is going wrong with running the test because after the source code for the test should be the compiler command line, but instead it just says "scons: Configure: no".

You are already specifying the BLAS/LAPACK libraries to link with the 'blas_lapack_libs' option, and there is no need to add system directories like /usr/lib and /usr/lib64 to the search path, so you shouldn't need to set any value for 'extra_lib_dirs'.

Regards,
Ray

Shane Hesprich

unread,
Jul 21, 2016, 3:46:39 PM7/21/16
to Cantera Users' Group
Ray,

Thanks for the suggestion. I tried removing that line, but then I got a separate error stating /usr/bin.ld: cannot find -llapack. I looked into it and it turns out the version of liblapack I had was the 32 bit version (which is weird because sundials compiled with that version of lapack without complainig) Also there was no 64 bit rpm for RHEL 5. I looked around and found a third party rpm located here https://rpmfind.net/linux/rpm2html/search.php?query=liblapack.so.3()(64bit) (search for the DAG extra packages for redhat 5). After installing the new 64 bit version of liblapack I tried installing cantera again, and it still would not compile correctly. This is the contents of the new config.log

file ~/src/cantera-2.1.1/SConstruct,line 781:
        Configure(confdir = .sconf_temp)
scons: Configure: Checking for C++ header file cmath... 
.sconf_temp/conftest_0.cpp <-
  |
  |#include <cmath>
  |
  |
g++ -o .sconf_temp/conftest_0.o -c -ftemplate-depth-128 -pthread -O3 -DNDEBUG -finline-functions -Wno-inline -g -I/exports/apps/boost/1.55/include -I/group/hpc-share/sundials/include .sconf_temp/conftest_0.cpp
scons: Configure: yes

scons: Configure: Checking for C header file sys/times.h... 
.sconf_temp/conftest_1.c <-
  |
  |#include "sys/times.h"
  |
  |
gcc -o .sconf_temp/conftest_1.o -c -pthread -O3 -DNDEBUG -finline-functions -Wno-inline -g -I/exports/apps/boost/1.55/include -I/group/hpc-share/sundials/include .sconf_temp/conftest_1.c
scons: Configure: yes

scons: Configure: Checking for C header file unistd.h... 
.sconf_temp/conftest_2.c <-
  |
  |#include "unistd.h"
  |
  |
gcc -o .sconf_temp/conftest_2.o -c -pthread -O3 -DNDEBUG -finline-functions -Wno-inline -g -I/exports/apps/boost/1.55/include -I/group/hpc-share/sundials/include .sconf_temp/conftest_2.c
scons: Configure: yes

scons: Configure: Checking whether erf is declared... 
.sconf_temp/conftest_3.cpp <-
  |#include <math.h>
  |int main()
  |{
  |#ifndef erf
  |    (void) erf;
  |#endif
  |    ;
  |    return 0;
  |}
  |
g++ -o .sconf_temp/conftest_3.o -c -ftemplate-depth-128 -pthread -O3 -DNDEBUG -finline-functions -Wno-inline -g -I/exports/apps/boost/1.55/include -I/group/hpc-share/sundials/include .sconf_temp/conftest_3.cpp
scons: Configure: yes

scons: Configure: Checking for C++ header file boost/math/special_functions/erf.hpp... 
.sconf_temp/conftest_4.cpp <-
  |
  |#include <boost/math/special_functions/erf.hpp>
  |
  |
g++ -o .sconf_temp/conftest_4.o -c -ftemplate-depth-128 -pthread -O3 -DNDEBUG -finline-functions -Wno-inline -g -I/exports/apps/boost/1.55/include -I/group/hpc-share/sundials/include .sconf_temp/conftest_4.cpp
In file included from /exports/apps/boost/1.55/include/boost/fusion/tuple/tuple.hpp:22,
                 from /exports/apps/boost/1.55/include/boost/fusion/tuple.hpp:10,
                 from /exports/apps/boost/1.55/include/boost/fusion/include/tuple.hpp:10,
                 from /exports/apps/boost/1.55/include/boost/math/tools/tuple.hpp:89,
                 from /exports/apps/boost/1.55/include/boost/math/special_functions/detail/igamma_inverse.hpp:13,
                 from /exports/apps/boost/1.55/include/boost/math/special_functions/gamma.hpp:1696,
                 from /exports/apps/boost/1.55/include/boost/math/special_functions/erf.hpp:15,
                 from .sconf_temp/conftest_4.cpp:2:
/exports/apps/boost/1.55/include/boost/fusion/tuple/detail/preprocessed/tuple.hpp:21:7: warning: no newline at end of file
scons: Configure: yes

.sconf_temp/conftest_5.cpp <-
  |#include <boost/version.hpp>
  |#include <iostream>
  |int main(int argc, char** argv) {
  |    std::cout << BOOST_LIB_VERSION << std::endl;
  |    return 0;
  |}
  |
g++ -o .sconf_temp/conftest_5.o -c -ftemplate-depth-128 -pthread -O3 -DNDEBUG -finline-functions -Wno-inline -g -I/exports/apps/boost/1.55/include -I/group/hpc-share/sundials/include .sconf_temp/conftest_5.cpp
g++ -o .sconf_temp/conftest_5 -pthread .sconf_temp/conftest_5.o -L/exports/apps/boost/1.55/lib -L/group/hpc-share/sundials/lib
.sconf_temp/conftest_5 > .sconf_temp/conftest_5.out
scons: Configure: Checking for CVodeCreate(CV_BDF, CV_NEWTON) in C++ library sundials_cvodes... 
.sconf_temp/conftest_6.cpp <-
  |
  |
  |#include "cvodes/cvodes.h"
  |int
  |main() {
  |  CVodeCreate(CV_BDF, CV_NEWTON);
  |return 0;
  |}
  |
g++ -o .sconf_temp/conftest_6.o -c -ftemplate-depth-128 -pthread -O3 -DNDEBUG -finline-functions -Wno-inline -g -I/exports/apps/boost/1.55/include -I/group/hpc-share/sundials/include .sconf_temp/conftest_6.cpp
g++ -o .sconf_temp/conftest_6 -pthread .sconf_temp/conftest_6.o -L/exports/apps/boost/1.55/lib -L/group/hpc-share/sundials/lib -lsundials_cvodes -llapack -lblas
/usr/bin/ld: cannot find -llapack
collect2: ld returned 1 exit status
scons: Configure: no

scons: Configure: Checking for double x; log(x) in C library None... 
.sconf_temp/conftest_7.c <-
  |
  |
  |#include "math.h"
  |
  |int
  |main() {
  |  double x; log(x);
  |return 0;
  |}
  |
gcc -o .sconf_temp/conftest_7.o -c -pthread -O3 -DNDEBUG -finline-functions -Wno-inline -g -I/exports/apps/boost/1.55/include -I/group/hpc-share/sundials/include .sconf_temp/conftest_7.c
gcc -o .sconf_temp/conftest_7 -pthread .sconf_temp/conftest_7.o -L/exports/apps/boost/1.55/lib -L/group/hpc-share/sundials/lib
.sconf_temp/conftest_7.o: In function `main':
/home/MARQNET/1411hespris/src/cantera-2.1.1/.sconf_temp/conftest_7.c:7: undefined reference to `log'
collect2: ld returned 1 exit status
scons: Configure: no


The output from the command 'file /usr/lib64/liblapack.so.3.1.1' is as follows

/usr/lib64/liblapack.so.3.1.1: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped

Shane Hesprich

unread,
Jul 22, 2016, 2:17:17 PM7/22/16
to Cantera Users' Group
Update: turns out my major problem was that the rpm of liblapack only installed the files 
liblapack.so.3
liblapack.so.3.1
liblapack.so.3.1.1

and ld only looks for files with the extension .a or .so

a simple

sudo ln -s /usr/lib64/liblapack.so.3.1.1 /usr/lib64/liblapack.so

fixed the problem
Reply all
Reply to author
Forward
0 new messages