speth / ember

Ember: unsteady strained flame solver
MIT License
47 stars 25 forks source link

cantera 2.4 test fail? #7

Closed ghost closed 6 years ago

ghost commented 6 years ago

it seems a gtest problem. However, the ext folder is empty. I do not know how to handle it.

OS: RHEL6.8 cantera 2.4 build, test and load.

cd $HOME/downloads
git clone  https://github.com/Cantera/cantera.git
cd cantera
git checkout tags/v2.4.0
git submodule update

module load gcc/5.4.0-alt
module load boost/1.66.0
module load sundials/2.6.2 eigen/3.3.4 lapack/3.8.0-gcc540a
module load conda # python3 with numpy

cat > cantera.conf <<EOF
prefix='$HOME/share/cantera/2.4.0/gcc540a'
python2_package='none'
python3_package='full'
blas_lapack_libs='lapack,blas,gfortran' # lapack is compiled with gfortran
blas_lapack_dir='/apps2/lapack/3.8.0-gcc540a/lib64'
build_thread_safe="y"  # required by ember ?
EOF

cat cantera.conf

scons -j`nproc` build
scons -j`nproc` test  # all success

scons install

# environment module file
mkdir -p $HOME/modulefiles/cantera/2.4.0
cat >>  $HOME/modulefiles/cantera/2.4.0/gcc540a <<EOF
#%Module1.0
setenv          MOD_APP cantera
setenv          MOD_VER 2.4.0

module load pre-module

prereq          gcc/5.4.0-alt
conflict        cantera
module-whatis   "cantera 2.4.0, compiled with gcc 5.4.0-alt, normal lapack compiled with gfortran."
set             prefix          $HOME/share/cantera/2.4.0/gcc540a
# setenv          PYTHON_CMD      python3
prepend-path    PATH            \$prefix/bin
append-path     MATLABPATH      \$prefix/lib/cantera/matlab/toolbox
append-path     MATLABPATH      \$prefix/lib/cantera/matlab/toolbox/1D
prepend-path    LD_LIBRARY_PATH \$prefix/lib
prepend-path    PYTHONPATH      \$prefix/lib/python3.6/site-packages
prepend-path    PKG_CONFIG_PATH \$prefix/lib/pkgconfig

module load post-module
EOF

module load  cantera/2.4.0/gcc540a

ember

cd $HOME/downloads
git clone http://github.com/speth/ember.git
cd ember
# git checkout tags/v1.4.0  # do not support python3
git submodule update

module load tbb/2017_U6 

cat > ember.conf <<EOF
prefix='$HOME/share/ember/1.4.0/gcc540a'
include='$HOME/share/gtest/1.8.0/include'
libdirs='/apps2/lapack/3.8.0-gcc540a/lib64,$HOME/share/gtest/1.8.0/lib'
cxxflags='-lgtest -lboost_regex'
cantera='$HOME/share/cantera/2.4.0/gcc540a'
sundials='/apps2/sundials/2.6.2'
eigen='/apps2/eigen/3.3.4/include/eigen3'
boost='$BOOST_ROOT'
env_vars='all'
tbb='/apps2/tbb/2017_U6'
blas_lapack='lapack,blas,gfortran'
install_args='--prefix=$HOME/share/ember/2.4.0/gcc540a/pypkg'
EOF

cat ember.conf

scons -j`nproc` build

test output:

$ scons test -Q
Configuration variables read from 'ember.conf' and command line:
    cantera = '/home/dic17007/share/cantera/2.4.0/gcc540a'
    sundials = '/apps2/sundials/2.6.2'
    eigen = '/apps2/eigen/3.3.4/include/eigen3'
    boost = '/apps2/boost/1.66.0'
    include = '/home/dic17007/share/gtest/1.8.0/include'
    libdirs = '/home/dic17007/share/gtest/1.8.0/lib,/apps2/lapack/3.8.0-gcc540a/lib64'
    env_vars = 'all'
    tbb = '/apps2/tbb/2017_U6'
    blas_lapack = 'lapack,blas,gfortran'
    install_args = '--prefix=/home/dic17007/share/ember/2.4.0/gcc540a/pypkg'

INFO: Using Sundials version 2.6.2
ConfigBuilder(["src/config.h"], ["src/config.h.in"])
Generating src/config.h with the following settings:
    EMBER_SUNDIALS_VERSION              26
    EMBER_USE_TBB                       1
