Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 May 2023 21:27:36 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 271498] databases/postgresql15-server: fix build with clang 16 (as system compiler)
Message-ID:  <bug-271498-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271498

            Bug ID: 271498
           Summary: databases/postgresql15-server: fix build with clang 16
                    (as system compiler)
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: pgsql@FreeBSD.org
          Reporter: dim@FreeBSD.org
          Assignee: pgsql@FreeBSD.org
             Flags: maintainer-feedback?(pgsql@FreeBSD.org)

During an exp-run for llvm 16 (see bug 271047), it turned out that
databases/postgresql15-server failed to build with clang 16 as the base
system compiler:

  In file included from llvmjit.c:38:
  ../../../../src/include/jit/llvmjit_emit.h:112:23: warning: call to
undeclared function 'LLVMBuildStructGEP'; ISO C99 and later do not support
implicit function declarations [-Wimplicit-function-declaration]
          LLVMValueRef v_ptr =3D LLVMBuildStructGEP(b, v, idx, "");
                               ^
  ../../../../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 =3D LLVMBuildStructGEP(b, v, idx, "");
                       ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ../../../../src/include/jit/llvmjit_emit.h:114:9: warning: call to undecl=
ared
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: error: incompatible int=
eger
to pointer conversion returning 'int' from a function with result type
'LLVMValueRef' (aka 'struct LLVMOpaqueValue *') [-Wint-conversion]
          return LLVMBuildLoad(b, v_ptr, name);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

and many more similar errors. The same applies to the slave ports
postgresql11-server, postgresql12-server, postgresql13-server, and
postgresql14-server.

This is because PostgreSQL's llvmjit support is not yet ready for LLVM
16's API changes. In LLVM 15 functions like LLVMBuildStructGEP were
already declared deprecated, but in LLVM 16 these have been removed (and
replaced with LLVMBuildStructGEP2, etc).

Until PostgreSQL updates their llvmjit for the changed APIs, I would
like to reintroduce the LLVM version restriction that was removed in
<https://cgit.freebsd.org/ports/commit/?id=3D1e19f00e5e46>, but slightly
adjusted: there is no more need to check for LLVM ports below 10.

Another thing that is required is to pass a CLANG variable to the
configure script, pointing to the same version that is used for the LLVM
bindings. Otherwise, the .bc files will get compiled by the base system
compiler, and this can lead to a ThinLTO link error, if the base system
compiler is a newer version of llvm.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-271498-7788>