Error while executing : make in CentOS7

 61%] Building CXX object CMakeFiles/precice.dir/extras/bindings/fortran/src/SolverInterfaceFortran.cpp.o
[ 62%] Building CXX object CMakeFiles/precice.dir/extras/bindings/fortran/src/SolverInterfaceFASTEST.cpp.o
[ 62%] Linking CXX shared library libprecice.so
[ 62%] Built target precice
Scanning dependencies of target binprecice
Scanning dependencies of target testprecice
[ 62%] Building CXX object CMakeFiles/binprecice.dir/src/drivers/main.cpp.o
[ 63%] Building CXX object CMakeFiles/testprecice.dir/src/acceleration/test/AccelerationMasterSlaveTest.cpp.o
[ 63%] Building CXX object CMakeFiles/testprecice.dir/src/testing/main.cpp.o
[ 64%] Building CXX object CMakeFiles/testprecice.dir/src/acceleration/test/ParallelMatrixOperationsTest.cpp.o
[ 64%] Building CXX object CMakeFiles/testprecice.dir/src/acceleration/test/PreconditionerTest.cpp.o
[ 65%] Building CXX object CMakeFiles/testprecice.dir/src/action/tests/PythonActionTest.cpp.o
[ 65%] Building CXX object CMakeFiles/testprecice.dir/src/acceleration/test/QRFactorizationTest.cpp.o
[ 65%] Building CXX object CMakeFiles/testprecice.dir/src/action/tests/ScaleActionTest.cpp.o
[ 66%] Building CXX object CMakeFiles/testprecice.dir/src/action/tests/SummationActionTest.cpp.o
**[ 67%] Linking CXX executable binprecice**
**libprecice.so.2.1.0: undefined reference to `std::basic_ios<char, std::char_traits<char> >::operator bool() const'**
**libprecice.so.2.1.0: undefined reference to `typeinfo for std::thread::_State'**
**libprecice.so.2.1.0: undefined reference to `std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)())'**
**libprecice.so.2.1.0: undefined reference to `vtable for std::thread::_State'**
**libprecice.so.2.1.0: undefined reference to `std::thread::_State::~_State()'**
**collect2: error: ld returned 1 exit status**
**make[2]: *** [CMakeFiles/binprecice.dir/build.make:130: binprecice] Error 1**
**make[1]: *** [CMakeFiles/Makefile2:267: CMakeFiles/binprecice.dir/all] Error 2**
**make[1]: *** Waiting for unfinished jobs....**
**[ 67%] Building CXX object CMakeFiles/testprecice.dir/src/com/tests**/CommunicateBoundingBoxTest.cpp.o
[ 68%] Building CXX object CMakeFiles/testprecice.dir/src/com/tests/CommunicateMeshTest.cpp.o
[ 68%] Building CXX object CMakeFiles/testprecice.dir/src/com/tests/MPIDirectCommunicationTest.cpp.o
[ 69%] Building CXX object CMakeFiles/testprecice.dir/src/com/tests/MPIPortsCommunicationTest.cpp.o
[ 69%] Building CXX object CMakeFiles/testprecice.dir/src/com/tests/MPISinglePortsCommunicationTest.cpp.o
[ 70%] Building CXX object CMakeFiles/testprecice.dir/src/com/tests/SocketCommunicationTest.cpp.o
[ 70%] Building CXX object CMakeFiles/testprecice.dir/src/cplscheme/tests/AbsoluteConvergenceMeasureTest.cpp.o
[ 71%] Building CXX object CMakeFiles/testprecice.dir/src/cplscheme/tests/CompositionalCouplingSchemeTest.cpp.o
[ 71%] Building CXX object CMakeFiles/testprecice.dir/src/cplscheme/tests/DummyCouplingScheme.cpp.o
[ 72%] Building CXX object CMakeFiles/testprecice.dir/src/cplscheme/tests/ExplicitCouplingSchemeTest.cpp.o
[ 72%] Building CXX object CMakeFiles/testprecice.dir/src/cplscheme/tests/MinIterationConvergenceMeasureTest.cpp.o
[ 73%] Building CXX object CMakeFiles/testprecice.dir/src/cplscheme/tests/ParallelImplicitCouplingSchemeTest.cpp.o
[ 73%] Building CXX object CMakeFiles/testprecice.dir/src/cplscheme/tests/RelativeConvergenceMeasureTest.cpp.o
[ 74%] Building CXX object CMakeFiles/testprecice.dir/src/cplscheme/tests/ResidualRelativeConvergenceMeasureTest.cpp.o
[ 74%] Building CXX object CMakeFiles/testprecice.dir/src/cplscheme/tests/SerialImplicitCouplingSchemeTest.cpp.o
[ 75%] Building CXX object CMakeFiles/testprecice.dir/src/io/tests/ExportConfigurationTest.cpp.o
[ 75%] Building CXX object CMakeFiles/testprecice.dir/src/io/tests/ExportVTKTest.cpp.o
[ 76%] Building CXX object CMakeFiles/testprecice.dir/src/io/tests/ExportVTKXMLTest.cpp.o
[ 76%] Building CXX object CMakeFiles/testprecice.dir/src/io/tests/TXTTableWriterTest.cpp.o
[ 77%] Building CXX object CMakeFiles/testprecice.dir/src/io/tests/TXTWriterReaderTest.cpp.o
[ 77%] Building CXX object CMakeFiles/testprecice.dir/src/m2n/tests/GatherScatterCommunicationTest.cpp.o
[ 78%] Building CXX object CMakeFiles/testprecice.dir/src/m2n/tests/PointToPointCommunicationTest.cpp.o
[ 79%] Building CXX object CMakeFiles/testprecice.dir/src/mapping/tests/MappingConfigurationTest.cpp.o
[ 79%] Building CXX object CMakeFiles/testprecice.dir/src/mapping/tests/NearestNeighborMappingTest.cpp.o
[ 80%] Building CXX object CMakeFiles/testprecice.dir/src/mapping/tests/NearestProjectionMappingTest.cpp.o
[ 80%] Building CXX object CMakeFiles/testprecice.dir/src/mapping/tests/PetRadialBasisFctMappingTest.cpp.o
[ 81%] Building CXX object CMakeFiles/testprecice.dir/src/mapping/tests/RadialBasisFctMappingTest.cpp.o
[ 81%] Building CXX object CMakeFiles/testprecice.dir/src/math/tests/BarycenterTest.cpp.o
[ 82%] Building CXX object CMakeFiles/testprecice.dir/src/math/tests/DifferencesTest.cpp.o
[ 82%] Building CXX object CMakeFiles/testprecice.dir/src/math/tests/GeometryTest.cpp.o
[ 83%] Building CXX object CMakeFiles/testprecice.dir/src/mesh/tests/BoundingBoxTest.cpp.o
[ 83%] Building CXX object CMakeFiles/testprecice.dir/src/mesh/tests/DataConfigurationTest.cpp.o
[ 84%] Building CXX object CMakeFiles/testprecice.dir/src/mesh/tests/EdgeTest.cpp.o
[ 84%] Building CXX object CMakeFiles/testprecice.dir/src/mesh/tests/MeshTest.cpp.o
[ 85%] Building CXX object CMakeFiles/testprecice.dir/src/mesh/tests/RTreeAdapterTests.cpp.o
[ 85%] Building CXX object CMakeFiles/testprecice.dir/src/mesh/tests/RTreeTests.cpp.o
[ 86%] Building CXX object CMakeFiles/testprecice.dir/src/mesh/tests/TriangleTest.cpp.o
[ 86%] Building CXX object CMakeFiles/testprecice.dir/src/mesh/tests/VertexTest.cpp.o
[ 87%] Building CXX object CMakeFiles/testprecice.dir/src/partition/tests/ProvidedPartitionTest.cpp.o
[ 87%] Building CXX object CMakeFiles/testprecice.dir/src/partition/tests/ReceivedPartitionTest.cpp.o
[ 88%] Building CXX object CMakeFiles/testprecice.dir/src/precice/tests/ParallelTests.cpp.o
[ 88%] Building CXX object CMakeFiles/testprecice.dir/src/precice/tests/SerialTests.cpp.o
[ 89%] Building CXX object CMakeFiles/testprecice.dir/src/precice/tests/VersioningTests.cpp.o
[ 89%] Building CXX object CMakeFiles/testprecice.dir/src/precice/tests/WatchPointTest.cpp.o
[ 90%] Building CXX object CMakeFiles/testprecice.dir/src/query/tests/FindClosestTest.cpp.o
[ 90%] Building CXX object CMakeFiles/testprecice.dir/src/query/tests/FindClosestVertexVisitorTest.cpp.o
[ 91%] Building CXX object CMakeFiles/testprecice.dir/src/testing/TestContext.cpp.o
[ 91%] Building CXX object CMakeFiles/testprecice.dir/src/testing/Testing.cpp.o
[ 92%] Building CXX object CMakeFiles/testprecice.dir/src/testing/tests/ExampleTests.cpp.o
[ 92%] Building CXX object CMakeFiles/testprecice.dir/src/utils/tests/AlgorithmTest.cpp.o
[ 93%] Building CXX object CMakeFiles/testprecice.dir/src/utils/tests/DimensionsTest.cpp.o
[ 93%] Building CXX object CMakeFiles/testprecice.dir/src/utils/tests/EigenHelperFunctionsTest.cpp.o
[ 94%] Building CXX object CMakeFiles/testprecice.dir/src/utils/tests/ManageUniqueIDsTest.cpp.o
[ 94%] Building CXX object CMakeFiles/testprecice.dir/src/utils/tests/MultiLockTest.cpp.o
[ 95%] Building CXX object CMakeFiles/testprecice.dir/src/utils/tests/ParallelTest.cpp.o
[ 95%] Building CXX object CMakeFiles/testprecice.dir/src/utils/tests/PointerVectorTest.cpp.o
[ 96%] Building CXX object CMakeFiles/testprecice.dir/src/utils/tests/StatisticsTest.cpp.o
[ 96%] Building CXX object CMakeFiles/testprecice.dir/src/utils/tests/StringTest.cpp.o
[ 97%] Building CXX object CMakeFiles/testprecice.dir/src/xml/tests/ParserTest.cpp.o
[ 97%] Building CXX object CMakeFiles/testprecice.dir/src/xml/tests/PrinterTest.cpp.o
[ 98%] Building CXX object CMakeFiles/testprecice.dir/src/xml/tests/XMLTest.cpp.o
[100%] Linking CXX executable testprecice
CMakeFiles/testprecice.dir/src/precice/tests/WatchPointTest.cpp.o: In function `std::istream_iterator<double, char, std::char_traits<char>, long>::_M_read()':
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/stream_iterator.h:118: undefined reference to `std::basic_ios<char, std::char_traits<char> >::operator bool() const'
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/stream_iterator.h:122: undefined reference to `std::basic_ios<char, std::char_traits<char> >::operator bool() const'
libprecice.so.2.1.0: undefined reference to `typeinfo for std::thread::_State'
libprecice.so.2.1.0: undefined reference to `std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)())'
libprecice.so.2.1.0: undefined reference to `vtable for std::thread::_State'
libprecice.so.2.1.0: undefined reference to `std::thread::_State::~_State()'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/testprecice.dir/build.make:1150: testprecice] Error 1
make[1]: *** [CMakeFiles/Makefile2:240: CMakeFiles/testprecice.dir/all] Error 2
make: *** [Makefile:182: all] Error 2

