pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Anton A. Melnikov <a.melnikov@postgrespro.ru>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: John Naylor <johncnaylorls@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Move gramparse.h to src/backend/parser
Date: Mon, 30 Mar 2026 04:30:56 +0300
Message-ID: <fb969d8d-7ef5-471b-ae90-d20cdbf6660b@postgrespro.ru> (raw)
In-Reply-To: <1368269.1760589291@sss.pgh.pa.us>
References: <E1oYJbR-000FbR-LP@gemulon.postgresql.org>
	<2862807.1663184226@sss.pgh.pa.us>
	<20220914205715.xbmuqox5htobzggy@awork3.anarazel.de>
	<20220914210427.y26tkagmxo5wwbvp@awork3.anarazel.de>
	<CAFBsxsGCoEpiSWUBxnkKFq5S0oNtfB9P+rOjXtgiNLZYDfXa5w@mail.gmail.com>
	<ac5ebc67-9a2f-4a95-88b2-7ac09e63dc3e@postgrespro.ru>
	<CANWCAZaCk6mX1c4oCQc9fzjtiVZ_Fh19dipOScy7XEjJqAd3gg@mail.gmail.com>
	<1368269.1760589291@sss.pgh.pa.us>

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
$ make parser.bc
'/usr/bin/perl' ./check_keywords.pl gram.y ../../../src/include/parser/kwlist.h
/usr/local/bin/bison -Wno-deprecated  -d -o gram.c gram.y
/usr/local/bin/flex -b -CF -p -p -o'scan.c' scan.l
'/usr/bin/perl' ../../../src/tools/fix-old-flex-code.pl 'scan.c'
/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 -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

$ ls
analyze.c          gram.h       Makefile     parse_clause.c   parse_cte.c   parse_func.c   parse_oper.c   parser.c          parse_type.c     scan.c
check_keywords.pl  gramparse.h  meson.build  parse_coerce.c   parse_enr.c   parse_merge.c  parse_param.c  parse_relation.c  parse_utilcmd.c  scan.l
gram.c             gram.y       parse_agg.c  parse_collate.c  parse_expr.c  parse_node.c   parser.bc      parse_target.c    README           scansup.c

Attachments:

  [text/plain] bc-depends-on-c.txt.txt (1.0K, ../fb969d8d-7ef5-471b-ae90-d20cdbf6660b@postgrespro.ru/2-bc-depends-on-c.txt.txt)
  download | inline:
$ make parser.bc
'/usr/bin/perl' ./check_keywords.pl gram.y ../../../src/include/parser/kwlist.h
/usr/local/bin/bison -Wno-deprecated  -d -o gram.c gram.y
/usr/local/bin/flex -b -CF -p -p -o'scan.c' scan.l
'/usr/bin/perl' ../../../src/tools/fix-old-flex-code.pl 'scan.c'
/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 -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

$ ls
analyze.c          gram.h       Makefile     parse_clause.c   parse_cte.c   parse_func.c   parse_oper.c   parser.c          parse_type.c     scan.c
check_keywords.pl  gramparse.h  meson.build  parse_coerce.c   parse_enr.c   parse_merge.c  parse_param.c  parse_relation.c  parse_utilcmd.c  scan.l
gram.c             gram.y       parse_agg.c  parse_collate.c  parse_expr.c  parse_node.c   parser.bc      parse_target.c    README           scansup.c

view thread (13+ messages)  latest in thread

Message-ID: <fb969d8d-7ef5-471b-ae90-d20cdbf6660b@postgrespro.ru>
Permalink:  ../fb969d8d-7ef5-471b-ae90-d20cdbf6660b@postgrespro.ru/
Also on:    postgresql.org/message-id/fb969d8d-7ef5-471b-ae90-d20cdbf6660b@postgrespro.ru

 · 

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: pgsql-committers@postgresql.org
  Cc: a.melnikov@postgrespro.ru, tgl@sss.pgh.pa.us, johncnaylorls@gmail.com, andres@anarazel.de, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Move gramparse.h to src/backend/parser
  In-Reply-To: <fb969d8d-7ef5-471b-ae90-d20cdbf6660b@postgrespro.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox