Skip to content

Conversation

@anthonyroussel
Copy link

@anthonyroussel anthonyroussel commented Jan 28, 2026

Added BUILT_SOURCES for gram.c, gram.h, gram_minimal.c, gram_minimal.h and scan.c to ensure that bison generated files are built before compilation of dependent C files (when parallelisation is enabled using make -j).

@anthonyroussel
Copy link
Author

anthonyroussel commented Jan 28, 2026

Without BUILT_SOURCES, the pgpool2 build can fail with this error when parallelisation is enabled:

Running phase: buildPhase
build flags: -j8 SHELL=/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/bash
Making all in src
make[1]: Entering directory '/build/source/src'
Making all in parser
make[2]: Entering directory '/build/source/src/parser'
gcc -DHAVE_CONFIG_H -I. -I../../src/include  -D_GNU_SOURCE -I ../../src/include/parser -I /usr/local/pgsql/include   -g -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-format-truncation -Wno-stringop-truncation -fno-strict-aliasing -c -o copyfuncs.o copyfuncs.c
flex -o'scan.c' scan.l
gcc -DHAVE_CONFIG_H -I. -I../../src/include  -D_GNU_SOURCE -I ../../src/include/parser -I /usr/local/pgsql/include   -g -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-format-truncation -Wno-stringop-truncation -fno-strict-aliasing -c -o keywords.o keywords.c
gcc -DHAVE_CONFIG_H -I. -I../../src/include  -D_GNU_SOURCE -I ../../src/include/parser -I /usr/local/pgsql/include   -g -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-format-truncation -Wno-stringop-truncation -fno-strict-aliasing -c -o kwlookup.o kwlookup.c
gcc -DHAVE_CONFIG_H -I. -I../../src/include  -D_GNU_SOURCE -I ../../src/include/parser -I /usr/local/pgsql/include   -g -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-format-truncation -Wno-stringop-truncation -fno-strict-aliasing -c -o list.o list.c
gcc -DHAVE_CONFIG_H -I. -I../../src/include  -D_GNU_SOURCE -I ../../src/include/parser -I /usr/local/pgsql/include   -g -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-format-truncation -Wno-stringop-truncation -fno-strict-aliasing -c -o makefuncs.o makefuncs.c
gcc -DHAVE_CONFIG_H -I. -I../../src/include  -D_GNU_SOURCE -I ../../src/include/parser -I /usr/local/pgsql/include   -g -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-format-truncation -Wno-stringop-truncation -fno-strict-aliasing -c -o nodes.o nodes.c
gcc -DHAVE_CONFIG_H -I. -I../../src/include  -D_GNU_SOURCE -I ../../src/include/parser -I /usr/local/pgsql/include   -g -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-format-truncation -Wno-stringop-truncation -fno-strict-aliasing -c -o outfuncs.o outfuncs.c
gcc -DHAVE_CONFIG_H -I. -I../../src/include  -D_GNU_SOURCE -I ../../src/include/parser -I /usr/local/pgsql/include   -g -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-format-truncation -Wno-stringop-truncation -fno-strict-aliasing -c -o parser.o parser.c
gcc -DHAVE_CONFIG_H -I. -I../../src/include  -D_GNU_SOURCE -I ../../src/include/parser -I /usr/local/pgsql/include   -g -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-format-truncation -Wno-stringop-truncation -fno-strict-aliasing -c -o scansup.o scansup.c
gcc -DHAVE_CONFIG_H -I. -I../../src/include  -D_GNU_SOURCE -I ../../src/include/parser -I /usr/local/pgsql/include   -g -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-format-truncation -Wno-stringop-truncation -fno-strict-aliasing -c -o stringinfo.o stringinfo.c
gcc -DHAVE_CONFIG_H -I. -I../../src/include  -D_GNU_SOURCE -I ../../src/include/parser -I /usr/local/pgsql/include   -g -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-format-truncation -Wno-stringop-truncation -fno-strict-aliasing -c -o value.o value.c
In file included from parser.c:27:
../../src/include/parser/gramparse.h:33:10: fatal error: gram.h: No such file or directory
   33 | #include "gram.h"
      |          ^~~~~~~~
compilation terminated.
make[2]: *** [Makefile:439: parser.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/build/source/src/parser'
make[1]: *** [Makefile:948: all-recursive] Error 1
make[1]: Leaving directory '/build/source/src'
make: *** [Makefile:421: all-recursive] Error 1

Issue encountered while trying to migrate pgpool-II Nixpkgs package from tarball to Git fetch: NixOS/nixpkgs#484902

Added `BUILT_SOURCES` for gram.c, gram.h, gram_minimal.c, gram_minimal.h
and scan.c to ensure that bison generated files are built before
compilation of dependent C files (when parallelisation is enabled using `make -j`).
@tatsuo-ishii
Copy link
Collaborator

Thanks for the pull request. I think your fix is useful but since we do not accept pull requests, I have applied your patch to the original repository.
https://git.postgresql.org/gitweb/?p=pgpool2.git;a=summary

pengbo0328 pushed a commit that referenced this pull request Jan 29, 2026
Previously a parallel make failed with:

In file included from parser.c:27:
../../src/include/parser/gramparse.h:33:10: fatal error: gram.h: No such file or directory
   33 | #include "gram.h"

Author: anthony@roussel.dev
Discussion: #146
Backpatch-through: v4.3
pengbo0328 pushed a commit that referenced this pull request Jan 29, 2026
Previously a parallel make failed with:

In file included from parser.c:27:
../../src/include/parser/gramparse.h:33:10: fatal error: gram.h: No such file or directory
   33 | #include "gram.h"

Author: anthony@roussel.dev
Discussion: #146
Backpatch-through: v4.3
pengbo0328 pushed a commit that referenced this pull request Jan 29, 2026
Previously a parallel make failed with:

In file included from parser.c:27:
../../src/include/parser/gramparse.h:33:10: fatal error: gram.h: No such file or directory
   33 | #include "gram.h"

Author: anthony@roussel.dev
Discussion: #146
Backpatch-through: v4.3
pengbo0328 pushed a commit that referenced this pull request Jan 29, 2026
Previously a parallel make failed with:

In file included from parser.c:27:
../../src/include/parser/gramparse.h:33:10: fatal error: gram.h: No such file or directory
   33 | #include "gram.h"

Author: anthony@roussel.dev
Discussion: #146
Backpatch-through: v4.3
pengbo0328 pushed a commit that referenced this pull request Jan 29, 2026
Previously a parallel make failed with:

In file included from parser.c:27:
../../src/include/parser/gramparse.h:33:10: fatal error: gram.h: No such file or directory
   33 | #include "gram.h"

Author: anthony@roussel.dev
Discussion: #146
Backpatch-through: v4.3
pengbo0328 pushed a commit that referenced this pull request Jan 29, 2026
Previously a parallel make failed with:

In file included from parser.c:27:
../../src/include/parser/gramparse.h:33:10: fatal error: gram.h: No such file or directory
   33 | #include "gram.h"

Author: anthony@roussel.dev
Discussion: #146
Backpatch-through: v4.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants