How to Install libffi-devel on CentOS 7.9

Installing libffi-devel on CentOS 7.9 can be essential for developers who need to compile software that requires the Foreign Function Interface library. Below is a step-by-step guide to install the latest version of libffi-devel, which at the time of writing is 3.4.3.

Prerequisites

  • A system running CentOS Linux release 7.9
  • gcc, make and other development tools installed
  • Sudo or root privileges

Step 1: Downloading and Extracting the Library

🔽 Download and extract the libffi library:

wget https://sourceware.org/pub/libffi/libffi-3.4.3.tar.gz
tar -zxvf libffi-3.4.3.tar.gz
cd libffi-3.4.3

Step 2: Configure, Compile, and Install

🛠 Configure, compile and install the library:

./configure --prefix=/usr/local
make
sudo make install

Step 3: Updating the Environment Variables

🌐 Update the LD_LIBRARY_PATH environment variable and refresh the shared library cache:

echo 'export LD_LIBRARY_PATH="/usr/local/lib64:$LD_LIBRARY_PATH"' >> ~/.bashrc
source ~/.bashrc
sudo ldconfig

Step 4: Verifying the Installation

Verify the installed version of libffi:

pkg-config --modversion libffi

Afterrunning these commands, libffi-devel version 3.4.3 should be installed and ready to use on your CentOS 7.9 system.

Scroll to Top