본문 바로가기

C C++

라이브러리 설치 위치 잡는 법

When building Open MPI from source on Ubuntu, two common approaches for setting the --prefix are:

1. Install system-wide in /usr/local

This is the default prefix if you don’t specify one. You’ll end up with:

Executables in /usr/local/bin

Libraries in /usr/local/lib

Headers in /usr/local/include

This is a simple approach if you only need one custom version, and you don’t mind overwriting the distro-provided MPI (or having multiple MPI versions in your PATH).

2. Use an isolated location, e.g., /opt/openmpi/<version>

If you want to:

Keep multiple versions of Open MPI (for testing different releases)

Avoid potential conflicts with system or distro-provided versions

Then installing under a separate directory like /opt/openmpi/5.0.x (or /opt/mpi/5.0.x, etc.) is convenient. You can switch between versions by adjusting your PATH and LD_LIBRARY_PATH (or by using environment modules).

 

Example configure commands

System-wide in /usr/local:

 

../configure --prefix=/usr/local
make -j$(nproc)
sudo make install

 

 

Separate location in /opt/openmpi/5.0.2:

 

../configure --prefix=/opt/openmpi/5.0.2
make -j$(nproc)
sudo make install

 

 

Then, if you installed into /opt/openmpi/5.0.2, you would add something like this to your ~/.bashrc or similar shell config:

 

export PATH="/opt/openmpi/5.0.2/bin:$PATH"
export LD_LIBRARY_PATH="/opt/openmpi/5.0.2/lib:$LD_LIBRARY_PATH"

 

That way, you can manage multiple Open MPI versions cleanly without disturbing the system’s default packages.

'C C++' 카테고리의 다른 글

OpenMPI Compiling  (0) 2024.12.30
Module 기본 사용법  (1) 2024.12.13
Intel Compiler  (0) 2024.12.11
Module : 컴파일을 위해 여러 library를 사용해야 할 경우  (0) 2024.12.10
CMAKE  (2) 2023.12.22