Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 914198 - dev-db/postgresql-16.0[server,llvm]: build broken with clang-16
Summary: dev-db/postgresql-16.0[server,llvm]: build broken with clang-16
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: PgSQL Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-14 19:51 UTC by Holger Hoffstätte
Modified: 2023-10-09 03:05 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Holger Hoffstätte 2023-09-14 19:51:01 UTC
Commit cbcce96c423b set LLVM_MAX_SLOT to 16, but that turned out to be incorrect. It might *seem* to build with gcc when one ignores the warnings, but the resulting llvmjit.so has several undefined symbols than are not in libllvm-16. The failure becomes visible when building with clang (see below).


Reproducible: Always

Steps to Reproduce:
1. configure dev-db/postgresql to buid with clang, e.g. via package.env
2. try to build postgresql[server,llvm]
3. build failure

Actual Results:  
clang-16 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Wno-cast-function-type-strict -pipe -march=native -fno-semantic-interposition -O2 -Wno-deprecated-declarations -fPIC -fvisibility=hidden -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D_GNU_SOURCE -I/usr/lib/llvm/16/include  -I../../../../src/include  -D_GNU_SOURCE   -c -o llvmjit.o llvmjit.c
In file included from llvmjit.c:38:
../../../../src/include/jit/llvmjit_emit.h:112:23: error: call to undeclared function 'LLVMBuildStructGEP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        LLVMValueRef v_ptr = LLVMBuildStructGEP(b, v, idx, "");
                             ^
../../../../src/include/jit/llvmjit_emit.h:112:23: note: did you mean 'LLVMBuildStructGEP2'?
/usr/lib/llvm/16/include/llvm-c/Core.h:3934:14: note: 'LLVMBuildStructGEP2' declared here
LLVMValueRef LLVMBuildStructGEP2(LLVMBuilderRef B, LLVMTypeRef Ty,
             ^
In file included from llvmjit.c:38:
../../../../src/include/jit/llvmjit_emit.h:112:15: error: incompatible integer to pointer conversion initializing 'LLVMValueRef' (aka 'struct LLVMOpaqueValue *') with an expression of type 'int' [-Wint-conversion]
        LLVMValueRef v_ptr = LLVMBuildStructGEP(b, v, idx, "");
                     ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../src/include/jit/llvmjit_emit.h:114:9: error: call to undeclared function 'LLVMBuildLoad'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        return LLVMBuildLoad(b, v_ptr, name);
               ^
../../../../src/include/jit/llvmjit_emit.h:114:9: note: did you mean 'LLVMBuildLoad2'?
/usr/lib/llvm/16/include/llvm-c/Core.h:3925:14: note: 'LLVMBuildLoad2' declared here
LLVMValueRef LLVMBuildLoad2(LLVMBuilderRef, LLVMTypeRef Ty,
             ^

..etc.

LLVMBuildStructGEP/LLVMBuildLoad no longer exist; new versions in llvm:16 have the "2" suffix.
Comment 2 Larry the Git Cow gentoo-dev 2023-10-05 09:10:02 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4ab00d2e4ff7db59bf0c229fef5f26e29703c9aa

commit 4ab00d2e4ff7db59bf0c229fef5f26e29703c9aa
Author:     Patrick Lauer <patrick@gentoo.org>
AuthorDate: 2023-10-05 09:07:26 +0000
Commit:     Patrick Lauer <patrick@gentoo.org>
CommitDate: 2023-10-05 09:10:00 +0000

    dev-db/postgresql: Restrict llvm for postgresql:16
    
    Builds, but doesn't run, with llvm-16
    
    Closes: https://bugs.gentoo.org/914198
    Signed-off-by: Patrick Lauer <patrick@gentoo.org>

 dev-db/postgresql/postgresql-16.0.ebuild | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-10-09 03:05:02 UTC
(In reply to Larry the Git Cow from comment #2)
> The bug has been closed via the following commit(s):
> 
> https://gitweb.gentoo.org/repo/gentoo.git/commit/
> ?id=4ab00d2e4ff7db59bf0c229fef5f26e29703c9aa
> 
> commit 4ab00d2e4ff7db59bf0c229fef5f26e29703c9aa
> Author:     Patrick Lauer <patrick@gentoo.org>
> AuthorDate: 2023-10-05 09:07:26 +0000
> Commit:     Patrick Lauer <patrick@gentoo.org>
> CommitDate: 2023-10-05 09:10:00 +0000
> 
>     dev-db/postgresql: Restrict llvm for postgresql:16
>     
>     Builds, but doesn't run, with llvm-16

If it doesn't run, it needs a new revision. It'll also build with GCC and porbably break at runtime, while it'll fail properly with Clang thanks to its better defaults (GCC 14 should be changing to match that).

This also led to some confusion on the forums at https://forums.gentoo.org/viewtopic-t-1165411.html.