.bc files build dependency issues.
| От | Anton A. Melnikov |
|---|---|
| Тема | .bc files build dependency issues. |
| Дата | |
| Msg-id | b0574669-10f1-44ec-93fe-e3a03b246005@postgrespro.ru обсуждение исходный текст |
| Ответы |
Re: .bc files build dependency issues.
|
| Список | pgsql-hackers |
Hi!
While the original discussion was about a specific commit
ecaf7c5df and related fix in 16492df7 for 16+
and its effects [1], i would like to point out that
a similar behavior can be observed
on earlier stable branches (REL_14/15_STABLE) as well.
Using a pre-built source tree and the following reproduction
that is slightly modified version from [2] which suggests
that this is a known pattern for exposing the issue:
cd src/backend/parser
rm -rf .deps/ gram.c scan.c *.o *.bc gram.h
make parser.bc
result 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
Since this can be reproduced reliably on REL_14/15, it seems worth asking
whether fix for .bc files (or something equivalent) should also be
backpatched to lower branches, instead of only applying to newer ones.
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 source .c files.
Namely use:
$(patsubst %.o,%.bc, $(OBJS)): $(patsubst %.o,%.c, $(OBJS))
instead of:
$(patsubst %.o,%.bc, $(OBJS)): $(OBJS)
This might still preserve correct build ordering while reducing
unnecessary coupling between targets. As a result make 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 instead of many.
Please, see the attached bc-depends-on-c.txt and
bc-depends-on-o.txt for details.
Best regards,
--
Anton A. Melnikov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
[1] https://www.postgresql.org/message-id/flat/E1oYJbR-000FbR-LP%40gemulon.postgresql.org
[2] https://www.postgresql.org/message-id/20220915045007.zvlrqqicbttzpgi3%40awork3.anarazel.de
Вложения
В списке pgsql-hackers по дате отправления: