Build failures, but build succeds

Issue #111 resolved
yurivict created an issue

I'm getting build errors in the FreeBSD port with the version 3.0.0:

/usr/local/bin/mpicc -DNDEBUG -O2 -pipe -fno-omit-frame-pointer -fstack-protector -fno-strict-aliasing -fno-omit-frame-pointer -fPIC -c _configtest.c -o _configtest.o
/usr/local/bin/mpicc /usr/local/lib/gcc7/libgcc_s.so -lmpifort -Wl,-rpath=/usr/local/lib/gcc7 -L/usr/local/lib/gcc7 -B/usr/local/bin -fstack-protector -O2 -pipe -fno-omit-frame-pointer -fstack-protector -fno-strict-aliasing -fno-omit-frame-pointer _configtest.o -lvt.mpi -o _configtest
/usr/local/bin/ld: cannot find -lvt.mpi
cc: error: linker command failed with exit code 1 (use -v to see invocation)
/usr/local/bin/mpicc /usr/local/lib/gcc7/libgcc_s.so -lmpifort -Wl,-rpath=/usr/local/lib/gcc7 -L/usr/local/lib/gcc7 -B/usr/local/bin -fstack-protector -O2 -pipe -fno-omit-frame-pointer -fstack-protector -fno-strict-aliasing -fno-omit-frame-pointer _configtest.o -L/usr/local/lib -Lbuild/temp.freebsd-11.2-STABLE-amd64-2.7 -o _configtest
_configtest.o: In function `main':
_configtest.c:(.text+0x9): undefined reference to `MPI_Status_c2f'
cc: error: linker command failed with exit code 1 (use -v to see invocation)

Despite the errors, build succeeds and the tests pass.

Comments (11)

  1. Lisandro Dalcin

    Yes, these are configure tests to check for the availability of extra stuff. However, it seems that something is wrong with Fortran stuff. What's the output of mpif90 -show ?

  2. yurivict reporter
    $ mpif90 -show
    gfortran7 -Wl,-rpath=/usr/local/lib/gcc7 -L/usr/local/lib/gcc7 -B/usr/local/bin -I/usr/local/include -I/usr/local/include -L/usr/local/lib -lmpifort -Wl,-rpath -Wl,/usr/local/lib -lmpi
    
  3. Lisandro Dalcin

    Does libmpifort.so actually exists? Can you figure out if the symbol MPI_Status_c2f is available on any of the MPICH shared libraries?

  4. yurivict reporter

    libmpifort.so exists.

    This symbol is in libmpi

    $ nm /usr/local/lib/libmpi.a | grep MPI_Status_c2f
    0000000000000000 T PMPI_Status_c2f
    

    pkg-config says that libmpi is what should be linked:

    $ pkg-config --libs mpich
    -Wl,-rpath -Wl,/usr/local/lib -L/usr/local/lib -lmpi -lpthread
    
  5. Lisandro Dalcin

    libmpi.a is static, so we should not be looking at that one. You should really look at libmpi.so, but given than the symbol is in libmpi.a, it should be in libmpi.so (I hope). Does nm work on libmpi.so to double check?

    About pkg-config saying that libmpi is what should be linked, please note mpi4py is using the mpicc compiler wrapper, that it should take care of that, run mpicc -link-info to confirm.

    But wait! The symbol name in your libmpi.a starts with PMPI_ (corresponds to the MPI profiling interface), and not MPI_ (the regular MPI calls), look what I get in my Fedora system:

    $ readelf -s /usr/lib64/mpich/lib/libmpi.so | grep MPI_Status_c2
       447: 00000000000e7760    94 FUNC    GLOBAL DEFAULT   11 PMPI_Status_c2f
       572: 00000000000e7760    94 FUNC    WEAK   DEFAULT   11 MPI_Status_c2f
    

    So something weird is going on with the MPICH library in your system, something about Fortran interoperability seems to be broken. You should report it to the MPICH package maintainers.

    All that being said, mpi4py should build and run just fine if some pieces of Fortran interoperability are missing/broken. If the MPICH library gets fixed eventually, you should rebuild the mpi4py package.

  6. yurivict reporter

    *.a libraries should have about the same symbol set as their *.so counterpart. But yes, MPI_Status_c2f is missing in libmpi.so for an unknown reason.

  7. Lisandro Dalcin

    Well, at this point, you have no other option than reporting this issue to the FreeBSD MPICH package maintainers. In the mean time, you can build and use mpi4py without major issues. I do not expect too much code (if any) making use of Python <-> Fortran conversions for MPI_Status.

  8. yurivict reporter

    Unfortunately, mpich package is unmaintained, and I will have to fix this myself. I will ask on the mpich ML.

  9. Log in to comment