Re: Meson far from ready on Windows - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Meson far from ready on Windows
Date
Msg-id 57A7B41C-427D-4249-BF96-D5CA0CB7424A@anarazel.de
Whole thread Raw
In response to Re: Meson far from ready on Windows  (walther@technowledgy.de)
List pgsql-hackers
Hi,

On June 22, 2024 7:32:01 PM GMT+02:00, walther@technowledgy.de wrote:
>Andres Freund:
>> FWIW, dynamic linking has a noticeable overhead on other platforms too. A
>> non-dependencies-enabled postgres can do about 2x the connections-per-second
>> than a fully kitted out postgres can (basically due to more memory mapping
>> metadata being copied).  But on windows the overhead is larger because so much
>> more happens for every new connections, including loading all dlls from
>> scratch.
>>
>> I suspect linking a few libraries statically would be quite worth it on
>> windows. On other platforms it'd be quite inadvisable to statically link
>> libraries, due to security updates, [...]
>That's not necessarily true. The nix package manager and thus NixOS track all dependencies for a piece of software. If
anyof the dependencies are updated, all dependents are rebuilt, too. So the security concern doesn't apply here. There
isa "static overlay", which builds everything linked fully statically.  

Right. There's definitely some scenario where it's ok, I was simplifying a bit.

> Unfortunately, PostgreSQL doesn't build in that, so far.

I've built mostly statically linked pg without much of a problem, what trouble did you encounter? Think there were some
issueswith linking Kerberos and openldap statically, but not on postgres' side. 

Building the postgres backend without support for dynamic linking doesn't make sense though. Extensions are just stop
ingrainedpart of pg. 


>Lately, I have been looking into building at least libpq in that static overlay, via Meson. There are two related
configoptions: 
>-Ddefault_library=shared|static|both
>-Dprefer_static
>
>The first controls which libraries (libpq, ...) to build ourselves. The second controls linking, IIUC also against
externaldependencies. 

Pg by default builds a static libpq on nearly all platforms (not aix I think and maybe not Windows when building with
autoconf,not sure about the old msvc system) today? 


>Maybe it would be a first step to support -Dprefer_static?

That should work for nearly all dependencies today. Except for libintl, I think.  I found that there are a lot of
bugletsin static link dependencies of various libraries though.  


Andres
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.



pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: allow changing autovacuum_max_workers without restarting
Next
From: Joseph Koshakow
Date:
Subject: Re: Wrong security context for deferred triggers?