Any advice on building a code coverage build with gcov?

I'm trying to build a code coverage instrumented build with gcov; 
however, I'm not having much luck.

I'm using the mozilla central repo, on Ubuntu 8.04.  My gcc version is: 
4.2.3.  My gcov version is also 4.2.3.

I've tried the following different settings in my mozconfig file, and I 
note the output of each below them.

# Take 1
export CFLAGS="-fprofile-arcs -ftest-coverage"
export CXXFLAGS="-fprofile-arcs -ftest-coverage"
export LDFLAGS="-lgcov"
--> DSO errors on compiled tests (see the error below)


# Take 2
export CFLAGS="-fprofile-arcs -ftest-coverage -shared"
export CXXFLAGS="-fprofile-arcs -ftest-coverage -shared"
export OS_CFLAGS="-fprofile-arcs -ftest-coverage"
export LDFLAGS="-lgcov"
export XLDOPTS="-lgcov"
--> segfaults in binaries (see the error below)
--> note that this one did not hit any DSO errors.  Also rebuilding the 
specific DSO failures with the -shared option present caused those 
builds to succeed, but I then hit the segfault issue once I tried to run 
binaries generated that way.

# Take 3
export CFLAGS="-fprofile-arcs -ftest-coverage"
export CXXFLAGS="-fprofile-arcs -ftest-coverage"
export OS_CFLAGS="-fprofile-arcs -ftest-coverage"
export LDFLAGS="-lgcov"
export XLDOPTS="-lgcov"
# --> DSO errors on compiled tests (see the error below)

# Take 4 - bc's approach
export CFLAGS="--coverage"
export CXXFLAGS="--coverage"
export OS_CFLAGS="--coverage"
export LDFLAGS="--coverage"
export XLDOPTS="--coverage"
# --> DSO errors on compiled tests (see the error below)

== The Errors ==

Attempts 1, 3, and 4 all create the same error, it happens for every 
compiled code test and it looks like this:

