Subject: Problem linking with Release library

From: Igor Korot <[email-masked]>
Date: Thu, 7 May 2026 23:36:19 -0700

Hi,
A long time ago I built both Debug and Release versions of libpq.

For a while I was working with the Debug version without any issues

Now I tried to build a Release version of my program.

Compilation went fine but during linking I got

[code]
1>libpq.lib(snprintf.obj) : warning LNK4217: locally defined symbol
_sprintf imported in function _fmtptr
1>libpq.lib(dirmod.obj) : error LNK2001: unresolved external symbol
__imp____iob_func
1>libpq.lib(win32error.obj) : error LNK2001: unresolved external
symbol __imp____iob_func
1>libpq.lib(fe-connect.obj) : error LNK2001: unresolved external
symbol __imp____iob_func
1>libpq.lib(snprintf.obj) : error LNK2001: unresolved external symbol
__imp____iob_func
1>libpq.lib(encnames.obj) : error LNK2001: unresolved external symbol
__imp____iob_func
1>libpq.lib(chklocale.obj) : error LNK2001: unresolved external symbol
__imp____iob_func
1>libpq.lib(fe-exec.obj) : error LNK2019: unresolved external symbol
__imp__sscanf referenced in function _pqSaveParameterStatus
1>    33 Warning(s)
1>    8 Error(s)
1>
[/code]

Do I need to rebuild a Release version with some missing parameters?

I'm working with MSVC 2017 for now...

Thank you.

---

From: Adrian Klaver <[email-masked]>
Date: Fri, 8 May 2026 07:32:24 -0700

> A long time ago I built both Debug and Release versions of libpq.

Define what distinguishes Debug from Release  version.

What version of Postgres are you using for the source?

What OS and version are you building on?

.

-- 
Adrian Klaver
[email-masked]

---

From: Igor Korot <[email-masked]>
Date: Fri, 8 May 2026 08:34:35 -0700

Hi, Adrian,

> Define what distinguishes Debug from Release  version.

Debug - on *nix-like systems it compiles with “-g”. On windows it has
references to the source code.

Release - it’s stripped from the source code references.

> What OS and version are you building on?

This is building on Windows 8 with MSVC 2017.

Thank you.

---

From: Ron Johnson <[email-masked]>
Date: Fri, 8 May 2026 11:43:25 -0400

On Fri, May 8, 2026 at 11:35 AM Igor Korot <[email-masked]> wrote:
[snip]

> This is building on Windows 8
>

Isn't that *years* EOL?

-- 
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!

---

From: Adrian Klaver <[email-masked]>
Date: Fri, 8 May 2026 09:24:19 -0700

On 5/8/26 8:34 AM, Igor Korot wrote:
> Hi, Adrian,
> 
> On Fri, May 8, 2026 at 7:32 AM Adrian Klaver <[email-masked] 
> <mailto:[email-masked]>> wrote:
> 

What are the specific parameters you use to compile in each case?

>     What version of Postgres are you using for the source?
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       ?

>     [email-masked] <mailto:[email-masked]>
>

---

From: Adrian Klaver <[email-masked]>
Date: Fri, 8 May 2026 10:46:44 -0700

On 5/8/26 11:12 AM, Igor Korot wrote:
> Hi, Adrian,
> 
> On Fri, May 8, 2026 at 11:24 AM Adrian Klaver <[email-masked]> wrote:
>>
> I don't remember already.
> But I THINK I did use default all the way through.

To me it looks like you need to review your tool chain and build process.

---

From: Igor Korot <[email-masked]>
Date: Fri, 8 May 2026 13:12:16 -0500

Hi, Adrian,

> >     What version of Postgres are you using for the source?

I will get back on that...

Thank you,

---

From: Igor Korot <[email-masked]>
Date: Mon, 11 May 2026 23:55:29 -0700

Hi, Adrian,

> To me it looks like you need to review your tool chain and build process.

So I'd like to get back to this.

Turns out I had a very old 9.6 version.

Now I checked and on my Linux box I have 17.4

What I'd like to do is integrate libpq building inside MSVC as a dependency.

Is it possible?

If not - what's the simplest possible way of building the library?

Thank you

---

From: Igor Korot <[email-masked]>
Date: Tue, 12 May 2026 00:10:24 -0700

Hi, again,

According to Google AI versions prior to 16 can be built
by smply running nmake.

But I really don't want to do that and prefer to stay in par with
Linux version.

Is it possible?

Thank you.

---

From: Adrian Klaver <[email-masked]>
Date: Tue, 12 May 2026 09:31:26 -0700

> If not - what's the simplest possible way of building the library?

Have you looked at?:

https://www.postgresql.org/docs/current/installation-platform-notes.html#INSTALLATION-NOTES-VISUAL-STUDIO

---

From: Igor Korot <[email-masked]>
Date: Tue, 12 May 2026 10:31:48 -0700

Hi, Adrian,

> https://www.postgresql.org/docs/current/installation-platform-notes.html#INSTALLATION-NOTES-VISUAL-STUDIO

No, I didn’t. Thx for the link.

However, if you probably aware, on Windows there is a difference between
Debug and Release builds.

