Re: pgsql: Move gramparse.h to src/backend/parser - Mailing list pgsql-committers

From Anton A. Melnikov
Subject Re: pgsql: Move gramparse.h to src/backend/parser
Date
Msg-id fb969d8d-7ef5-471b-ae90-d20cdbf6660b@postgrespro.ru
Whole thread Raw
In response to Re: pgsql: Move gramparse.h to src/backend/parser  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pgsql: Move gramparse.h to src/backend/parser
List pgsql-committers
Hi!

Sorry for the very long delay in responding, and thank you for your patience.
Regarding to previous points:

On 16.10.2025 07:19, John Naylor wrote:
> 
> Also, that fix
> was in response to a specific change in dependencies, so I don't see
> how it's directly applicable to earlier branches. Maybe there is
> something to be done here, but with such a sporadic failure, I'm not
> sure what.

On 16.10.2025 07:34, Tom Lane wrote:
> Yeah.  One build failure in three years does not sound to me like
> something to panic about.  It sounds more like a local problem.
> Also, I note that alligator is self-described as running a
> "gcc experimental (nightly build)" compiler, so temporary build
> glitches on it are hardly unexpected.

this all seems quite reasonable but i observe the same behavior
on earlier branches as well.
Using a pre-built source tree at REL_14/15_STABLE,
this reproduction:

cd src/backend/parser
rm -rf .deps/ gram.c scan.c *.o *.bc gram.h
make parser.bc

results in:

$ make parser.bc
/usr/lib/llvm-16/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Xclang
-no-opaque-pointers -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Wno-deprecated-non-prototype
-O2  -I. -I. -I../../../src/include -D_GNU_SOURCE  -I/usr/include/libxml2 -I/usr/local/include -flto=thin -emit-llvm
-c -o parser.bc parser.c
In file included from parser.c:25:
../../../src/include/parser/gramparse.h:29:10: fatal error: 'parser/gram.h' file not found
#include "parser/gram.h"
          ^~~~~~~~~~~~~~~
1 error generated.
make: *** [../../../src/Makefile.global:1084: parser.bc] Error 1


Also as a possible improvement perhaps make the fix less strictly?
I.e. replace each .bc file's dependency on all .o files
with a more weak dependency just on all .c files.
Namely use
$(patsubst %.o,%.bc, $(OBJS)): $(patsubst %.o,%.c, $(OBJS))
instead of:
$(patsubst %.o,%.bc, $(OBJS)): $(OBJS)

This should still ensure correct build ordering, and it
will run faster during parallel builds, since it won't wait
for absolutely all the object files to be created.

For example, rebuilding parser.bc would then require only
a single compiler call in src/backend/parser.
See the attached bc-depends-on-c.txt for details.


Best regards,

-- 
Anton A. Melnikov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
Attachment

pgsql-committers by date:

Previous
From: Amit Langote
Date:
Subject: pgsql: Add comment explaining fire_triggers=false in ri_PerformCheck()
Next
From: Amit Langote
Date:
Subject: pgsql: Doc: fix stale text about partition locking with cached plans