make coverage-html would fail within build directory separate from source tree

Started by walkeralmost 5 years ago10 messages
#1walker
failaway@qq.com

Hi, hackers

During installation from source code, I created a build directory separate from the source tree, and execute the following command in the build directory:
/home/postgres/postgresql-13.2/configure -- enable-coverage
make
make check
make coverage-html

However, while executing make coverage-html, it failed with the following error messages:
/bin/lcov --gcov-tool /bin/gcov -q --no-external -c -i -d . -d /home/postgres/postgresql-13.2/ -o lcve_base.info
...
geninfo: ERROR: no .gcno files found in /home/postgres/postgresql-13.2/!
make: *** [lcov_base.info] Error 255
make: *** Deleting file 'lcov_base.info'

if I repeat the above steps within the source tree directory, make coverage-html works fine. From the official documentation, I didn't find any limitations for "make coverage-html", not sure if I miss something.

thanks
walker
 

#2Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: walker (#1)
Re: make coverage-html would fail within build directory separate from source tree

On 2021-Mar-04, walker wrote:

Hi, hackers

During installation from source code, I created a build directory separate from the source tree, and execute the following command in the build directory:
/home/postgres/postgresql-13.2/configure -- enable-coverage
make
make check
make coverage-html

However, while executing make coverage-html, it failed with the following error messages:
/bin/lcov --gcov-tool /bin/gcov -q --no-external -c -i -d . -d /home/postgres/postgresql-13.2/ -o lcve_base.info
...
geninfo: ERROR: no .gcno files found in /home/postgres/postgresql-13.2/!
make: *** [lcov_base.info] Error 255
make: *** Deleting file 'lcov_base.info'

Hmm, it works fine for me. config.log says I do this (in
/pgsql/build/master-coverage):

$ /pgsql/source/REL_13_STABLE/configure --enable-debug --enable-depend --enable-cassert --enable-coverage --cache-file=/home/alvherre/run/pgconfig.master-coverage.cache --enable-thread-safety --enable-tap-tests --with-python --with-perl --with-tcl --with-openssl --with-libxml --with-tclconfig=/usr/lib/tcl8.6 PYTHON=/usr/bin/python3 --prefix=/pgsql/install/master-coverage --with-pgport=55451

I do run "make install" too, though (and "make -C contrib install").
Not sure if that makes a difference.
But for sure there are no .gcno files in the source dir -- they're all
in the build dir.

--
�lvaro Herrera Valdivia, Chile
"La persona que no quer�a pecar / estaba obligada a sentarse
en duras y empinadas sillas / desprovistas, por cierto
de blandos atenuantes" (Patricio Vogel)

#3Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: Alvaro Herrera (#2)
Re: make coverage-html would fail within build directory separate from source tree

On 2021-Mar-04, Alvaro Herrera wrote:

On 2021-Mar-04, walker wrote:

Hi, hackers

During installation from source code, I created a build directory separate from the source tree, and execute the following command in the build directory:
/home/postgres/postgresql-13.2/configure -- enable-coverage
make
make check
make coverage-html

However, while executing make coverage-html, it failed with the following error messages:
/bin/lcov --gcov-tool /bin/gcov -q --no-external -c -i -d . -d /home/postgres/postgresql-13.2/ -o lcve_base.info
...
geninfo: ERROR: no .gcno files found in /home/postgres/postgresql-13.2/!

"make coverage-html" outputs this: note that I get a WARNING about the
source directory rather than an ERROR:

/usr/bin/lcov --gcov-tool /usr/bin/gcov -q --no-external -c -i -d . -d /pgsql/source/REL_13_STABLE/ -o lcov_base.info
geninfo: WARNING: no .gcno files found in /pgsql/source/REL_13_STABLE/ - skipping!
/usr/bin/lcov --gcov-tool /usr/bin/gcov -q --no-external -c -d . -d /pgsql/source/REL_13_STABLE/ -o lcov_test.info
geninfo: WARNING: no .gcda files found in /pgsql/source/REL_13_STABLE/ - skipping!
rm -rf coverage
/usr/bin/genhtml -q --legend -o coverage --title='PostgreSQL 13.2' --num-spaces=4 lcov_base.info lcov_test.info
touch coverage-html-stamp

(In my system, /pgsql is a symlink to /home/alvhere/Code/pgsql/)

$ geninfo --version
geninfo: LCOV version 1.13

--
�lvaro Herrera Valdivia, Chile