If one links Release library with Debug binary it will run incorrectly if
run at all.

So since I’m right now am building Debug version of my software I need to
build Debug version alone with Release one.

I presume that the download link will give me Release build only?

Thank you.

<https://www.postgresql.org/docs/current/installation-platform-notes.html#INSTALLATION-NOTES-VISUAL-STUDIO>

---

From: Igor Korot <[email-masked]>
Date: Tue, 12 May 2026 14:12:00 -0700

Adrian,

> https://www.postgresql.org/docs/current/installation-platform-notes.html#INSTALLATION-NOTES-VISUAL-STUDIO

Also - I'm not interested in downloading the whole server. I already
have it installed on the other machine.

I want libpq Debug and Release versions only as most developers do.

Thank you.

---

From: Adrian Klaver <[email-masked]>
Date: Tue, 12 May 2026 17:02:59 -0700

> I want libpq Debug and Release versions only as most developers do.

Honestly, at this point I have no idea what your goal is. You will need 
to provide a detailed explanation of what you did before that worked and 
the conditions that where in place that made it work. Then provide 
detailed information on your current conditions and what you want the 
result to be.

---

From: Igor Korot <[email-masked]>
Date: Tue, 12 May 2026 17:21:09 -0700

Hi, Adrian,

> detailed information on your current conditions and what you want the

What is want is to have a Debug and Release of libpq on this box.

That's it.

No server and no server utilities.

Just libpq. As shared dynamic library.

In the past what I did was to grab the 9.6 version and build the libpq with
simply run nmake.

I never needed to use Release version as I was working with Debug one.

However couple of days ago I needed to build Release version of my software
and so that's what I tried.
Unfortunately building Release version resulted in the linking error I was
mentioned in the OP.

Debug version was working fine.

Then I realized that there is a mismatch with the versions on my Windows
and Linux machines and as I tried to stay with the same version around
different OSes, I tried to get 17.4.

But unfortunately I was not able to build it easily with just nmake as in
the past because now it requires to install many other unrelated software.

I have no idea why the Release build failed on 9.6. But Debug one worked
for years

So then I thought about creating MSVC project for building libpq as a
dependency. All I need is to produce a basic default build of both Debug
and Release builds of libpq only. No server and no ther software needed.
Prefer to build version 17.4.

I have MSVC 2017 on Windows 8.1. This setup was working fine with libpq
Debug version 9.6

I hope now it's clear

Let me know if it's not.

Thank you.

---

From: "David G. Johnston" <[email-masked]>
Date: Tue, 12 May 2026 18:04:12 -0700

> Prefer to build version 17.4.

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=1301c80b2167feb658a738fa4ceb1c23d0991e23

You seem to have put yourself into cutting edge PostgreSQL territory while
remaining firmly old-school on the OS side of things…not usually a good
place to find oneself.

My LLM guided understanding is your likely 9.6 tool path was removed in
favor of meson back in 2023.  But meson itself is still working out the
rough edges for stuff like a defined target for a libpq-only build and
install.

There is no guarantee or real attempt to keep modern supported versions
running on software obsoleted before they even came into existence.  You
may or may not be able to finagle make/meson to do what you are attempting
and the desire to help is limited.  You may wish to consult an LLM of your
choice for assistance.  For something like this they can be very helpful
with little downside.

David J.

---

From: Igor Korot <[email-masked]>
Date: Tue, 12 May 2026 19:52:13 -0700

Hi, David,

> choice for assistance.  For something like this they can be very helpful

What I don’t understand is:

1. There used to be a split builds - one package to build the server and
another to build the client (libpq). This is no longer the case.
PostgreSQL positions itself as client-server RDBMS,  so why in order to
build the client I need the full blown server to download?

2. Any reason I need to install additional software for building (or
configuring the build)? You used to provide the Makefile for MSVC build.
What happened to it?

But to the point -

I’m not running Postgres server. It is running on the different machines.
All I need is to build the client library. Why can’t I? Why it should
matter what software (OS/compiler) I’m using? As long as I can successfully
build my software and test it  it should be fine.

Thank you.

---

From: Ron Johnson <[email-masked]>
Date: Tue, 12 May 2026 23:09:51 -0400

On Tue, May 12, 2026 at 10:52 PM Igor Korot <[email-masked]> wrote:
[snip]

> build my software and test it  it should be fine.

David made it pretty clear: the *PGDG changed the toolchain*, and decided *not
to support* an OS that went *EOL* three years ago, and a compiler that's
only getting security updates: "There is no guarantee or real attempt to
keep modern supported versions running on software obsoleted before they
even came into existence."

---

From: Laurenz Albe <[email-masked]>
Date: Wed, 13 May 2026 06:32:25 +0200

On Tue, 2026-05-12 at 19:52 -0700, Igor Korot wrote:
> There used to be a split builds - one package to build the server and another to build the client (libpq). This is no longer the case. 
> PostgreSQL positions itself as client-server RDBMS,  so why in order to build the client I need the full blown server to download?

I don't have Windows at my disposal, so I cannot investigate this, but it
strikes me that you are complaining for the sake of complaining.