Welcome @swag

Which C++ compiler are you using?
Did you see the page on dependencies on CentOS7 ?

I am using gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5). Yes I checked all the dependencies in a fresh CentOS7 installation.

I did as follows:

  1. Goto CentOS7 section of the link : https://github.com/precice/precice/wiki/Dependencies

sudo yum groupinstall ‘Development Tools’
sudo yum update
sudo yum install cmake3 libxml2-devel eigen3 openmpi-devel python3-devel

export PATH=/usr/lib64/openmpi/bin:$PATH
export CC=/opt/rh/devtoolset-7/root/usr/bin/gcc


Step 1 of dependencies do not show problem

Step 2, installation of boost to be done as follows

Boost***

2a. Goto the CentOS7 section of link https://fedoraproject.org/wiki/EPEL (Precice has issues if boost is more than 1.66. Source code installation is needed.)

2b. go to and download 1.66 version from : https://sourceforge.net/projects/boost/files/

2c. extract to any directory

2d. go to the directory

2e. ./bootstrap.sh --with-libraries=log,thread,system,filesystem,program_options,test --prefix=/usr/local

2f. sudo ./b2 install (it will install in /usr/local)

2h. remove the directory as all files have been copied to /usr/local

2i. Update the dynamic linker’s run-time bindings: sudo ldconfig

