0

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
Puppy
  • 144,682
  • 38
  • 256
  • 465
mcExchange
  • 6,154
  • 12
  • 57
  • 103
  • I could tell you what the problem is, but since you didn't even post the code that failed to compile, I see little reason to aid you. You don't seem to have done any serious investigation of... anything. – Puppy Feb 15 '16 at 15:46
  • Hmm. What do you mean? The complete source code? (impossible to post) The library is called regression tree fields (if that was the question) – mcExchange Feb 15 '16 at 15:48
  • You could always try narrowing it down a bit first. That's usually the first step of figuring out what a problem is. – Puppy Feb 15 '16 at 15:48
  • Alright, as I said, I would guess the `undefined reference` error is due to a incompatibility between my newer boost version and the one that is required as minimum. So I think teaching `cmake` how to look for my local installation of boost 1.49 might solve the problem. But since I'm a novice in `cmake` I don't know how to change the CMakeList.txt` in that way... – mcExchange Feb 15 '16 at 15:52
  • Read documentation for [findBoost](https://cmake.org/cmake/help/v3.0/module/FindBoost.html) about hinting `find_package(Boost)` to custom installation. Or use [generic approach](http://stackoverflow.com/questions/34795816/hinting-findname-cmake-files-with-a-custom-directory/34797156#34797156). When show error build log for others, please, disable parallel make (`make -j1`): build log for parallel build usually is a mess. – Tsyvarev Feb 15 '16 at 17:11
  • 1
    Thanks for the tip. At least I could now compile the source code using `boost 1.49`. Unfortunately the error `boost::mpi::exception` remains. I guess it's rather a problem with mpi than with boost afterall... – mcExchange Feb 15 '16 at 18:03

0 Answers0