BUG #17348: Can never install pgsql on Ubuntu - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #17348: Can never install pgsql on Ubuntu
Date
Msg-id 17348-0bcee56252174285@postgresql.org
Whole thread Raw
Responses Re: BUG #17348: Can never install pgsql on Ubuntu  (hubert depesz lubaczewski <depesz@depesz.com>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      17348
Logged by:          KT LEE
Email address:      ktr01@protonmail.com
PostgreSQL version: Unsupported/Unknown
Operating system:   Windows 10
Description:

I use Win10 + Ubuntu 20.04 and build a website with Ruby on Rails. Whether I
changed the existing repo server to pg (in gemfile), or rails new specified
db as pg, I all encountered the following error message, followed by a
series of error message mazes. I once removed pg and reinstalled it. I have
also referred to all the answers on Stack Overflow. I have also asked
several questions, but none of them can be resolved.

If I try sudo apt-get install libpq-dev, I will encounter "E: Unable to
correct problems, you have held broken packages. ", and then go back to the
beginning of the problem. Compared to elephants, pg may be more like
ouroboros.

This is the question I asked:
https://stackoverflow.com/questions/70496525/cant-find-the-libpq-fe-h-header

https://stackoverflow.com/questions/70497607/there-is-no-response-to-the-command-to-install-postgresql-on-ubuntu-gemextb
https://stackoverflow.com/questions/70486509/cant-find-the-libpq-fe-h-header-cant-install-libpq-dev

This is my error message:
$ gem install pg -v '1.2.3' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.

    current directory: /home/keaton/.rvm/gems/ruby-3.0.0/gems/pg-1.2.3/ext
/home/keaton/.rvm/rubies/ruby-3.0.0/bin/ruby -I
/home/keaton/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0 -r
./siteconf20211228-2714-f0chma.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You
may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/home/keaton/.rvm/rubies/ruby-3.0.0/bin/$(RUBY_BASE_NAME)
        --with-pg
        --without-pg
        --enable-windows-cross
        --disable-windows-cross
        --with-pg-config
        --without-pg-config
        --with-pg_config
        --without-pg_config
        --with-pg-dir
        --without-pg-dir
        --with-pg-include
        --without-pg-include=${pg-dir}/include
        --with-pg-lib
        --without-pg-lib=${pg-dir}/lib

To see why this extension failed to compile, please check the mkmf.log which
can be found here:


/home/keaton/.rvm/gems/ruby-3.0.0/extensions/x86_64-linux/3.0.0/pg-1.2.3/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/home/keaton/.rvm/gems/ruby-3.0.0/gems/pg-1.2.3 for inspection.
Results logged to
/home/keaton/.rvm/gems/ruby-3.0.0/extensions/x86_64-linux/3.0.0/pg-1.2.3/gem_make.out


pgsql-bugs by date:

Previous
From: Etsuro Fujita
Date:
Subject: Re: BUG #17344: Assert failed on queiring async_capable foreign table with inheritance
Next
From: Tom Lane
Date:
Subject: Re: BUG #17347: pg_upgrade: analyze_new_cluster script analyzes wrong cluster