gcc-newer-version***

3a. sudo yum install centos-release-scl

3b. sudo yum install devtoolset-7

3c. scl enable devtoolset-7 bash //enable new gcc compiler bash

Eigen3************

4a. download eigen-3.3.7 from : https://gitlab.com/libeigen/eigen/-/releases

4b. cmake -DCMAKE_INSTALL_PREFIX=/usr/local …/

CMake will require Openssl-devel**

5a. sudo yum install http://mirror.centos.org/centos/7/os/x86_64/Packages/openssl-devel-1.0.2k-19.el7.x86_64.rpm

6.0 CMake************** Reference link: https://askubuntu.com/questions/355565/how-do-i-install-the-latest-version-of-cmake-from-the-command-line/865294#865294

version=3.18
build=4
mkdir ~/temp
cd ~/temp
wget https://cmake.org/files/v$version/cmake-$version.$build.tar.gz
tar -xzvf cmake-$version.$build.tar.gz
cd cmake-$version.$build/

./bootstrap
make -j$(nproc)
sudo make install

7.0***************Install libxml2

sudo yum install libxml2-devel

8.0***************Install OpenMPI (Precice, PETSc, OpenFOAM should have the same OpenMPI version)

Download 4.0.2 from site : https://www.open-mpi.org/software/ompi/v4.0/