I have never seen a client-only source download for PostgreSQL, so you always
had to download the complete source.  What is the problem?  Does your
internet connection have a problem with downloading 30MB?

And if you have to build the entire server just to get the client library,
what is the problem with that?  Yes, it will take somewhat longer, but I
don't see that as a problem unless you are building the software several
times a day, which seems unlikely for a production build.

It used to be that I could fit a custom-built Linux kernel on a 1.44MB
rescue floppy disk.  Still, I don't complain to the LKML that I can no longer
do that.

Yours,
Laurenz Albe

---

From: Tom Lane <[email-masked]>
Date: Wed, 13 May 2026 00:52:08 -0400

>> There used to be a split builds - one package to build the server and another to build the client (libpq). This is no longer the case.

The short answer is that we dropped that build option because it
was no longer worth the trouble to support.  Building the whole
package and then ignoring the parts you don't need takes only
a few minutes longer on any remotely-modern hardware.  Certainly,
you've wasted more time complaining than it would take to do that.

			regards, tom lane

---

From: Igor Korot <[email-masked]>
Date: Tue, 12 May 2026 21:59:41 -0700

Hi, Ron,

On Tue, May 12, 2026 at 8:10 PM Ron Johnson <[email-masked]> wrote:

> David made it pretty clear: the *PGDG changed the toolchain*,
>

It didn’t change the toolchain - it changed configuration tools. But it’s
not the point.

The point I’m making is that the software was providing the makefile and
now it does not.

Thank you.

and decided *not to support* an OS that went *EOL* three years ago, and a
> compiler that's only getting security updates: "There is no guarantee or
> real attempt to keep modern supported versions running on software
> obsoleted before they even came into existence."
>
> --

---

From: Igor Korot <[email-masked]>
Date: Tue, 12 May 2026 23:06:14 -0700

Hi, Laurenz,

> internet connection have a problem with downloading 30MB?

Its not a problem per se.
But I know it would make the life of Linux maintainers easier to keep
a split build.

 Unless I'm missing something...

> times a day, which seems unlikely for a production build.

What is the purpose of such a build?
As a developer that needs just libpq I will just throw everything away,
but libpq.
So basically it's a waste of time...
> rescue floppy disk.  Still, I don't complain to the LKML that I can no longer

IIRC, Debian was distributed on the floppies for a long time
But lets not compare apples and oranges.

Thank you

---

From: Igor Korot <[email-masked]>
Date: Tue, 12 May 2026 23:23:21 -0700

Hi,

On Tue, May 12, 2026 at 6:04 PM David G. Johnston
<[email-masked]> wrote:
>> So then I thought about creating MSVC project for building libpq as a dependency. All I need is to produce a basic default build of both Debug and Release builds of libpq only. No server and no ther software needed. Prefer to build version 17.4.
>
>
> You seem to have put yourself into cutting edge PostgreSQL territory while remaining firmly old-school on the OS side of things…not usually a good place to find oneself.
>
> My LLM guided understanding is your likely 9.6 tool path was removed in favor of meson back in 2023.  But meson itself is still working out the rough edges for stuff like a defined target for a libpq-only build and install.

I think CMake would be better.
At the very least its cross-platform and its much more stable...

But that's fine.

Is there any official docs on how to build the library and what to install?

Thank you.

>
> There is no guarantee or real attempt to keep modern supported versions running on software obsoleted before they even came into existence.  You may or may not be able to finagle make/meson to do what you are attempting and the desire to help is limited.  You may wish to consult an LLM of your choice for assistance.  For something like this they can be very helpful with little downside.
>
> David J.
>

---

From: "Peter J. Holzer" <[email-masked]>
Date: Thu, 14 May 2026 10:38:55 +0200

On 2026-05-12 21:59:41 -0700, Igor Korot wrote:
>         I’m not running Postgres server. It is running on the different
>         machines. All I need is to build the client library. Why can’t I? Why
>         it should matter what software (OS/compiler) I’m using? As long as I
>         can successfully build my software and test it  it should be fine.
> 
>      
>     David made it pretty clear: the PGDG changed the toolchain,
> 
> 
> It didn’t change the toolchain - it changed configuration tools. But it’s not
> the point.

They switched from Make to Meson. In my book the build automation tool
is very much part of the toolchain.

> The point I’m making is that the software was providing the makefile and now it
> does not.

Because they now use Meson instead of Make. Meson doesn't use Makefiles
but dependency files with a different syntax.

        hjp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | [email-masked]         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

---

From: "Peter J. Holzer" <[email-masked]>
Date: Thu, 14 May 2026 10:46:47 +0200

> But I know it would make the life of Linux maintainers easier to keep

Not really. Both RPM and Deb (the two package systems I've actually used
to build packages) have had the ability to produce multiple binary
packages from a single source for ages.

        hjp

---

From: Igor Korot <[email-masked]>
Date: Fri, 15 May 2026 16:49:29 -0500

Hi, Adrian,

> detailed information on your current conditions and what you want the

So is there a place here (meaning potgreSQL website) or on the Web
where I can download a default build of
Debug and Release versions of libpq 17.4 built with MSVC?

Thank you.