INCF / MUSIC

MUSIC, the MUltiSimulation Coordinator
GNU General Public License v3.0
38 stars 38 forks source link

Problems linking MUSIC on OSX #29

Closed heplesser closed 8 years ago

heplesser commented 8 years ago

I built MUSIC from master with changes from #26 merged (see also #28) and also the changes in #24 merged. I then hit the following problem:

/bin/sh ../libtool  --tag=CXX   --mode=link g++-6 -I../../music/src -I../src -I../../music -I/usr/local/Cellar/open-mpi/2.0.1/include -g -O3   -o music music-music.o ../src/libmusic.la ../mpidep/libmpidep.la -L/usr/local/Cellar/open-mpi/2.0.1/lib/ -lmpi 
libtool: link: g++-6 -I../../music/src -I../src -I../../music -I/usr/local/Cellar/open-mpi/2.0.1/include -g -O3 -o .libs/music music-music.o -Wl,-bind_at_load  ../src/.libs/libmusic.dylib -L/usr/local/Cellar/open-mpi/2.0.1/lib/ ../mpidep/.libs/libmpidep.a -lmpi
Undefined symbols for architecture x86_64:
  "MPI::Win::Free()", referenced from:
      vtable for MPI::Win in music-music.o
  "MPI::Comm::Comm()", referenced from:
      MPI::Intracomm::Clone() const in music-music.o
      MPI::Graphcomm::Clone() const in music-music.o
      MPI::Cartcomm::Sub(bool const*) const in music-music.o
      MPI::Intracomm::Create_graph(int, int const*, int const*, bool) const in music-music.o
      MPI::Cartcomm::Clone() const in music-music.o
      MPI::Intracomm::Create_cart(int, int const*, bool const*, bool) const in music-music.o
      MPI::Intercomm::Merge(bool) const in music-music.o
      ...
  "MPI::Datatype::Free()", referenced from:
      vtable for MPI::Datatype in music-music.o
  "_ompi_mpi_cxx_op_intercept", referenced from:
      MPI::Op::Init(void (*)(void const*, void*, int, MPI::Datatype const&), bool) in music-music.o
ld: symbol(s) not found for architecture x86_64

Does anyone have an idea what might be going wrong? I am linking against OpenMPI 2.0.1 from Homebrew under OSX 10.11.6 with gcc 6.2.1, also from Homebrew.

mdjurfeldt commented 8 years ago

It's strange that -lmpi_cxx is not included in the link line. The music configure.ac uses mpicxx -showme:link to obtain the correct link line, and on my openmpi installation -lmpi_cxx is included.

heplesser commented 8 years ago

@mdjurfeldt My error! In order to force compilation with g++ instead of clang++, I configure with CC=gcc-6 CXX=g++-6. That seems to throw off MPI-wrapper detection, so I need to pass include and linker files manually, and there I forgot -lmpi_cxx.

It all worked nicely with the following configure line:

../music/configure CC=gcc-6 CXX=g++-6 \
MPI_CFLAGS=-I/usr/local/Cellar/open-mpi/2.0.1/include \
MPI_CXXFLAGS=-I/usr/local/Cellar/open-mpi/2.0.1/include \
MPI_LDFLAGS='-L/usr/local/Cellar/open-mpi/2.0.1/lib/ -lmpi_cxx -lmpi'