scl enable devtoolset-7 bash (i have provided for precaution if it uses gcc, to use latest in bash)

./configure --prefix=/usr/local

make all -j$(nproc)

sudo make install

mpiexec --version

9.0***********************PETSc**************** ( least version 3.12)

Download 3.12.5 version and extract it to a Dir in Local user.

Change into that directory and compile with or without debugging: ./configure --prefix=/usr/local --with-debugging=0 --download-fblaslapack=1 (disable debugging for optimal performance)

After installation:

export PETSC_DIR=/home/aaa/Software/petsc-3.12.5

export PETSC_ARCH=arch-linux2-c-opt

export LD_LIBRARY_PATH=$PETSC_DIR/$PETSC_ARCH/lib:$LD_LIBRARY_PATH

10.Install numpy scipy etc**********

sudo python3 -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose

11.Precice******

wget https://github.com/precice/precice/archive/v2.1.0.tar.gz
tar -xzvf v2.1.0.tar.gz
cd precice-2.1.0

unset PETSC_DIR
unset PETSC_ARCH
unset LD_LIBRARY_PATH

export PETSC_DIR=/home/aaa/Software/petsc-3.12.5
export PETSC_ARCH=arch-linux2-c-opt
export LD_LIBRARY_PATH=$PETSC_DIR/$PETSC_ARCH/lib:$LD_LIBRARY_PATH

scl enable devtoolset-7 bash
mkdir build && cd build
cmake -DBUILD_SHARED_LIBS=ON …
make -j $(nproc)

