0

I'm going to use boost_mpi, but the following problems occurred while I was compiling the test program.

Problem

/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libboost_mpi.so: undefined reference to `ompi_mpi_info_null'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libboost_mpi.so: undefined reference to `ompi_request_null'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libboost_mpi.so: undefined reference to `ompi_mpi_packed'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libboost_mpi.so: undefined reference to `ompi_mpi_comm_null'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libboost_mpi.so: undefined reference to `ompi_mpi_errors_return'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libboost_mpi.so: undefined reference to `MPI::Comm::Comm()'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libboost_mpi.so: undefined reference to `ompi_op_set_cxx_callback'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libboost_mpi.so: undefined reference to `ompi_mpi_cxx_op_intercept'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libboost_mpi.so: undefined reference to `ompi_mpi_datatype_null'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libboost_mpi.so: undefined reference to `ompi_mpi_comm_world'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libboost_mpi.so: undefined reference to `ompi_mpi_unsigned_long'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libboost_mpi.so: undefined reference to `ompi_mpi_group_empty'
collect2: error: ld returned 1 exit status
make[2]: *** [Test] Error 1
make[1]: *** [CMakeFiles/Test.dir/all] Error 2
make: *** [all] Error 2

Other information

My libboost was installed by apt-get install libboost-dev-all, and version number is 1.54. My GCC version is 4.8.4, MPICH version is 3.2.

Here is my testing code:

#include <boost/mpi.hpp>
#include <iostream>

int main(int argc, char *argv[])
{
    boost::mpi::environment env{argc, argv};
    boost::mpi::communicator world;
    std::cout << world.rank() << ", " << world.size() << '\n';
}
JZH
  • 11
  • 4
  • 2
    `libboost_mpi.so` is built on top of Open MPI (e.g. **not** MPICH). You should either install and use boostmpi built on top of MPICH, or install and use Open MPI – Gilles Gouaillardet Jul 05 '18 at 02:25
  • How can i install boostmpi built on top of MPICH? I just use apt-get install boost-all. – JZH Jul 05 '18 at 02:29
  • 1
    per https://stackoverflow.com/questions/12505476/using-mpich-with-boost-mpi-on-ubuntu there is no such package and you should either rebuild boostmpi, or use Open MPI – Gilles Gouaillardet Jul 05 '18 at 02:50

1 Answers1

0

What Ubuntu version are you using? The above looks a little odd. Looks like a really old system?

apt -y install libboost-mpi-dev libmpich-dev openmpi-bin

should set you up just fine. libboost-mpi-dev is not part of boost-all. Afterwards build your code:

mpicxx -std=c++11 -o test test.cpp -lboost_mpi

where you code is in test.cpp. Test with:

mpiexec -np 4 ./test
Kaveh Vahedipour
  • 3,412
  • 1
  • 14
  • 22