ar cr libxremote_client_s.a XRemoteClient.o
ranlib libxremote_client_s.a
/usr/bin/ld: mozilla-xremote-client: hidden symbol `__gcov_merge_add' in 
/usr/lib/gcc/i486-linux-gnu/4.2.3/libgcov.a(_gcov_merge_add.o) is 
referenced by DSO
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
make[4]: *** [mozilla-xremote-client] Error 1
make[4]: Leaving directory 
`/home/mozilla/mozcentral/dbg/widget/src/xremoteclient'
make[3]: *** [libs_tier_toolkit] Error 2
make[3]: Leaving directory `/home/mozilla/mozcentral/dbg'
make[2]: *** [tier_toolkit] Error 2
make[2]: Leaving directory `/home/mozilla/mozcentral/dbg'
make[1]: *** [default] Error 2
make[1]: Leaving directory `/home/mozilla/mozcentral/dbg'
make: *** [build] Error 2

Attempt 2 causes a segfault immediately when any built binary is executed:

gcc  -DOSTYPE=\"Linux2.6\" -DOSARCH=Linux 
-I/home/mozilla/mozcentral/config -I.  -I../dist/include 
-I../dist/include -I../dist/include/nspr     -I../dist/sdk/include 
-fPIC  -Wall -W -Wno-unused -Wpointer-arith -Wcast-align -W 
-Wno-long-long -pedantic -fprofile-arcs -ftest-coverage -shared 
-fno-strict-aliasing -pthread -pipe  -DDEBUG -D_DEBUG -DDEBUG_mozilla 
-DTRACING -g -fno-inline   -include ../mozilla-config.h -DMOZILLA_CLIENT 
  -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   -o elf-dynstr-gc 
/home/mozilla/mozcentral/config/elf-dynstr-gc.c -lpthread -lgcov 
  -Wl,-rpath-link,../dist/bin -lgobject-2.0 -lglib-2.0
gcc -o nsinstall -fprofile-arcs -ftest-coverage -shared -DXP_UNIX 
host_nsinstall.o host_pathsub.o
/home/mozilla/mozcentral/dbg/config/nsinstall -R -m 644 
.../mozilla-config.h /home/mozilla/mozcentral/config/nsStaticComponents.h 
  ../dist/include
make[4]: *** [export] Segmentation fault
make[4]: Leaving directory `/home/mozilla/mozcentral/dbg/config'
make[3]: *** [export_tier_base] Error 2
make[3]: Leaving directory `/home/mozilla/mozcentral/dbg'
make[2]: *** [tier_base] Error 2
make[2]: Leaving directory `/home/mozilla/mozcentral/dbg'
make[1]: *** [default] Error 2
make[1]: Leaving directory `/home/mozilla/mozcentral/dbg'
make: *** [build] Error 2

I really appreciate any advice or direction you can give me on this. 
I've also attempted this on Mac OS X 10.4 (gcc 4.0.1) and I got 
something that looked a lot like the "DSO" error, though it had a 
different wording it was still referring to the problem of being unable 
to link with the shared libraries.

I've read that building with gcov in shared library is usually a 
problem.  Is there a way to build the core OS libaries in as statics? 
Perhaps that would solve this.

Thanks for the help.

Clint
0
Clint
6/26/2008 3:28:24 AM
mozilla.dev.builds 1761 articles. 0 followers. Post Follow

5 Replies
2258 Views

Similar Articles

[PageSpeed] 25
Get it on Google Play
Get it on Apple App Store

On 26.06.2008 05:28, Clint Talbert wrote:
> I'm trying to build a code coverage instrumented build with gcov; 
> however, I'm not having much luck.
> 
> I'm using the mozilla central repo, on Ubuntu 8.04.  My gcc version is: 
> 4.2.3.  My gcov version is also 4.2.3.
[...]
> I've read that building with gcov in shared library is usually a 
> problem.  Is there a way to build the core OS libaries in as statics? 
> Perhaps that would solve this.

I have done the exact same exercise yesterday, although with GCC 3.3.5
on OS/2. There I had to use -static-libgcc in the LDFLAGS to be able to
link without errors.

   Peter.
0
Peter
6/27/2008 6:40:11 AM
Peter Weilbacher wrote:

> I have done the exact same exercise yesterday, although with GCC 3.3.5
> on OS/2. There I had to use -static-libgcc in the LDFLAGS to be able to
> link without errors.
Thanks Peter, let me give that a whirl on my Ubuntu box.

Clint
0
Clint
6/30/2008 9:08:33 PM
Peter Weilbacher wrote:
> On 26.06.2008 05:28, Clint Talbert wrote:
>> I'm trying to build a code coverage instrumented build with gcov; 
>> however, I'm not having much luck.
>>
>> I'm using the mozilla central repo, on Ubuntu 8.04.  My gcc version is: 
>> 4.2.3.  My gcov version is also 4.2.3.
> [...]
>> I've read that building with gcov in shared library is usually a 
>> problem.  Is there a way to build the core OS libaries in as statics? 
>> Perhaps that would solve this.
> 
> I have done the exact same exercise yesterday, although with GCC 3.3.5
> on OS/2. There I had to use -static-libgcc in the LDFLAGS to be able to
> link without errors.

I've tried this now with a couple of different attempts.  The best 
looking attempt (that got the furthest) has the mozconfig below.  It 
failed with this error:

c++ -o mozilla-xremote-client  -fno-rtti -fno-exceptions -Wall 
-Wconversion -Wpointer-arith -Woverloaded-virtual -Wsynth 
-Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-long-long 
-pedantic -fprofile-arcs -ftest-coverage -fno-strict-aliasing 
-fshort-wchar -pthread -pipe  -DDEBUG -D_DEBUG -DDEBUG_mozilla -DTRACING 
-g -fno-inline  mozilla-xremote-client.o XRemoteClient_standalone.o 
-lpthread -lgcov -static-libgcc 
-Wl,-rpath-link,../../../dist/bin -L../../../dist/bin 
-L../../../dist/lib -L../../../dist/lib -lplds4 -lplc4 -lnspr4 -lpthread 
-ldl  -lX11  -ldl -lm
ranlib libxremote_client_s.a
/usr/bin/ld: mozilla-xremote-client: hidden symbol `__gcov_merge_add' in 
/usr/lib/gcc/i486-linux-gnu/4.2.3/libgcov.a(_gcov_merge_add.o) is 
referenced by DSO
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
make[4]: *** [mozilla-xremote-client] Error 1
make[4]: Leaving directory 
`/home/mozilla/mozcentral/mozcentral-dbg/widget/src/xremoteclient'
make[3]: *** [libs_tier_toolkit] Error 2
make[3]: Leaving directory `/home/mozilla/mozcentral/mozcentral-dbg'
make[2]: *** [tier_toolkit] Error 2
make[2]: Leaving directory `/home/mozilla/mozcentral/mozcentral-dbg'
make[1]: *** [default] Error 2
make[1]: Leaving directory `/home/mozilla/mozcentral/mozcentral-dbg'
make: *** [build] Error 2


