Bug 2072419

Summary: postgresql-14.2-2.fc37 FTBFS: llvmjit_error.cpp:28:13: error: 'new_handler' in namespace 'std' does not name a type
Product: [Fedora] Fedora Reporter: Petr Pisar <ppisar>
Component: postgresqlAssignee: Filip Januš <fjanus>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: anon.amish, devrim, fjanus, hhorak, jmlich83, mkulik, panovotn, pkubat, praiskup, tgl
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: https://koschei.fedoraproject.org/package/postgresql
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-07-20 09:18:43 UTC 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: 2045102    

Description Petr Pisar 2022-04-06 09:17:12 UTC
postgresql-14.2-2.fc37 fails to build in Fedora 37:

make[2]: Entering directory '/builddir/build/BUILD/postgresql-14.2/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  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-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_error.o llvmjit_error.cpp
make[2]: Leaving directory '/builddir/build/BUILD/postgresql-14.2/src/backend/jit/llvm'
llvmjit_error.cpp:28:13: error: 'new_handler' in namespace 'std' does not name a type
   28 | static std::new_handler old_new_handler = NULL;
      |             ^~~~~~~~~~~
llvmjit_error.cpp:32:64: error: 'string' in namespace 'std' does not name a type
   32 | static void fatal_llvm_new_handler(void *user_data, const std::string& reason, bool gen_crash_diag);
      |                                                                ^~~~~~
llvmjit_error.cpp:25:1: note: 'std::string' is defined in header '<string>'; did you forget to '#include <string>'?
   24 | #include "jit/llvmjit.h"
  +++ |+#include <string>
   25 | 
llvmjit_error.cpp:34:66: error: 'string' in namespace 'std' does not name a type
   34 | static void fatal_llvm_error_handler(void *user_data, const std::string& reason, bool gen_crash_diag);
      |                                                                  ^~~~~~
llvmjit_error.cpp:34:61: note: 'std::string' is defined in header '<string>'; did you forget to '#include <string>'?
   34 | static void fatal_llvm_error_handler(void *user_data, const std::string& reason, bool gen_crash_diag);
      |                                                             ^~~
llvmjit_error.cpp: In function 'void llvm_enter_fatal_on_oom()':
llvmjit_error.cpp:60:17: error: 'old_new_handler' was not declared in this scope
   60 |                 old_new_handler = std::set_new_handler(fatal_system_new_handler);
      |                 ^~~~~~~~~~~~~~~
llvmjit_error.cpp:60:40: error: 'set_new_handler' is not a member of 'std'
   60 |                 old_new_handler = std::set_new_handler(fatal_system_new_handler);
      |                                        ^~~~~~~~~~~~~~~
llvmjit_error.cpp:62:55: error: invalid conversion from 'void (*)(void*, const int&, bool)' to 'llvm::fatal_error_handler_t' {aka 'void (*)(void*, const char*, bool)'} [-fpermissive]
   62 |                 llvm::install_bad_alloc_error_handler(fatal_llvm_new_handler);
      |                                                       ^~~~~~~~~~~~~~~~~~~~~~
      |                                                       |
      |                                                       void (*)(void*, const int&, bool)

A difference between passing and failing build roots is at <https://koschei.fedoraproject.org/build/12523903>. An upgrade of llvm and  clang from 13.0.1-1.fc37 to 14.0.0-1.fc37 looks suspicious.

Comment 1 Filip Januš 2022-04-06 10:23:37 UTC
Thanks for the report.
This issue is caused by llvm 14. Postgresql upstream is working on a fix. Meanwhile, there is llvm compact package.

Comment 2 Filip Januš 2022-07-20 09:18:43 UTC
Should be fixed since there is build (postgresql-14.3-6.fc37)