Bug 2127503

Summary: postgresql-14.3-9.fc38 FTBFS: llvmjit_inline.cpp:771:37: error: incomplete type 'llvm::MemoryBuffer' used in nested name specifier
Product: [Fedora] Fedora Reporter: Petr Pisar <ppisar>
Component: postgresqlAssignee: Filip Januš <fjanus>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 38CC: anon.amish, daan.j.demeyer, davide, devrim, fjanus, hhorak, jmlich83, mattioli.fernando, mkulik, panovotn, pkubat, praiskup, tgl
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: https://www.postgresql.org/message-id/3698111.1663342846%40sss.pgh.pa.us
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2117176, 2168842, 2231791    

Description Petr Pisar 2022-09-16 15:21:34 UTC
postgresql-14.3-9.fc38 fails to build in Fedora 38:

make[2]: Entering directory '/builddir/build/BUILD/postgresql-14.3/src/backend/jit/llvm'
g++ -Wall -Wpointer-arith -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -std=c++14 -fPIC -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D_GNU_SOURCE -I/usr/include  -I../../../../src/include  -D_GNU_SOURCE -I/usr/include/libxml2   -c -o llvmjit_inline.o llvmjit_inline.cpp
llvmjit_inline.cpp: In function 'std::unique_ptr<llvm::ModuleSummaryIndex> llvm_load_summary(llvm::StringRef)':
llvmjit_inline.cpp:771:37: error: incomplete type 'llvm::MemoryBuffer' used in nested name specifier
  771 |                 llvm::MemoryBuffer::getFile(path);
      |                                     ^~~~~~~
In file included from /usr/include/c++/12/memory:76,
                 from /usr/include/llvm/ADT/SmallVector.h:28,
                 from /usr/include/llvm/ADT/ArrayRef.h:14,
                 from /usr/include/llvm/ADT/SetVector.h:23,
                 from llvmjit_inline.cpp:48:
/usr/include/c++/12/bits/unique_ptr.h: In instantiation of 'void std::default_delete<_Tp>::operator()(_Tp*) const [with _Tp = llvm::MemoryBuffer]':
/usr/include/c++/12/bits/unique_ptr.h:396:17:   required from 'std::unique_ptr<_Tp, _Dp>::~unique_ptr() [with _Tp = llvm::MemoryBuffer; _Dp = std::default_delete<llvm::MemoryBuffer>]'
/usr/include/llvm/Support/ErrorOr.h:142:34:   required from 'llvm::ErrorOr<T>::~ErrorOr() [with T = std::unique_ptr<llvm::MemoryBuffer>]'
llvmjit_inline.cpp:771:35:   required from here
/usr/include/c++/12/bits/unique_ptr.h:93:23: error: invalid application of 'sizeof' to incomplete type 'llvm::MemoryBuffer'
   93 |         static_assert(sizeof(_Tp)>0,
      |                       ^~~~~~~~~~~
make[2]: *** [<builtin>: llvmjit_inline.o] Error 1
make[2]: Leaving directory '/builddir/build/BUILD/postgresql-14.3/src/backend/jit/llvm'

A difference between a passing and failing build root is at <https://koschei.fedoraproject.org/build/13703514>. An upgrade of clang from
14.0.5-7.fc38 to 15.0.0-2.fc38 looks suspicious.

Comment 1 Daan De Meyer 2022-10-19 17:31:43 UTC
This should be fixed by https://github.com/postgres/postgres/commit/c2ae01f695b1605bc5e3908ff52b24fce6636caa. Can we pull that commit in as a patch and backport to Fedora 37 as well?

Comment 2 Ben Cotton 2023-02-07 14:55:07 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle.
Changing version to 38.