DEV Community

Cover image for Troubleshooting 'configure' Errors During PostgreSQL Installation
Kenta Takeuchi
Kenta Takeuchi

Posted on • Originally published at bmf-tech.com

Troubleshooting 'configure' Errors During PostgreSQL Installation

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

If additional options are needed when running configure, execute it as follows:

./configure --prefix=/usr/local/pgsql --enable-debug --enable-cassert
Enter fullscreen mode Exit fullscreen mode

To check available options, run:

./configure --help
Enter fullscreen mode Exit fullscreen mode

Step 2: Re-run make

Once configure completes successfully, execute the build with the following command:

make -j$(nproc)
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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 configure script does not exist
  • Required build tools are missing

Solution

First, check if the configure script exists:

ls -l configure
Enter fullscreen mode Exit fullscreen mode

If configure is not found, regenerate it by running autoconf:

autoreconf -fi
./configure
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

For CentOS/RHEL

yum groupinstall -y "Development Tools"
yum install -y readline-devel zlib-devel flex bison
Enter fullscreen mode Exit fullscreen mode

Issue 2: Library Errors During configure

Example error message:

configure: error: readline library not found
Enter fullscreen mode Exit fullscreen mode

Solution

Install the missing library:

apt install -y libreadline-dev
Enter fullscreen mode Exit fullscreen mode

or

yum install -y readline-devel
Enter fullscreen mode Exit fullscreen mode

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:

  1. Run configure to properly set up the environment
  2. Execute make to build PostgreSQL
  3. Run make install if necessary to install
  4. Properly address issues that arise during configure (such as missing libraries)

Top comments (0)