From: | Marcelo Juchem <juchem(at)gmail(dot)com> |
---|---|
To: | Andres Freund <andres(at)anarazel(dot)de> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [PATCH] Support static linking against LLVM |
Date: | 2023-08-11 17:59:27 |
Message-ID: | CAK0nC2XCbZM-C=pdbiMAq2kiADE9CQonrNiFZt2oOS6fKSvY7Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
In my case, my product has a very controlled environment.
We build all our infrastructure from source and we avoid dynamic linking by
design, except where technically not viable (e.g.: pgsql extensions).
LLVM is one of the libraries we're specifically required to statically link.
Unfortunately I can't share the specifics of why that's the case.
Without static link support by PostgreSQL we can't enable LLVM JIT.
On a side note, I'd like to take this opportunity to ask you if there's any
work being done towards migrating away from deprecated LLVM APIs.
If there's no work being done on that front, I might take a stab at it if
there's any interest from the PostgreSQL community in that contribution.
More specifically, there are some deprecated C APIs that are used in
PostgreSQL (more details in
https://llvm.org/docs/OpaquePointers.html#frontends)
For that reason, PostgreSQL LLVM JIT support will fail to build starting
with the next version of LLVM (version 17).
Migrating to the new APIs will have PostgreSQL require at the minimum
version 8 of LLVM (released in March 2019).
Regards,
-mj
On Fri, Aug 11, 2023 at 12:43 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
> Hi,
>
> On 2023-08-10 14:45:47 -0500, Marcelo Juchem wrote:
> > By default, PostgreSQL doesn't explicitly choose whether to link
> > statically or dynamically against LLVM when LLVM JIT is enabled (e.g.:
> > `./configure --with-llvm`).
> >
> > `llvm-config` will choose to dynamically link by default.
> >
> > In order to statically link, one must pass `--link-static` to
> > `llvm-config` when listing linker flags (`--ldflags`) and libraries
> > (`--libs`).
> >
> > This patch enables custom flags to be passed to `llvm-config` linker
> > related invocations through the environment variable
> > `LLVM_CONFIG_LINK_ARGS`.
> >
> > To statically link against LLVM it suffices, then, to call `configure`
> > with environment variable `LLVM_CONFIG_LINK_ARGS=--link-static`.
>
> I'm not opposed to it, but I'm not sure I see much need for it either. Do
> you
> have a specific use case for this?
>
> Greetings,
>
> Andres Freund
>
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2023-08-11 17:59:31 | Re: LLVM 16 (opaque pointers) |
Previous Message | Andres Freund | 2023-08-11 17:57:23 | Re: AssertLog instead of Assert in some places |