[mpich-discuss] Undefined references to MPL, seems to be caused by --if-needed

Anthony Chan chan at mcs.anl.gov
Fri Nov 19 09:55:43 CST 2010


Jed,

Can you tell us how do you configure mpich2 ?

A.Chan

----- Original Message -----
> MPICH2 1.3.1:
> 
> $ cat cxx.C
> #include <mpi.h>
> 
> int main(int argc,char *argv[])
> {
> MPI_Comm comm;
> 
> MPI::Init(argc,argv);
> MPI::Finalize();
> return 0;
> }
> $ /opt/mpich2/bin/mpicxx cxx.C
> /opt/mpich2/lib/libmpich.so: undefined reference to `MPL_trfree'
> /opt/mpich2/lib/libmpich.so: undefined reference to `MPL_env2str'
> /opt/mpich2/lib/libmpich.so: undefined reference to `MPL_trlevel'
> /opt/mpich2/lib/libmpich.so: undefined reference to `MPL_trvalid'
> /opt/mpich2/lib/libmpich.so: undefined reference to `MPL_trmalloc'
> /opt/mpich2/lib/libmpich.so: undefined reference to `MPL_trspace'
> /opt/mpich2/lib/libmpich.so: undefined reference to `MPL_env2range'
> /opt/mpich2/lib/libmpich.so: undefined reference to `MPL_trcalloc'
> /opt/mpich2/lib/libmpich.so: undefined reference to `MPL_env2int'
> /opt/mpich2/lib/libmpich.so: undefined reference to `MPL_trdump'
> /opt/mpich2/lib/libmpich.so: undefined reference to `MPL_env2bool'
> /opt/mpich2/lib/libmpich.so: undefined reference to `MPL_trstrdup'
> /opt/mpich2/lib/libmpich.so: undefined reference to `MPL_trrealloc'
> /opt/mpich2/lib/libmpich.so: undefined reference to `MPL_TrSetMaxMem'
> /opt/mpich2/lib/libmpich.so: undefined reference to `MPL_trinit'
> /opt/mpich2/lib/libmpich.so: undefined reference to `MPL_trDebugLevel'
> /opt/mpich2/lib/libmpich.so: undefined reference to `MPL_trid'
> collect2: ld returned 1 exit status
> $ /opt/mpich2/bin/mpicxx -show cxx.C
> c++ -Wl,--hash-style=gnu -Wl,--as-needed cxx.C -I/opt/mpich2/include
> -L/opt/mpich2/lib -Wl,-rpath -Wl,/opt/mpich2/lib -lmpichcxx -lmpich
> -lopa
> -lmpl -lpthread -lrt
> $ c++ -Wl,--hash-style=gnu cxx.C -I/opt/mpich2/include
> -L/opt/mpich2/lib
> -Wl,-rpath -Wl,/opt/mpich2/lib -lmpichcxx -lmpich -Wl,--as-needed
> -lopa
> -lmpl -lpthread -lrt
> $ ./a.out
> 
> It's not clear to me why the symbols in libmpich.so are not being
> marked as
> needed. This does not happen when compiling C programs (with mpicc or
> mpicxx). It's possible that it is a linker bug, but I have not seen
> this
> issue with any other packages. Perhaps it's a circular reference.
> 
> c++ (GCC) 4.5.1
> GNU ld (GNU Binutils) 2.20.1.20100521
> 
> 
> These link errors aside, I think it is incorrect for MPICH to include
> user-specified libraries in the --as-needed sequence:
> 
> $ /opt/mpich2/bin/mpicxx -show cxx.C -lfoo
> c++ -Wl,--hash-style=gnu -Wl,--as-needed cxx.C -lfoo
> -I/opt/mpich2/include
> -L/opt/mpich2/lib -Wl,-rpath -Wl,/opt/mpich2/lib -lmpichcxx -lmpich
> -lopa
> -lmpl -lpthread -lrt
> 
> I think the --as-needed should only come after the last of the user's
> parameters (they may turn it on, but it shouldn't be on by default for
> their
> libraries).
> 
> Jed
> 
> _______________________________________________
> mpich-discuss mailing list
> mpich-discuss at mcs.anl.gov
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss


More information about the mpich-discuss mailing list