#4walker
failaway@qq.com
In reply to: Alvaro Herrera (#2)
Re: make coverage-html would fail within build directory separate from source tree

thanks for your reply. it indeed that there are no .gcon files in source tree directory, they're in build tree directory, which results in failures.

That's a bit wired.

Add more detailed testing steps:
mkdir build_dir
cd build_dir
/home/postgres/postgresql-13.2/configure -- enable-coverage
make
make check
make coverage-html

thanks
walker

------------------ Original ------------------
From: "Alvaro Herrera" <alvherre@alvh.no-ip.org&gt;;
Date:&nbsp;Thu, Mar 4, 2021 09:31 PM
To:&nbsp;"walker"<failaway@qq.com&gt;;
Cc:&nbsp;"pgsql-hackers"<pgsql-hackers@lists.postgresql.org&gt;;
Subject:&nbsp;Re: make coverage-html would fail within build directory separate from source tree

On 2021-Mar-04, walker wrote:

&gt; Hi, hackers
&gt;
&gt; During installation from source code, I created a build directory separate from the source tree, and execute the following command in the build directory:
&gt; /home/postgres/postgresql-13.2/configure -- enable-coverage
&gt; make
&gt; make check
&gt; make coverage-html
&gt;
&gt;
&gt; However, while executing make coverage-html, it failed with the following error messages:
&gt; /bin/lcov --gcov-tool /bin/gcov -q --no-external -c -i -d . -d /home/postgres/postgresql-13.2/ -o lcve_base.info
&gt; ...
&gt; geninfo: ERROR: no .gcno files found in /home/postgres/postgresql-13.2/!
&gt; make: *** [lcov_base.info] Error 255
&gt; make: *** Deleting file 'lcov_base.info'

Hmm, it works fine for me.&nbsp; config.log says I do this (in
/pgsql/build/master-coverage):

&nbsp; $ /pgsql/source/REL_13_STABLE/configure --enable-debug --enable-depend --enable-cassert --enable-coverage --cache-file=/home/alvherre/run/pgconfig.master-coverage.cache --enable-thread-safety --enable-tap-tests --with-python --with-perl --with-tcl --with-openssl --with-libxml --with-tclconfig=/usr/lib/tcl8.6 PYTHON=/usr/bin/python3 --prefix=/pgsql/install/master-coverage --with-pgport=55451

I do run "make install" too, though (and "make -C contrib install").
Not sure if that makes a difference.&nbsp;
But for sure there are no .gcno files in the source dir -- they're all
in the build dir.

--
Álvaro Herrera&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Valdivia, Chile
"La persona que no quería pecar / estaba obligada a sentarse
&nbsp;en duras y empinadas sillas&nbsp;&nbsp;&nbsp; / desprovistas, por cierto
&nbsp;de blandos atenuantes"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Patricio Vogel)

#5Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: walker (#4)
Re: make coverage-html would fail within build directory separate from source tree

On 2021-Mar-04, walker wrote:

thanks for your reply. it indeed that there are no .gcon files in source tree directory, they're in build tree directory, which results in failures.

That's a bit wired.

Add more detailed testing steps:
mkdir build_dir
cd build_dir
/home/postgres/postgresql-13.2/configure -- enable-coverage
make
make check
make coverage-html

Hmm, my build dir is not inside the source dir -- is yours? Maybe that
makes a difference? Also, what version of lcov do you have?

--
�lvaro Herrera 39�49'30"S 73�17'W
"Someone said that it is at least an order of magnitude more work to do
production software than a prototype. I think he is wrong by at least
an order of magnitude." (Brian Kernighan)

#6walker
failaway@qq.com
In reply to: Alvaro Herrera (#5)
Re: make coverage-html would fail within build directory separate from source tree

The same, the build directory is outside the source tree.

the version of lcov is 1.10

thanks
walker

------------------&nbsp;Original&nbsp;------------------
From: "Alvaro Herrera" <alvherre@alvh.no-ip.org&gt;;
Date:&nbsp;Thu, Mar 4, 2021 10:05 PM
To:&nbsp;"walker"<failaway@qq.com&gt;;
Cc:&nbsp;"pgsql-hackers"<pgsql-hackers@lists.postgresql.org&gt;;
Subject:&nbsp;Re: make coverage-html would fail within build directory separate from source tree

On 2021-Mar-04, walker wrote:

&gt; thanks for your reply. it indeed that there are no .gcon files in source tree directory, they're in build tree directory, which results in failures.
&gt;
&gt;
&gt; That's a bit wired.
&gt;
&gt;
&gt; Add more detailed testing steps:
&gt; mkdir build_dir
&gt; cd build_dir
&gt; /home/postgres/postgresql-13.2/configure -- enable-coverage
&gt; make
&gt; make check
&gt; make coverage-html

Hmm, my build dir is not inside the source dir -- is yours?&nbsp; Maybe that
makes a difference?&nbsp; Also, what version of lcov do you have?

--
Álvaro Herrera&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 39°49'30"S 73°17'W
"Someone said that it is at least an order of magnitude more work to do
production software than a prototype. I think he is wrong by at least
an order of magnitude."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Brian Kernighan)

#7Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: walker (#6)
Re: make coverage-html would fail within build directory separate from source tree

On 2021-Mar-04, walker wrote:

The same, the build directory is outside the source tree.

the version of lcov is 1.10

That seems *really* ancient. Please try with a fresher version.

--
�lvaro Herrera 39�49'30"S 73�17'W
"How amazing is that? I call it a night and come back to find that a bug has
been identified and patched while I sleep." (Robert Davidson)
http://archives.postgresql.org/pgsql-sql/2006-03/msg00378.php

#8walker
failaway@qq.com
In reply to: Alvaro Herrera (#7)
Re: make coverage-html would fail within build directory separate from source tree

install a newer version of lcov 1.13, it works fine with WARNING just same as yours.

much appreciated

thanks
walker

------------------ Original ------------------
From: "Alvaro Herrera" <alvherre@alvh.no-ip.org&gt;;
Date:&nbsp;Thu, Mar 4, 2021 10:20 PM
To:&nbsp;"walker"<failaway@qq.com&gt;;
Cc:&nbsp;"pgsql-hackers"<pgsql-hackers@lists.postgresql.org&gt;;
Subject:&nbsp;Re: make coverage-html would fail within build directory separate from source tree

On 2021-Mar-04, walker wrote:

&gt; The same, the build directory is outside the source tree.
&gt;
&gt;
&gt; the version of lcov is 1.10

That seems *really* ancient.&nbsp; Please try with a fresher version.

--
Álvaro Herrera&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; 39°49'30"S 73°17'W
"How amazing is that? I call it a night and come back to find that a bug has
been identified and patched while I sleep."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; (Robert Davidson)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; http://archives.postgresql.org/pgsql-sql/2006-03/msg00378.php

#9Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alvaro Herrera (#5)
Re: make coverage-html would fail within build directory separate from source tree

Alvaro Herrera <alvherre@alvh.no-ip.org> writes:

Hmm, my build dir is not inside the source dir -- is yours?

I recall that the gcc build instructions strongly warn against that
sort of setup. Maybe we should too?

Actually, our build instructions already say this specifically:

You can also run configure in a directory outside the source tree, and
then build there, if you want to keep the build directory separate
from the original source files. This procedure is called a VPATH
build ...

Maybe "outside the source tree" needs to be emphasized a bit more.

regards, tom lane

#10walker
failaway@qq.com
In reply to: Tom Lane (#9)
Re: make coverage-html would fail within build directory separate from source tree

Thanks for your reminder, Tom.

Before I understand VPATH well, I always thought "outside the source tree" means the build tree is not under source tree.

Here because of VPATH build, which means build tree should be a subdirectory of source tree. according to this rule, I retry this scenario with old version of lcov(1.10).
tar -zxf source_dir.tar.gz
cd source_dir
mkdir build_dir &amp;&amp; cd build_dir
../configure --enable-coverage
make
make check
make coverage-html

And "make coverage-html" works fine, no any error, or warning, output is like this:
/bin/lcov --gcov-tool /bin/gcov -q --no-external -c -i -d . -d source_dir/build_dir/../ -o lcov_base.info
/bin/lcov --gcov-tool /bin/gcov -q --no-external -c -d . -d source_dir/build_dir/../ -o lcov_test.info
rm -rf coverage
/bin/genhtml -q --legend -o coverage --title='PostgreSQL 13.2' --num-spaces=4 lcov_base.info lcov_test.info
touch coverage-html-stamp

thanks
walker

------------------&nbsp;Original&nbsp;------------------
From: "Tom Lane" <tgl@sss.pgh.pa.us&gt;;
Date:&nbsp;Thu, Mar 4, 2021 11:21 PM
To:&nbsp;"Alvaro Herrera"<alvherre@alvh.no-ip.org&gt;;
Cc:&nbsp;"walker"<failaway@qq.com&gt;;"pgsql-hackers"<pgsql-hackers@lists.postgresql.org&gt;;
Subject:&nbsp;Re: make coverage-html would fail within build directory separate from source tree

Alvaro Herrera <alvherre@alvh.no-ip.org&gt; writes:
&gt; Hmm, my build dir is not inside the source dir -- is yours?

I recall that the gcc build instructions strongly warn against that
sort of setup.&nbsp; Maybe we should too?

Actually, our build instructions already say this specifically:

&nbsp;&nbsp;&nbsp; You can also run configure in a directory outside the source tree, and
&nbsp;&nbsp;&nbsp; then build there, if you want to keep the build directory separate
&nbsp;&nbsp;&nbsp; from the original source files. This procedure is called a VPATH
&nbsp;&nbsp;&nbsp; build ...

Maybe "outside the source tree" needs to be emphasized a bit more.

regards, tom lane