Identifying build options

Started by Igor Korot4 months ago4 messagesgeneral
Jump to latest
#1Igor Korot
ikorot01@gmail.com

Hi, ALL,
Do I understand correctly that I can use "pg_config --cflags" and
"pg_config --libs"
as input to build my program that links with libpq?

Thank you.

#2Igor Korot
ikorot01@gmail.com
In reply to: Igor Korot (#1)
Re: Identifying build options

On Fri, Jul 10, 2026 at 11:22 PM Igor Korot <ikorot01@gmail.com> wrote:

Hi, ALL,
Do I understand correctly that I can use "pg_config --cflags" and
"pg_config --libs"
as input to build my program that links with libpq?

Or using " -I`pg_config --includedir`" and " -L`pg_config
--libdir` -lpq" is sufficient?

Show quoted text

Thank you.

#3Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Igor Korot (#1)
Re: Identifying build options

On Fri, 2026-07-10 at 23:22 -0500, Igor Korot wrote:

Do I understand correctly that I can use "pg_config --cflags" and
"pg_config --libs"
as input to build my program that links with libpq?

No - that is for building the server (or server code like extensions).

Instructions for building client code are at
https://www.postgresql.org/docs/current/libpq-build.html

Yours,
Laurenz Albe

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Laurenz Albe (#3)
Re: Identifying build options

Laurenz Albe <laurenz.albe@cybertec.at> writes:

Instructions for building client code are at
https://www.postgresql.org/docs/current/libpq-build.html

Right. I think pkg-config is the preferred option nowadays,
at least if you're on a platform where that's available.

regards, tom lane