3

I have a simple C program reproduces a recent problem I encountered.

/* filename: a.c */
#include <mpi.h>
#include <evhttp.h>

int main(int argc, char *argv[])
{
        MPI_Init(&argc, &argv);
        event_init();
        MPI_Finalize();
}

The program has no problem when I compile on an ArchLinux environment using gcc 9.1.0, libevent 2.1.11-1 and openmpi 4.0.1-1:

gcc a.c -levent $(mpicc --showme:link) $(mpicc --showme:compile)

However, on Ubuntu, it seems the $(mpicc --showme:compile) will also include some libevent headers from openmpi/opal/mca/event/libevent2021/libevent conflicting with libevent-dev already installed.

So I only extract the header path of <mpi.h> then compile and link the program using:

gcc a.c -levent $(mpicc --showme:link) -I/usr/lib/x86_64-linux-gnu/openmpi/include

and the program will raise segmentaion fault.

Is this a bug of the building environment or I am doing it in a wrong way?

Wei Zhong
  • 580
  • 10
  • 17
  • 2
    Distro are recommended using their own libraries (libevent, hwloc, ...) instead of the library embedded in Open MPI whenever possible (there are some version requirements). So if Open MPI could have been packaged with the distro provided libevent then this can be considered as a bug – Gilles Gouaillardet Dec 02 '19 at 11:23
  • @GillesGouaillardet thanks, I am now more confirmed it is an environment issue. – Wei Zhong Dec 02 '19 at 11:35

0 Answers0