This article was originally published on bmf-tech.com.
Troubleshooting 'configure' Errors During PostgreSQL Installation
1. Introduction
When compiling the PostgreSQL source code, an error occurred when running make: You need to run the 'configure' program first.
This post documents the troubleshooting steps.
2. Error Details
Error message:
root@7a46fccdd51a:/postgresql-14.7# make -j$(nproc)
You need to run the 'configure' program first. See the file
'INSTALL' for installation instructions.
Makefile:19: recipe for target 'all' failed
make: *** [all] Error 1
This error occurs because the configure script has not been run in the PostgreSQL source code directory.
3. Solution
Step 1: Run configure
The configure script is necessary to set up the build environment for PostgreSQL. First, navigate to the PostgreSQL source directory and run the following command:
./configure
If additional options are needed when running configure, execute it as follows:
./configure --prefix=/usr/local/pgsql --enable-debug --enable-cassert
To check available options, run:
./configure --help
Step 2: Re-run make
Once configure completes successfully, execute the build with the following command:
make -j$(nproc)
This will compile quickly by utilizing the available CPU cores.
Step 3: Run make install (if necessary)
If make succeeds, proceed to install PostgreSQL:
make install
This will install PostgreSQL in the specified prefix directory (default is /usr/local/pgsql).
4. Additional Issues and Solutions During configure
Issue 1: configure: command not found
Cause
- The
configurescript does not exist - Required build tools are missing
Solution
First, check if the configure script exists:
ls -l configure
If configure is not found, regenerate it by running autoconf:
autoreconf -fi
./configure
If errors persist, verify that the necessary packages are installed.
For Ubuntu/Debian
apt update && apt install -y build-essential libreadline-dev zlib1g-dev flex bison
For CentOS/RHEL
yum groupinstall -y "Development Tools"
yum install -y readline-devel zlib-devel flex bison
Issue 2: Library Errors During configure
Example error message:
configure: error: readline library not found
Solution
Install the missing library:
apt install -y libreadline-dev
or
yum install -y readline-devel
5. Conclusion
The failure of make during PostgreSQL compilation can be due to not running configure or missing necessary libraries. By following the steps outlined in this article, you may resolve the following issues:
- Run
configureto properly set up the environment - Execute
maketo build PostgreSQL - Run
make installif necessary to install - Properly address issues that arise during
configure(such as missing libraries)
Top comments (0)