Bobcares

Fixing “Readline Library not Found” in PostgreSQL

by | Oct 6, 2024

When trying to build PostgreSQL from source, the error message “configure: error: readline library not found in Postgresql” usually appears. To know more about and fix the issue quickly, here is our latest post. At Bobcares, with our PostgreSQL Support Services, we can handle your issues.

Overview
  1. Understanding DKIM Setup on OVH
  2. Common Causes of the Error
  3. Fixes for the Error
  4. Conclusion

Understanding “configure: error: readline library not found in PostgreSQL”

The error message “configure: error: readline library not found” happens when we’re trying to build PostgreSQL from source. It means PostgreSQL can’t find the Readline library. This library is needed for editing command line inputs when using its interactive terminal (psql). The Readline library lets us edit text and use command history features. When we run the ./configure script during the PostgreSQL setup, it checks if this library is available. If it isn’t, the setup stops and shows this error.

postgresql readline library not found

Common Causes of the Error

Some of the common causes that may lead to the error includes:

  • Missing Development Package: The most frequent causes are either the development package or an uninstalled Readline library. The header files and libraries needed to compile software using Readline are included in the development package.
  • Incorrect Library Paths: The configure script might not locate the Readline library if it is installed but not in the anticipated directories. Use of custom installation paths may cause this.
  • Environment Variables: The compiler may fail to recognize the installed libraries if environment variables like LD_LIBRARY_PATH or PKG_CONFIG_PATH are not configured correctly.
  • Version Compatibility: Problems could also arise if the Readline version installed is not compatible with the PostgreSQL version being produced.

Fixes for the Error

1. Install the Readline Development Package: The package manager can be used to install the Readline development package on the majority of Linux systems. The commands for various systems are as follows:

Ubuntu/Debian: sudo apt-get install libreadline-dev

CentOS/RHEL: sudo yum install readline-devel

Fedora: sudo dnf install readline-devel

We can also set up the necessary files with these commands for the configure script to find the Readline library.

2. Verify Installation Paths: Make sure the library files are in the correct places if we have installed Readline but are still seeing this problem. One can look at the shared directories:

ls /usr/lib | grep readline
ls /usr/include | grep readline

If the files are located in non-standard directories, we may need to specify these paths during the configuration step:

./configure --with-includes=/path/to/readline/include --with-libs=/path/to/readline/lib

3. Set Environment Variables: We must also verify that the environment variables are configured appropriately if the library is installed but cannot be found. The following can be included in the shell configuration file.

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

Then, run source ~/.bashrc to apply the changes.

4. Use –without-readline Option: We can set PostgreSQL to build without Readline support if that is not a requirement for user. One way to achieve this is to run:

./configure --without-readline

If we plan to use the interactive aspects of psql, this is not a good option.

[Need to know more? Click here to reach us.]

Conclusion

In conclusion, the “readline library not found” error typically arises due to missing Readline development packages, incorrect library paths, or misconfigured environment variables. In order to resolve it, ensure that the necessary Readline package is installed, verify that the library files are in the correct directories, and set environment variables if needed. Alternatively, if Readline support is not required, PostgreSQL can be compiled without it. By addressing these issues with the steps from our Support Team, we can successfully complete the PostgreSQL build process.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF