I'm trying to compile some open source code and it gives me the following error shown above.
I guess it means that the code is acutally compiling but during linking it cannot find this boost::mpi::exception
library.
However I installed libboost-mpi-dev
and successfully compiled some toy examples of boost::mpi
like this one for example:
#include <boost/mpi/environment.hpp>
#include <boost/mpi/communicator.hpp>
#include <iostream>
namespace mpi = boost::mpi;
int main()
{
mpi::environment env;
mpi::communicator world;
std::cout << "I am process " << world.rank() << " of " << world.size()
<< "." << std::endl;
return 0;
}
For compilation of the open source code I'm using a CMakeList.txt
file.
I have a feeling that my boost 1.54
(standard Ubuntu 14.04 version) is not downward compatible to boost 1.49
which the authors specify as minimum requirement in their CMakeList.txt:
find_package(MPI)
if( MPI_FOUND )
find_package(Boost 1.49 COMPONENTS mpi)
if( Boost_MPI_FOUND )
message(status "** MPI support enabled")
message(status "** MPI Libraries: ${MPI_LIBRARIES}")
### When I uncomment the next line the Code actually compiles however only without MPI ####
add_definitions(-DUSE_MPI)
else ()
message(status "** MPI library found but Boost MPI not available; MPI support disabled.")
endif ()
endif ()
find_package(Boost 1.49 COMPONENTS system filesystem REQUIRED)
message(status "** Boost Include: ${Boost_INCLUDE_DIR}")
message(status "** Boost Libraries: ${Boost_LIBRARY_DIRS}")
message(status "** Boost Libraries: ${Boost_LIBRARIES}")
[...]
Unfortunately even compiling boost 1.49
didn't help me, since the CMakeList.txt
is constructed such that it only finds the globally installed boost 1.54
instead of the locally installed boost 1.49
, although I added the local path to my LD_LIBRARY_PATH.
Has anyone an idea how to fix that problem?
PS: This was the complete error message that appeared during make
:
CMakeFiles/ColorDenoising.dir/ColorDenoising.cpp.o:(.rodata._ZTIN5boost16exception_detail19error_info_injectorINS_3mpi9exceptionEEE[_ZTIN5boost16exception_detail19error_info_injectorINS_3mpi9exceptionEEE]+0x18): undefined reference to `typeinfo for boost::mpi::exception'
collect2: error: ld returned 1 exit status
make[2]: *** [Apps/ColorDenoising/ColorDenoising] Error 1
make[1]: *** [Apps/ColorDenoising/CMakeFiles/ColorDenoising.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Linking CXX executable MultiLabel
[100%] Built target MultiLabel
make: *** [all] Error 2