Here is the mozconfig:

.. $topsrcdir/browser/config/mozconfig

export CFLAGS="-fprofile-arcs -ftest-coverage"
export CXXFLAGS="-fprofile-arcs -ftest-coverage"
export LDFLAGS="-lgcov -static-libgcc"

mk_add_options MOZ_CO_PROJECT=browser
ac_add_options --enable-places
ac_add_options --enable-application=browser
ac_add_options --enable-airbag
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../mozcentral-dbg
mk_add_options 
MOZ_CO_MODULE=mozilla/js/tests,mozilla/tools/tinderbox-configs

ac_add_options --disable-tests
ac_add_options --enable-mochitest

ac_add_options --enable-extensions=default,inspector,layout-debug
# ac_add_options --disable-javaxpcom

ac_add_options --enable-debug
ac_add_options --disable-static
ac_add_options --enable-shared
ac_add_options --disable-optimize
ac_add_options --disable-composer
ac_add_options --disable-mailnews
ac_add_options --disable-crashreporter
ac_add_options --disable-install
ac_add_options --enable-libxul

#ac_add_options --with-macos-sdk="/Developer/SDKs/MacOSX10.4u.sdk"

mk_add_options MOZ_MAKE_FLAGS="-j3"

mk_add_options AUTOCONF=autoconf2.13

Thanks for any help or other ideas folks have.  I'm getting a VM set up 
with Ubuntu 7.10 to try it there.

Clint
0
Clint
7/2/2008 11:31:02 PM
Clint Talbert wrote:

