[mpich-discuss] mpich2-1.3 and mpe2-1.3 tests fail with undefined references

Anthony Chan chan at mcs.anl.gov
Fri Nov 12 16:12:24 CST 2010


The following tests can be avoid if you configure MPE2 or MPICH2
with --disable-graphics.

> 
> Running build runtest for C graphics program...
> 
> *** Test C program with the MPI animation library
> ........................ No.
> The failed command is :
> /usr/lib64/mpi/mpi-mpich2/usr/bin/mpicc
> -I/var/tmp/portage/mpi-mpich2/mpe2-1.3.0/work/mpe2-1.3.0/include -c
> cpi.c
> /var/tmp/portage/mpi-mpich2/mpe2-1.3.0/work/mpe2-1.3.0/bin/mpecc
> -mpianim -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -o cpi_anim
> cpi.o -lm
> /var/tmp/portage/mpi-mpich2/mpe2-1.3.0/work/mpe2-1.3.0/lib/libampe.a(visual_mess.po):
> In function `MPI_Init':
> visual_mess.c:(.text+0x1623): undefined reference to `sincos'
> /var/tmp/portage/mpi-mpich2/mpe2-1.3.0/work/mpe2-1.3.0/lib/libmpe.a(xcolor.po):
> In function `XBSetCmapHue':
> xcolor.c:(.text+0x803): undefined reference to `pow'
> xcolor.c:(.text+0x810): undefined reference to `trunc'
> xcolor.c:(.text+0x834): undefined reference to `pow'
> xcolor.c:(.text+0x841): undefined reference to `trunc'
> xcolor.c:(.text+0x866): undefined reference to `pow'
> xcolor.c:(.text+0x873): undefined reference to `trunc'
> collect2: ld returned 1 exit status
> make[2]: *** [cpi_anim] Error 1

The symbols, sincos, pow and trunc, are normally resolved by libm.a/libm.so.
-lm is used in the link command.  It seems mpicc refuses to link with -lm,
so my guess is that some of the CFLAGS or LDFLAGS may be incompatible with
"-lm",

Can you check if "/usr/lib64/mpi/mpi-mpich2/usr/bin/mpicc -o pow pow.c -lm"
links with the following program ?

> cat pow.c
#include <math.h>
#include <stdio.h>

int main( int argc, char *argv[] )
{
    double z, x = 2.0, y = 2.0;
    z = pow(x,y);
    printf( "%f\n", z);
    return 0;
}


> $ mpich2version
> MPICH2 Version: 1.3
> MPICH2 Release date: Fri Oct 22 14:50:07 CDT 2010
> MPICH2 Device: ch3:nemesis
> MPICH2 configure: --prefix=/usr --build=x86_64-pc-linux-gnu
> --host=x86_64-pc-linux-gnu --mandir=/usr/share/man
> --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc
> --localstatedir=/var/lib --libdir=/usr/lib64/mpi/mpi-mpich2/usr/lib64
> --prefix=/usr/lib64/mpi/mpi-mpich2/usr
> --mandir=/usr/lib64/mpi/mpi-mpich2/usr/share/man
> --infodir=/usr/lib64/mpi/mpi-mpich2/usr/share/info
> --datadir=/usr/lib64/mpi/mpi-mpich2/usr/share
> --sysconfdir=/etc/mpi-mpich2 --localstatedir=/var/lib/mpi-mpich2
> --enable-shared --enable-sharedlibs=gcc --enable-g=all
> --enable-debuginfo --with-thread-package=pthreads
> --enable-threads=default --enable-f77 --enable-fc
> --docdir=/usr/lib64/mpi/mpi-mpich2//usr/share/doc/mpich2-1.3
> --with-pm=hydra --disable-mpe --with-hwloc-prefix=/usr --enable-romio
> --enable-cxx
> MPICH2 CC: x86_64-pc-linux-gnu-gcc -march=core2 -O2 -pipe -msse4.1 -g
> -O2
> MPICH2 CXX: x86_64-pc-linux-gnu-g++ -march=core2 -O2 -pipe -msse4.1 -g
> -O2
> MPICH2 F77: x86_64-pc-linux-gnu-gfortran -g -O2
> MPICH2 FC: x86_64-pc-linux-gnu-gfortran -g -O2

AFAIK, --host and --build should be different (otherwise no point in setting
these variables).  Setting these 2 flags turns on the cross-compile support
in mpich2's configury. 

A.Chan


More information about the mpich-discuss mailing list