Quantcast
Viewing all articles
Browse latest Browse all 22143

MPI and libevent mixed code causes Segmentation fault on Ubuntu

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?


Viewing all articles
Browse latest Browse all 22143

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>