> c++ -o mozilla-xremote-client  -fno-rtti -fno-exceptions -Wall 
> -Wconversion -Wpointer-arith -Woverloaded-virtual -Wsynth 
> -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-long-long 
> -pedantic -fprofile-arcs -ftest-coverage -fno-strict-aliasing 
> -fshort-wchar -pthread -pipe  -DDEBUG -D_DEBUG -DDEBUG_mozilla -DTRACING 
> -g -fno-inline  mozilla-xremote-client.o XRemoteClient_standalone.o 
> -lpthread -lgcov -static-libgcc -Wl,-rpath-link,../../../dist/bin 
> -L../../../dist/bin -L../../../dist/lib -L../../../dist/lib -lplds4 
> -lplc4 -lnspr4 -lpthread -ldl  -lX11  -ldl -lm
> ranlib libxremote_client_s.a
> /usr/bin/ld: mozilla-xremote-client: hidden symbol `__gcov_merge_add' in 
> /usr/lib/gcc/i486-linux-gnu/4.2.3/libgcov.a(_gcov_merge_add.o) is 
> referenced by DSO

This isn't very helpful, because it doesn't say *which* DSO is referencing 
that symbol. Can you run `nm` on the various sharedlib (libnspr4.so?) to 
find which one is referencing that symbol (and for kicks, figure out why 
that sharedlib isn't being linked against -lgcov).

--BDS
0
Benjamin
7/4/2008 4:49:53 AM
Benjamin Smedberg wrote:
> Clint Talbert wrote:
> 
> This isn't very helpful, because it doesn't say *which* DSO is 
> referencing that symbol. Can you run `nm` on the various sharedlib 
> (libnspr4.so?) to find which one is referencing that symbol (and for 
> kicks, figure out why that sharedlib isn't being linked against -lgcov).
> 
Thanks for the comment Benjamin.  Running nm on the libnspr4.so I can 
see that these symbols are indeed undefined:
0007b110 r __PRETTY_FUNCTION__.2718
          U __assert_fail@@GLIBC_2.0
00082054 A __bss_start
          U __ctype_b_loc@@GLIBC_2.3
          w __cxa_finalize@@GLIBC_2.1.3
00076130 t __divdi3
00076870 t __do_global_ctors_aux
0000a480 t __do_global_dtors_aux
00080b40 d __dso_handle
          U __environ@@GLIBC_2.0
          U __errno_location@@GLIBC_2.0
00076790 t __fstat
          U __fxstat64@@GLIBC_2.2
          U __fxstat@@GLIBC_2.0
          U __gcov_execv
          U __gcov_execve
          U __gcov_fork
          U __gcov_init
          U __gcov_merge_add
          w __gmon_start__
          U __h_errno_location@@GLIBC_2.0
0000a517 t __i686.get_pc_thunk.bx
000762b0 t __moddi3
          U __stack_chk_fail@@GLIBC_2.4
00076850 t __stack_chk_fail_local

One other thing that catches my eye here is that it appears that several 
versions of GLIBC_2.x are being referenced.  Is that normal?

I'm going to try to figure out why libnspr4.so isn't being linked 
against -lgcov next, I'm going to respin the build and I'll update here 
once I have something useful to report.

Thanks for the help.

Clint
0
Clint
7/10/2008 6:19:43 PM
Reply:

Similar Artilces:

VS Builds, and Builds, and Builds
Hello, Has anyone else had this problem?  After a while of developing, and I go to compile, VS takes forever to build and I have to end-task it.  It's definitely after I've been working for a while, then it finally has "had it" and just takes forever to build.  It's annoying as I know its not the machine (2.8 GHZ processor and 1GB RAM).  Has anyone else experienced this problem?  By the way, I do have SP1 installed. Also, after minimizing and switching around screens, when it does this, the building icon in the status bar doesn't show.  And, for more informati...

To build or not to build, that is the question
Hello, ever since I found out that VS.NET could upload all of your pages for you, I have used that method for uploading. However when using the Copy Project option, it seems to restart the aspnet service and the sessions clear. What I'm asking is when is it OK just to manually copy/paste some pages into the website directory w/out actually re-building the site? Right now, I have to wait until there are no users logged into my site to do updates, which are very minor, but include code-behind changes. Can I just upload the updated pages w/out building?In this world there are 10 types of pe...

superreview granted: [Bug 240775] RSA operations take 2x as long with gcc build as they do with VACPP build ; assembler code isn't in use : [Attachment 146339] Use mpi assembly code in gcc OS/2 build
Wan-Teh Chang <wchang0222@aol.com> has granted Julien Pierre <julien.pierre.bugs@sun.com>'s request for superreview: Bug 240775: RSA operations take 2x as long with gcc build as they do with VACPP build ; assembler code isn't in use http://bugzilla.mozilla.org/show_bug.cgi?id=240775 Attachment 146339: Use mpi assembly code in gcc OS/2 build http://bugzilla.mozilla.org/attachment.cgi?id=146339&action=edit ------- Additional Comments from Wan-Teh Chang <wchang0222@aol.com> r=wtc. You guys need to decide whether you want to use ALP as the assembler for ...

Build error while trying to build debug desktop build on MacOs10.9.5
While trying to build Firefox desktop debug on MacOs10.9.5, I get this build error: 13:28.99 host_arm_ex_to_module.o 13:29.60 host_dwarf_cfi_to_module.o 13:29.70 /Users/mwargers/mozilla-central/security/pkix/test/gtest/pkixnames_tests.cpp:1077:22: error: unused variable 'ipv4_other_addr_str' [-Werror,-Wunused-const-variable] 13:29.70 static const uint8_t ipv4_other_addr_str[] = "5.6.7.8"; 13:29.70 ^ 13:29.70 /Users/mwargers/mozilla-central/security/pkix/test/gtest/pkixnames_tests.cpp:1153:22: error: unused variable 'ipv4_constraint_truncat...

build flags for release builds
Hi, We would like to release a preview version of our extension (xforms) to run on FF3 beta 3. However, if we build our extension on a tree we pulled using the beta 3 tag (FIREFOX_3_0b3_RELEASE) and install the extension on the beta3 build that we downloaded from mozilla.org we get varying degrees of success. A windows build will work. A linux one will crash. I can't remember exactly what happened on mac...it didn't work so well, but I don't think it crashed. However, running the .xpi on the tree that we built runs just fine in all instances. So I'm gue...

Build error, building for otoro
Hi, I did 'git clone git://github.com/mozilla-b2g/B2G.git b2gotoro'. Then 'cd b2gotoro' Then './config.sh otoro'. Then I got this build error: pull: /system/build.prop -> ../../../backup-otoro/system/build.prop 832 files pulled. 0 files skipped. 5524 KB/s (87724365 bytes in 15.507s) Pulling "libauth.so" 3205 KB/s (9588 bytes in 0.002s) Pulling "libcm.so" 6374 KB/s (231280 bytes in 0.035s) Pulling "libdiag.so" 4425 KB/s (22824 bytes in 0.005s) Pulling "libdivxdrmdecrypt.so" remote object '/system/lib/libdi...

What builds the command to build miniperl?
--f46d040714a7179b1904ce331bcd Content-Type: text/plain; charset=ISO-8859-1 Hi, What builds the command to build miniperl? It's escaping spaces in the PATH, but not "(" and ")". PATH=...:/cygdrive/c/Program\ Files\ (x86)/Common\ Files/Microsoft\ Shared/Windows\ Live:... gcc -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -fstack-protector -L/usr/local/lib -o miniperl.exe \ perlmini.o opmini.o miniperlmain.o gv.o toke.o perly.o pad.o regcomp.o dump.o util.o mg.o reentr.o mro.o keywords.o hv.o av.o run.o pp_hot.o sv.o ...

How to build a project on Build Service
I have developed a program in Python (PyQt) which, at the moment, is just a folder with all those source, icon, xml etc. files. I zipped it in a *.tar.gz. Then I created a project in the OBS, uploaded the *.tar.gz in the Sources, selected repositories. And it shows the build status is broken. Has anyone built an rpm on OBS before? I just want to make an rpm of my program and make it available from my project repository. Please help me build it. What else do I need to do? I've read the OBS tutorial and guidelines but they don't really tell you step by step what you need to ...

Fennec build unusable with own build
Dev.platforms.mobile seems removed, so I'm posting this here: https://groups.google.com/forum/?fromgroups=#!topic/mozilla.dev.platforms.mobile/PrEk4BsKkfA I tried building Fennec for a patch that I made, but the build that came out of it seemed to be useless on the Galaxy Nexus phone. Fennec would start up all right, but I could not load anything in the browser. I built on MacOS X lion. I used the instructions here: https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_for_Android This pointed me to: https://wiki.mozilla.org/Mobile/Fennec/Android My .mozconfig file: #...

Problem building latest build
Had to perform a repair to my XE2 installation, just to repair the help system (fruitlessly, but not the point), and the wonderful installation system decided to re-install the antiquated Indy version delivered with XE2, because it doesn't value weekends much. So I downloaded the latest Indy10 build (5072), and get errors. First is that the "HdrIcmp.icmp_dun" referenced in IdRawBuildIcmpMask in IdRawFunctions does not find the "icmp_dun" field in TIdICMPHdr. Indeed, it isn't there. Checked the SVN and the Fulgan ZIP. Where can I find a working ZIP? ...

Build slow when building directories
I have an web application and when I build the majority of the time is spent building the directories.  Is there a way to speed that up? What files are in those directories?Thanks------------------------------------------------------------This posting is provided "AS IS" with no warranties, and confers no rights. The normal stuff, aspx and aspx.cs files. I guess I don't fully understand the issue. All files have to be compiled when you build the site. If majority of files are in directories, then majority of time will be spent in building files there. Or do you mean if ...

Building with --noftu on engineering builds
Hi team(s), I've raised a bug about building the Engineering builds with the "--noftu" flag. If this will affect or if you are in favour of it then please comment in this bug: https://bugzilla.mozilla.org/show_bug.cgi?id=876723 Thanks, Zac ...

Incremental Build builds too much
We have a large app /w ~20 pbl's that build into dll's. After doing a Full deployment, if I then do a Incremental deployment, PB (version 8.0.3) insists on completely recreating 3 or 4 of the dll's, even if I change nothing. This makes incremental builds take much longer than they used to. I'm guessing this is caused by some kind of dependency between objects in different libraries but I have no idea how to go about troubleshooting this. Any ideas? TIA! Ken Breneman kbreneman@earthlink.net Hi, Ken, This sounds like PB is erring too much on the side of sa...

[Gaia] data/config files for build system will be moved from build/ to build/config
Hi folks, there are more and more data/config files which is using on gaia build system, so I will move them from build/ to build/config/ if you use below files please move your files from build/ to build/config/: * build/apps-*.list * build/custom-extensions.json * build/custom-prefs.js * build/custom-settings.json * build/additional-extensions.json * build/custom-prefs.js * build/gps-prefs.js * build/payment-prefs.js * build/dogfood-prefs.js * build/communications_services.json * build/wallpaper*.jpg I will merge the pull request on Monday (1/6). https://bugzilla.mozill...

Web resources about - Any advice on building a code coverage build with gcov? - mozilla.dev.builds

Berlaymont building - Wikipedia, the free encyclopedia
...  / 50.84361; 4.38278 Coordinates : 50°50′37″N 4°22′58″E  /  50.84361°N 4.38278°E  / 50.84361; 4.38278 The Berlaymont is an office building ...

Spencer Street apartment fire: CBD building known to have illegal rooming houses
A CBD apartment building that caught fire on New Year's Eve is one of the many Melbourne buildings known to harbour illegal rooming houses, with ...

Mike Baird's $3 billion sell-off of public buildings
The NSW government is selling off some of Sydney's most iconic buildings.

Mosquito Hill bushfire: Six buildings destroyed despite fire being downgraded to watch and act
Six buildings are destroyed by a bushfire in SA's Fleurieu Peninsula despite crews stopping the spread of the blaze, the CFS says.

It's been 70 years since VW started building the Beetle
Filed under: Plants/Manufacturing , Volkswagen , Coupe Happy birthday, Beetle! This week marks 70 years since Volkswagen first started producing ...

Fire Engulfs Dubai Luxury Building
Flames ran up at least 20 stories of the 63-story luxury hotel and residential building called The Address Downtown.

Pilot killed in Alaska crash hit building where wife worked
Doug Demarest wasn't authorized to fly small plane that smashed into a building in downtown Anchorage, authorities say

China says it's building new homegrown aircraft carrier
China said Thursday that it's building a homegrown aircraft carrier as it seeks to expand its military clout.

The Koch brothers don't need to take over the Republican party, they're building their own
... Vogel at Politico has another massive, important story in his series about the "Koch Machine," this time looking at the brothers' party-building ...

Jarmund/Vigsnæs design summerhouse as five buildings
This Danish summerhouse by Norwegian studio Jarmund/Vigsnæs Architects is split into five buildings to enclose a wind-sheltered courtyard in ...

Resources last updated: 1/2/2016 6:30:25 PM