This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Urgent Question regarding GCOV
- From: Jayashree Ramani <rjayashree at yahoo dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 22 Apr 2009 07:46:30 -0700 (PDT)
- Subject: Re: Urgent Question regarding GCOV
- Reply-to: rjayashree at yahoo dot com
Thanks Ian. I appreciate your PROMPT response! Wow!
In anycase, I do have followup question. Should I ask you or ask gcc-help?
I have used "-fprofile-arcs -ftest-coverage" options for compilation. Do I still add --coverage for Linking as LINK_FLAGS?
I will try that.... whats the latest gcc we should use?
Many Many Thanks!
Jayashree
--- On Wed, 4/22/09, Ian Lance Taylor <iant@google.com> wrote:
> From: Ian Lance Taylor <iant@google.com>
> Subject: Re: Urgent Question regarding GCOV
> To: rjayashree@yahoo.com
> Cc: gcc@gcc.gnu.org
> Date: Wednesday, April 22, 2009, 10:41 AM
> 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