Обсуждение: make clean didn't clean up files generated from *.(y|l)

Поиск
Список
Период
Сортировка

make clean didn't clean up files generated from *.(y|l)

От
Kouhei Kaigai
Дата:
Hello,

I got the build error below. It concerns RESERVE_WAL is not defined,
however, it should not be a problem to be oversight for a long time.

I tried to build the latest master branch just after the switch from
REL9_5_STABLE and "make clean", however, repl_gram.c was not cleaned
up correctly. So, my problem is that repl_gram.l was the latest version,
but compiler saw the repl_gram.c generated based on the v9.5 source.

I could see the similar problems at: src/backend/replication/repl_gram.c src/interfaces/ecpg/preproc/pgc.c
src/bin/pgbench/exprparse.csrc/bin/pgbench/exprscan.c src/pl/plpgsql/src/pl_gram.c 

(*) At least, these files raised a build error.

Probably, we have to add explicit cleanup of these auto-generated files
on Makefiles.

Thanks,

----------------
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute
-Wformat-security-fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O2 -O0 -g -I. -I. -I../../../src/include
-D_GNU_SOURCE  -c -o repl_gram.o repl_gram.c 
In file included from repl_gram.y:320:0:
repl_scanner.l: In function 'replication_yylex':
repl_scanner.l:98:10: error: 'K_RESERVE_WAL' undeclared (first use in this function)RESERVE_WAL   { return
K_RESERVE_WAL;}         ^ 
repl_scanner.l:98:10: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [repl_gram.o] Error 1
make[3]: Leaving directory `/home/kaigai/repo/pgsql/src/backend/replication'
make[2]: *** [replication-recursive] Error 2
make[2]: Leaving directory `/home/kaigai/repo/pgsql/src/backend'
make[1]: *** [all-backend-recurse] Error 2
make[1]: Leaving directory `/home/kaigai/repo/pgsql/src'
make: *** [all-src-recurse] Error 2
----------------

--
NEC Business Creation Division / PG-Strom Project
KaiGai Kohei <kaigai@ak.jp.nec.com>





Re: make clean didn't clean up files generated from *.(y|l)

От
Tom Lane
Дата:
Kouhei Kaigai <kaigai@ak.jp.nec.com> writes:
> I tried to build the latest master branch just after the switch from
> REL9_5_STABLE and "make clean", however, repl_gram.c was not cleaned
> up correctly. So, my problem is that repl_gram.l was the latest version,
> but compiler saw the repl_gram.c generated based on the v9.5 source.
> ...
> Probably, we have to add explicit cleanup of these auto-generated files
> on Makefiles.

"make clean" absolutely should NOT remove that file; not even "make
distclean" should, because we ship it in tarballs.  Likewise for the other
bison product files you mention, as well as a boatload of other derived
files.

If you want to checkout a different release branch in the same working
directory, I'd suggest "make maintainer-clean" or "git clean -dfx" first.
(Personally I don't ever do that --- it's much easier to maintain a
separate workdir per branch.)

Having said that, switching to a different branch should have resulted in
repl_gram.l being updated by git, and thereby acquiring a new file mod
date; so I don't understand why make wouldn't have chosen to rebuild
repl_gram.c.  Can you provide a reproducible sequence that makes this
happen?
        regards, tom lane



Re: make clean didn't clean up files generated from *.(y|l)

От
Kouhei Kaigai
Дата:
> Kouhei Kaigai <kaigai@ak.jp.nec.com> writes:
> > I tried to build the latest master branch just after the switch from
> > REL9_5_STABLE and "make clean", however, repl_gram.c was not cleaned
> > up correctly. So, my problem is that repl_gram.l was the latest version,
> > but compiler saw the repl_gram.c generated based on the v9.5 source.
> > ...
> > Probably, we have to add explicit cleanup of these auto-generated files
> > on Makefiles.
>
> "make clean" absolutely should NOT remove that file; not even "make
> distclean" should, because we ship it in tarballs.  Likewise for the other
> bison product files you mention, as well as a boatload of other derived
> files.
>
> If you want to checkout a different release branch in the same working
> directory, I'd suggest "make maintainer-clean" or "git clean -dfx" first.
> (Personally I don't ever do that --- it's much easier to maintain a
> separate workdir per branch.)
>
> Having said that, switching to a different branch should have resulted in
> repl_gram.l being updated by git, and thereby acquiring a new file mod
> date; so I don't understand why make wouldn't have chosen to rebuild
> repl_gram.c.  Can you provide a reproducible sequence that makes this
> happen?
>
Ah, I might have inadequate operation just before the branch switching.

$ cd ~/source/pgsql     <-- REL9_5_STABLE; already built
$ git checkout master
$ cp -r ~/source/pgsql ~/repo/pgsql-kg
$ cd ~/repo/pgsql-kg
$ ./configure
$ make clean
$ make                  <-- repl_gram.c raised an error

~/source/pgsql is a copy of community's branch; with no my own modification.
To keep it clean, I copied entire repository to other directory, but cp command
updated the file modification timestamp.
I may be the reason why repl_gram.c was not rebuilt.

Sorry for the noise.
--
NEC Business Creation Division / PG-Strom Project
KaiGai Kohei <kaigai@ak.jp.nec.com>