This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Urgent Question regarding GCOV
- From: Ian Lance Taylor <iant at google dot com>
- To: rjayashree at yahoo dot com
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 22 Apr 2009 07:41:09 -0700
- Subject: Re: Urgent Question regarding GCOV
- References: <37610.26878.qm@web58201.mail.re3.yahoo.com>
Jayashree Ramani <rjayashree@yahoo.com> writes:
> Hello GCC Experts,
This message should have been sent to gcc-help@gcc.gnu.org rather than
gcc@gcc.gnu.org. Please send any followups to gcc-help.
>
> I am an engineer trying to run gcov for our unit tests. We have a couple of DLLs and a few static libraries.
>
> I am having trouble linking the Test program that links in the DLLs. I have the following in the Cmake files:
>
> IF( "${COVERAGE}" STREQUAL "TRUE" )
> LINK_DIRECTORIES(/usr/lib64/gcc-lib/x86_64-suse-linux/3.3.3)
> TARGET_LINK_LIBRARIES( NWATest analytics TestUtils ${SYSTEM_LIBS} )
> ENDIF( "${COVERAGE}" STREQUAL "TRUE" )
gcc 3.3.3 is quite old at this point.
> But I get the following errors:
>
> /bin/ld: NWATest: hidden symbol `__gcov_init' in /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.3/libgcc.a(_gcov.oS) is referenced by DSO
The error message means that some shared library is calling __gcov_init,
which is a hidden symbol. The way to fix this is to make sure that you
pass the --coverage option when you link the shared library. At least,
that will do the right thing with current gcc; I don't know for sure
that it will work with gcc 3.3.3.
Ian