public inbox for [email protected]
help / color / mirror / Atom feedFrom: Andres Freund <[email protected]>
To: Maksim.Melnikov <[email protected]>
Cc: [email protected]
Subject: Re: Fix race with LLVM and bison.
Date: Fri, 27 Mar 2026 14:56:16 -0400
Message-ID: <v67jke2iv6kaywjnvwhxc3u5x3ttvrz555k5ngcxu2qwu435rl@5wpsxnrsz23k> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
Hi,
On 2026-03-27 14:31:52 +0300, Maksim.Melnikov wrote:
> I've found build error in configuration --with-llvm
>
> CPPFLAGS="-O2" ./configure --enable-debug --enable-cassert
> --enable-tap-tests --with-openssl --with-icu --with-llvm
>
> ....
>
> make world-bin -j3
>
> ....
>
> cubescan.c:9:10: fatal error: 'cubeparse.h' file not found
> 9 | #include "cubeparse.h" /* must be after cubedata.h for YYSTYPE and
> NDBOX */
>
> ....
> segscan.c:9:10: fatal error: 'segparse.h' file not found
> 9 | #include "segparse.h" /* must be after segdata.h for SEG */
>
>
> The reason is race, that exist between LLVM compilation and bison source
> code generation and compilation can occur first.
>
> Ideally LLVM compilation target should depend on header files targets.
>
> The error is difficult to reproduce and I've done simple patch to have
> stable reproducing. Fix patch is also attached.
You don't need a sleep to show there's a problem, you can just do
make -C contrib/cube cubescan.bc
We don't have the same issue in the backend, as for backend code each .bc file
depends on the .o file:
src/backend/common.mk:
ifeq ($(with_llvm), yes)
objfiles.txt: $(patsubst %.o,%.bc, $(OBJS))
$(patsubst %.o,%.bc, $(OBJS)): $(OBJS)
endif
But for some reason I didn't add the same logic to pgxs.mk.
I think we need something like the attached to make the dependencies work.
I'm a bit worried about breaking some extensions if were to backpatch this. So
I'm somewhat inclined to just fix this in master.
Greetings,
Andres Freund
Attachments:
[text/x-diff] fix-llvm-contrib-pgxs-deps.diff (1.4K, 2-fix-llvm-contrib-pgxs-deps.diff)
download | inline diff:
diff --git i/src/makefiles/pgxs.mk w/src/makefiles/pgxs.mk
index 039cee3dfe5..d7732024b15 100644
--- i/src/makefiles/pgxs.mk
+++ w/src/makefiles/pgxs.mk
@@ -219,7 +219,12 @@ endef
all: $(PROGRAM) $(DATA_built) $(HEADER_allbuilt) $(SCRIPTS_built) $(addsuffix $(DLSUFFIX), $(MODULES)) $(addsuffix .control, $(EXTENSION))
ifeq ($(with_llvm), yes)
+# Ensure that .bc files for MODULES and OBJS get built with all
all: $(addsuffix .bc, $(MODULES)) $(patsubst %.o,%.bc, $(OBJS))
+# Ensure that each .bc file depends on the corresponding .o file, to ensure
+# the dependencies required for it to be built are present.
+$(patsubst %.o,%.bc, $(OBJS)): $(OBJS)
+$(addsuffix .bc, $(MODULES)): $(addsuffix .o, $(MODULES))
endif
ifdef MODULE_big
diff --git i/src/backend/common.mk w/src/backend/common.mk
index 61861f5c7eb..85bb4ee2527 100644
--- i/src/backend/common.mk
+++ w/src/backend/common.mk
@@ -22,7 +22,10 @@ objfiles.txt: Makefile $(SUBDIROBJS) $(OBJS)
$(if $(filter-out $(OBJS),$?),( $(if $(SUBDIROBJS),cat $(SUBDIROBJS); )echo $(addprefix $(subdir)/,$(OBJS)) ) >$@,touch $@)
ifeq ($(with_llvm), yes)
+# Ensure that .bc files get built when building .o files
objfiles.txt: $(patsubst %.o,%.bc, $(OBJS))
+# Ensure that each .bc file depends on the corresponding .o file, to ensure
+# the dependencies required for it to be built are present.
$(patsubst %.o,%.bc, $(OBJS)): $(OBJS)
endif
view thread (4+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Fix race with LLVM and bison.
In-Reply-To: <v67jke2iv6kaywjnvwhxc3u5x3ttvrz555k5ngcxu2qwu435rl@5wpsxnrsz23k>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox