Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: Re: [OMPI devel] Help on building openmpi with "-Wl, --as-needed -Wl, --no-undefined"
From: Brian W. Barrett (brbarret_at_[hidden])
Date: 2008-07-21 19:08:45

On Sun, 20 Jul 2008 21:13:48 +0200, Ralf Wildenhues
<Ralf.Wildenhues_at_[hidden]> wrote:
> * Funda Wang wrote on Sun, Jul 20, 2008 at 05:29:57AM CEST:
>> I'm currently building openmpi 1.2.6 under Mandriva cooker, and its
>> default LDFLAGS is "-Wl,--as-needed -Wl,--no-undefined".
>> But openmpi 1.2.6 builds failed with:
>> libtool: link: g++ -shared -nostdlib
>> /usr/lib/gcc/i586-manbo-linux-gnu/4.3.1/../../../crti.o
>> /usr/lib/gcc/i586-manbo-linux-gnu/4.3.1/crtbeginS.o .libs/mpicxx.o
>> .libs/intercepts.o .libs/comm.o .libs/datatype.o .libs/file.o
>> .libs/win.o -lnsl -lutil -L/usr/lib/gcc/i586-manbo-linux-gnu/4.3.1
>> -L/usr/lib/gcc/i586-manbo-linux-gnu/4.3.1/../../.. -lstdc++ -lm
>> -lpthread -lc -lgcc_s
>> /usr/lib/gcc/i586-manbo-linux-gnu/4.3.1/crtendS.o
>> /usr/lib/gcc/i586-manbo-linux-gnu/4.3.1/../../../crtn.o -march=i586
>> -mtune=generic -pthread -Wl,--no-undefined -pthread -Wl,-soname
>> -Wl, -o .libs/
>> .libs/mpicxx.o: In function `Errhandler':
>> undefined reference to `ompi_mpi_errors_are_fatal'
> I suppose ompi/mpi/cxx/ is missing some libmpi_cxx_la_LIBADD
> line.

Yeah, Ralf's correct -- Open MPI's missing the LIBADD fields to cause the
C++, F77, and F90 bindings to not link against (which they depend

There's no good solution to this problem in Open MPI 1.2.6, other than to
not build with -Wl,--no-undefined. The fix requires rebuilding the
Makefile, which is a little dicy from an Open MPI release tarball.
Hopefully, one of the current developers can patch this for upcoming
releases. Unfortunately, most of the time, such a link isn't really
required, so this never came up before. It does seem weird that a
distribution would enable that option by default, since many projects don't
properly handle the situation well.