0

So the title basically says what's going on. At first, I thought it must have been the MPI libraries because I had not built them at the time. After tearing out my hair for a while, I managed to get that solved. Now, however, the same error I got before I managed to get the libraries is still persistent, and I really don't know why!

The error is

C:/Users/Krist/Desktop/files/mpistuffs/mpi q cir sim/mpiqcs/main.cpp:66: undefined reference to `boost::mpi::environment::environment(bool)'
C:/Users/Krist/Desktop/files/mpistuffs/mpi q cir sim/mpiqcs/main.cpp:66:(.text+0x5d3): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::mpi::environment::environment(bool)'

I get this every I call

boost::mpi::environment

This applies to all members of boost::mpi as far as I can tell.

My build command is

g++.exe -L"C:/Program Files/boost/boost_1_58_0/stage/lib" -L"C:/Program Files/MPICH2/lib" -L"C:/Program Files/boost/boost_1_58_0/stage/lib" -L"C:/Program Files/MPICH2/lib" -o bin/Debug/mpiqcs.exe obj/Debug/main.o   "C:/Program Files/MPICH2/lib/libmpi.a" "C:/Program Files/MPICH2/lib/libmpicxx.a" C:/Boost/boost_1_58_0/stage/lib/libboost_system-mgw48-mt-d-1_58.a C:/Boost/boost_1_58_0/stage/lib/libboost_mpi-mgw48-mt-d-1_58.a C:/Boost/boost_1_58_0/stage/lib/libboost_serialization-mgw48-mt-d-1_58.a
obj/Debug/main.o

I don't want to post my errors on here, but at this point I'm just stumped. I've been at this for a few days now.

My system is Windows 7 64bit, running boost 1.58.0, MPICH2, latest MinGW G++ compiler, and I'm using the Code::Blocks IDE if that makes any difference

EDIT: Oops, I'm actually using the cygwin g++ compiler.

user3210986
  • 211
  • 2
  • 9
  • I'd personally give it a try with mingw-w64 in msys2 or cygwin. The original mingw you're using hasn't been updated for a few years. –  Aug 17 '15 at 01:21
  • Also, I've just found out that msys2 provides the boost library via its own package manager. I strongly recommend trying this one out. –  Aug 17 '15 at 01:29
  • Tried using mingw distribution through cygwin, as well as the gnu g++ compiler available with cygwin. No change. I'm going to try msys2 and I'll report back about whether that works or not. – user3210986 Aug 17 '15 at 01:54
  • Be sure to link to boost installed via msys2 pacman. –  Aug 17 '15 at 01:59
  • Did it work well with msys2? Otherwise there should be a bug report for it as a package defect. –  Aug 17 '15 at 14:09
  • I have it installed, but I can't figure out how to build the boost.mpi libraries with the msys2 distribution. – user3210986 Aug 18 '15 at 01:02
  • You don't build it. You just have to install boost with `pacman`. The msys2 maintainers do the job for you. –  Aug 18 '15 at 02:50
  • See this. http://sourceforge.net/p/msys2/wiki/MSYS2%20installation/ –  Aug 18 '15 at 02:50
  • boost.mpi has to be built for a specific system for a specific implementation of MPI. there are a few other libraries that need to be built before they can be used/linked. – user3210986 Aug 18 '15 at 03:07
  • That's exactly the job of the package manager. It automatically resolves the build depencencies. Try `pacman -Ss boost` if you want to search boost related packages. –  Aug 18 '15 at 03:13
  • And probably `pacman -S boost` to install boost. You may need to `pacman -S gcc g++` before anything. –  Aug 18 '15 at 03:16
  • This is the boost I installled: mingw64/mingw-w64-x86_64-boost 1.57.0-3 – user3210986 Aug 18 '15 at 03:20
  • It only came with the header libraries (to my knowledge), and I can't seem to fine anything about building the non-header libraries with the msys2/pacman distribution – user3210986 Aug 18 '15 at 03:21
  • Write a small test program and compile to see if it works. –  Aug 18 '15 at 03:29
  • I searched a bit about mpi and I do see your problem. So boost mpi depends on an mpi implementation and you have a problem here. In this case try compiling a very basic mpi program without the boost wrappers and simplify the problem. If you still see a problem you will very likely get good answers from here, with a clearer and simpler question. –  Aug 18 '15 at 03:45
  • I've successfully compiled basic MPI programs, but I'm not a huge fan of strictly using basic C. I will if I absolutely have to, but C++ makes things infinitely easier. This is why I want to get boost working; however, I might have found the the problem: the libraries I built for boost.mpi aren't being read correctly/at all. (Before you ask, I am linking them properly) – user3210986 Aug 18 '15 at 03:55
  • This may help. http://stackoverflow.com/questions/10486116/what-does-this-gcc-error-relocation-truncated-to-fit-mean –  Aug 18 '15 at 04:04
  • This seems more relavant to yours. https://www.cygwin.com/ml/cygwin/2014-04/msg00058.html –  Aug 18 '15 at 04:18

0 Answers0