Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Resolving 'mpicc: No such file or directory' Compilation Error

Tech 1

Root Cause and Solutions

Missing MPI Development Packages

The error occurs when MPI compiler wrappers are not available in the system. Check if MPI libraries are installed:

rpm -qa | grep -i mpi

Install the required packages using:

# Option 1: OpenMPI
yum install openmpi openmpi-devel

# Option 2: MPICH
yum install mpich mpich-devel

The -devel packages are esential as they provide the compiler wrappers like mpicc, while base packages only include runtime components such as mpirun.

Path Configuration Issues

After installation, MPI executables are typically located in /usr/lib64/openmpi/bin or /usr/lib64/mpich/bin. These directory are not automatically added to system PATH during installation.

To resolve this:

# Temporary solution
export PATH=/usr/lib64/openmpi/bin:$PATH

# Permanent solution
echo 'export PATH=/usr/lib64/openmpi/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

Anaconda Environment Conflicts

When Anaconda is installed, its bin directory often takes precedence in PATH, potentially overriding system MPI installations. Even if Anaconda includes mpicc, it may not function correctly due to missing dependencies or incorrect configurations.

Verify which mpicc is being used:

which mpicc
whereis mpicc

To prioritize system MPI over Anaconda:

# Reorder PATH to prioritize system MPI
export PATH=/usr/lib64/openmpi/bin:$PATH:/opt/anaconda3/bin

This ensures the functional system MPI compiler wrapper is used instead of the non-working Anaconda version.

Tags: mpimpicc

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.