@swag it is difficult to debug this remotely, but here are some ideas:

  • Do you maybe have multiple compilers installed? This could mean that you are using an older C++ Standard Library, even though your compiler is recent enough.
  • In systems that do not have recent versions of the dependencies (such as some HPC clusters), a convenient way is to get preCICE from Spack. This does automatically all the steps that you described here.
  • It looks like the library (libprecice.so) is being built successfully, and the problem only affects the testprecice. This is mainly meant for developers and you could ignore it if you can still run simulations on your system. You could check if the examples work (which, however, don’t use all the features of preCICE).

Please format your posts to clearly show the code/log snippets. This forum supports Markdown and you can just add three ``` in the beginning and three ``` at the end of each code snippet. This would make it much easier for us to help.

Thank you @uekerman and @MakisH for replying. I will try a Spack installation.

@swag did you have any success with Spack or any other way?

Hi @MakisH and @swag,
I also met the same problem.

[ 99%] Building CXX object CMakeFiles/testprecice.dir/src/xml/tests/XMLTest.cpp.o
[100%] Linking CXX executable testprecice
libprecice.so.1.6.1: undefined reference to std::basic_ios<char, std::char_traits<char> >::operator bool() const' libprecice.so.1.6.1: undefined reference to typeinfo for std::thread::_State’
libprecice.so.1.6.1: undefined reference to std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)())' libprecice.so.1.6.1: undefined reference to vtable for std::thread::_State’
libprecice.so.1.6.1: undefined reference to `std::thread::_State::~_State()’
collect2: error: ld returned 1 exit status
make[2]: *** [testprecice] Error 1
make[1]: *** [CMakeFiles/testprecice.dir/all] Error 2
make: *** [all] Error 2

Since I don’t have root authority to use yum, all the following dependencies are built from source code.
CentOS: 7
gcc: 8.3.0
Cmake: 3.18
Eigen: 3.3.8
Boost: 1.66
libxml2: 2.9.1
petsc: 3.14.1
openmpi: 3.16

When I continued to run the following command for test, the results are as follows:

[lengjun@localhost build]$ make test_install
Scanning dependencies of target test_install
Testing the installation using the C++ solverdummy
– The CXX compiler identification is GNU 8.3.1
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: /opt/rh/devtoolset-8/root/usr/bin/c++ - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
CMake Error at CMakeLists.txt:4 (find_package):
Could not find a package configuration file provided by “precice” with any
of the following names:
preciceConfig.cmake
precice-config.cmake
Add the installation prefix of “precice” to CMAKE_PREFIX_PATH or set
“precice_DIR” to a directory containing one of the above files. If
“precice” provides a separate development package or SDK, be sure it has
been installed.

– Configuring incomplete, errors occurred!
See also “/home/lengjun/softwares/precice-1.6.1/build/TestInstall/CMakeFiles/CMakeOutput.log”.
make[3]: *** [CMakeFiles/test_install] Error 1
make[2]: *** [CMakeFiles/test_install.dir/all] Error 2
make[1]: *** [CMakeFiles/test_install.dir/rule] Error 2
make: *** [test_install] Error 2

I don’t know why.

However, the installation succeeded when I set petsc and mph off:

cmake -DBUILD_SHARED_LIBS=ON -DPRECICE_MPICommunication=OFF -DPRECICE_PETScMapping=OFF -DCMAKE_PREFIX_PATH=/home/lengjun/softwares/precice-1.6.1/build …

Maybe I need to rebuild openMPI and PTESC, right?

By the way, should I set -DCMAKE_PREFIX_PATH=/my/file or -DCMAKE_INSTALL_PREFIX=/my/file if I want to install in other files?

Could you post the output of mpicc --version? Are you sure that your self-compiled OpenMPI is based on the correct GCC?

1 Like

Hi @ajaust, I recompiled OpenMPI and PETSc and preCICE works now! Thanks!

[lengjun@localhost ~]$ mpicc --version
gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)
Copyright © 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Great to hear that it works now! :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.