cea-hpc / wi4mpi

Wrapper interface for MPI
BSD 3-Clause "New" or "Revised" License
80 stars 15 forks source link

mpicc configure dlopen link error with ubuntu #46

Closed adrien-cotte closed 11 months ago

adrien-cotte commented 1 year ago

On ubuntu, mpicc wrappers of mpich and openmpi have -L/lib/x86_64-linux-gnu/ -ldl.

Wi4MPI mpicc doesn't so osu-microbenchmark configure fails with undefined reference to dlopen.

The workaround is:

./configure CC=mpicc CXX=mpicxx LIBS="-L/lib/x86_64-linux-gnu/ -ldl"

We must add this knowledge inside the mpicc wrapper of Wi4MPI.

Maybe something like that?

# Ubuntu-like distributions have a specific path to libdl.so, this fix ./configure MPI detect
if [[ -e "/lib/x86_64-linux-gnu/libdl.so" ]]; then
    WI4MPI_LDFLAGS="${WI4MPI_LDFLAGS} -L/lib/x86_64-linux-gnu/ -ldl"
fi
adrien-cotte commented 1 year ago

Well, my initial post is wrong.

The real workaround is :

./configure CC=mpicc CXX=mpicxx LDFLAGS="-Wl,--no-as-needed"

It seems to be useful only in an Ubuntu Dockerfile. Weird but not sure it is related to Wi4MPI.

Maybe we can close this issue.

adrien-cotte commented 1 year ago

Should be add in documentation.

marcjoos-cea commented 11 months ago

Documented in Podman tutorial from c1862af