g++ -o bin/unittest -pthread build/test/main.o build/test/test_diffusionSystem.o build/test/test_interp2d.o build/test/test_mathUtils.o build/test/tridiagonalIntegrator.o build/core/callback.os build/core/chemistry0d.os build/core/convectionSystem.os build/core/debugUtils.os build/core/diffusionSystem.os build/core/flameSolver.os build/core/grid.os build/core/integrator.os build/core/mathUtils.os build/core/perfTimer.os build/core/qssintegrator.os build/core/quasi2d.os build/core/readConfig.os build/core/scalarFunction.os build/core/sourceSystem.os build/core/splitSolver.os build/core/sundialsUtils.os -Llib -L/home/dic17007/share/gtest/1.8.0/lib -L/apps2/lapack/3.8.0-gcc540a/lib64 -L/home/dic17007/share/cantera/2.4.0/gcc540a/lib -L/apps2/sundials/2.6.2/lib -L/apps2/boost/1.66.0/lib -L/apps2/tbb/2017_U6/lib -L/home/dic17007/miniconda3/lib -lsundials_nvecserial -lsundials_ida -lsundials_cvode -lcantera -ltbb -llapack -lblas -lgfortran -lgtest -lpython3.6m
build/test/main.o: In function `main':
/home/dic17007/downloads/ember/test/main.cpp:6: undefined reference to `testing::InitGoogleTest(int*, char**)'
build/test/main.o: In function `main':
/home/dic17007/share/gtest/1.8.0/include/gtest/gtest.h:2333: undefined reference to `testing::UnitTest::GetInstance()'
/home/dic17007/share/gtest/1.8.0/include/gtest/gtest.h:2333: undefined reference to `testing::UnitTest::Run()'
build/test/test_diffusionSystem.o: In function `DiffusionSystemTest_Superposition1_Test::TestBody()':
/home/dic17007/share/gtest/1.8.0/include/gtest/internal/gtest-port.h:1215: undefined reference to `testing::internal::IsTrue(bool)'
build/test/test_diffusionSystem.o: In function `DiffusionSystemTest_Superposition1_Test::TestBody()':
/home/dic17007/downloads/ember/test/test_diffusionSystem.cpp:140: undefined reference to `testing::internal::DoubleNearPredFormat(char const*, char const*, char const*, double, double, double)'
/home/dic17007/downloads/ember/test/test_diffusionSystem.cpp:140: undefined reference to `testing::Message::Message()'
/home/dic17007/downloads/ember/test/test_diffusionSystem.cpp:140: undefined reference to `testing::internal::AssertHelper::AssertHelper(testing::TestPartResult::Type, char const*, int, char const*)'
/home/dic17007/downloads/ember/test/test_diffusionSystem.cpp:140: undefined reference to `testing::internal::AssertHelper::operator=(testing::Message const&) const'
# ...
ghost commented 6 years ago

-lgtest_main should be added. It might be gtest version problem.

$ g++ -o bin/unittest -pthread \
> build/test/main.o build/test/test_diffusionSystem.o build/test/test_interp2d.o build/test/test_mathUtils.o build/test/tridiagonalIntegrator.o build/core/callback.os build/core/chemistry0d.os build/core/convectionSystem.os build/core/debugUtils.os build/core/diffusionSystem.os build/core/flameSolver.os build/core/grid.os build/core/integrator.os build/core/mathUtils.os build/core/perfTimer.os build/core/qssintegrator.os build/core/quasi2d.os build/core/readConfig.os build/core/scalarFunction.os build/core/sourceSystem.os build/core/splitSolver.os build/core/sundialsUtils.os \
> -Llib \
> -L/home/dic17007/share/cantera/2.4.0/gcc540a/lib -lcantera \
> -L/apps2/sundials/2.6.2/lib -lsundials_nvecserial -lsundials_ida -lsundials_cvode \
> -L/apps2/boost/1.66.0/lib -L/apps2/tbb/2017_U6/lib -ltbb \
> -L/apps2/lapack/3.8.0-gcc540a/lib64 -llapack -lblas -lgfortran \
> -L/home/dic17007/share/gtest/1.8.0/lib64 -lgtest -lgtest_main \
> -L/home/dic17007/miniconda3/lib -lpython3.6m \

# no error

modify 515th line of SConstruct to

# testenv.Append(LIBS=['gtest']
testenv.Append(LIBS=['gtest','gtest_main']

And then the unittest is OK.

speth commented 6 years ago

If you use the git submodule for gtest, it will provide you with gtest 1.7.0, which is the currently-supported version. You can check the submodule using git submodule update, and then remove your local installation of gtest from the linker path.

ghost commented 6 years ago

Thank you very much for your reply. I am sorry for that I thought I have run git submodule update.