Compilation of MPI C/C++ codes fails with mpich
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
mpich (Ubuntu) |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
A few days ago, I have upgraded several machines from Ubuntu 20.10 to 21.04. Since then, I cannot compile anymore the C++ code that I am working on. The compilation (actually linking) with mpic++ fails with the following message
/usr/bin/ld: /usr/lib/
/usr/bin/ld : /lib/x86_
collect2: error: ld returned 1 exit status
I tried to add -pthread -lpthread. I now get the message
/usr/bin/ld : /usr/lib/
(.text+0x137) : référence indéfinie vers « aio_suspend »
/usr/bin/ld : (.text+0x191) : référence indéfinie vers « aio_error »
/usr/bin/ld : (.text+0x1a4) : référence indéfinie vers « aio_return »
/usr/bin/ld : /usr/lib/
(.text+0x32a) : référence indéfinie vers « aio_error »
/usr/bin/ld : (.text+0x345) : référence indéfinie vers « aio_return »
/usr/bin/ld : /usr/lib/
(.text+0x471) : référence indéfinie vers « aio_write »
/usr/bin/ld : (.text+0x501) : référence indéfinie vers « aio_read »
collect2: error: ld returned 1 exit status
Note that my code still compiles on other machines with older Ubuntu distribution.
The problem can be reproduced with the much simpler MPI example (taken from https:/
#include <mpi.h>
#include <stdio.h>
int main(int argc, char** argv) {
// Initialize the MPI environment
MPI_Init(NULL, NULL);
// Get the number of processes
int world_size;
MPI_
// Get the rank of the process
int world_rank;
MPI_
// Get the name of the processor
char processor_
int name_len;
MPI_
// Print off a hello world message
printf("Hello world from processor %s, rank %d out of %d processors\n",
// Finalize the MPI environment.
MPI_Finalize();
}
The compilation with the command mpicc test.c returns the error message
/usr/bin/ld : /usr/lib/
(.text+0x4d2) : référence indéfinie vers « pthread_join »
/usr/bin/ld : /usr/lib/
(.text+0x159) : référence indéfinie vers « pthread_
/usr/bin/ld : (.text+0x166) : référence indéfinie vers « pthread_
/usr/bin/ld : (.text+0x170) : référence indéfinie vers « pthread_
/usr/bin/ld : /usr/lib/
(.text+0x243) : référence indéfinie vers « pthread_
/usr/bin/ld : (.text+0x250) : référence indéfinie vers « pthread_
/usr/bin/ld : (.text+0x25a) : référence indéfinie vers « pthread_
/usr/bin/ld : /usr/lib/
(.text+0x13a9) : référence indéfinie vers « pthread_
/usr/bin/ld : (.text+0x13ca) : référence indéfinie vers « pthread_
/usr/bin/ld : (.text+0x1408) : référence indéfinie vers « pthread_
/usr/bin/ld : /usr/lib/
(.text+0x70) : référence indéfinie vers « pthread_create »
/usr/bin/ld : /usr/lib/
(.text+0x137) : référence indéfinie vers « aio_suspend »
/usr/bin/ld : (.text+0x191) : référence indéfinie vers « aio_error »
/usr/bin/ld : (.text+0x1a4) : référence indéfinie vers « aio_return »
/usr/bin/ld : /usr/lib/
(.text+0x32a) : référence indéfinie vers « aio_error »
/usr/bin/ld : (.text+0x345) : référence indéfinie vers « aio_return »
/usr/bin/ld : /usr/lib/
(.text+0x471) : référence indéfinie vers « aio_write »
/usr/bin/ld : (.text+0x501) : référence indéfinie vers « aio_read »
My system is up-to-date:
lsb_release -rd
Description: Ubuntu 21.04
Release: 21.04
dpkg -l "*mpich*"
Souhait=
| État=Non/
|/ Err?=(aucune)
||/ Nom Version Architecture Description
+++-===
ii libmpich-dev:amd64 3.4.1-3build1 amd64 Development files for MPICH
ii libmpich12:amd64 3.4.1-3build1 amd64 Shared libraries for MPICH
ii mpich 3.4.1-3build1 amd64 Implementation of the MPI Message Passing Interface standard
apt-cache policy mpich
mpich:
Installé : 3.4.1-3build1
Candidat : 3.4.1-3build1
Table de version :
*** 3.4.1-3build1 500
500 http://
100 /var/lib/
ProblemType: Bug
DistroRelease: Ubuntu 21.04
Package: mpich 3.4.1-3build1
ProcVersionSign
Uname: Linux 5.11.0-17-generic x86_64
ApportVersion: 2.20.11-0ubuntu65
Architecture: amd64
CasperMD5CheckR
CurrentDesktop: LXQt
Date: Wed May 19 20:51:59 2021
InstallationDate: Installed on 2019-01-20 (849 days ago)
InstallationMedia: Ubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725)
SourcePackage: mpich
UpgradeStatus: Upgraded to hirsute on 2021-05-13 (6 days ago)
Changed in mpich (Ubuntu): | |
status: | New → Fix Committed |
Solution: reinstall mpich !