Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8343855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:11:34+00:00 2026-06-09T06:11:34+00:00

I have a C++ project that uses the GNU Autotools for its build scripts

  • 0

I have a C++ project that uses the GNU Autotools for its build scripts and libtool for linking. Recently I have added code coverage instrumentation with gcov, by ensuring that

GCOV_CFLAGS="-fprofile-arcs -ftest-coverage"
GCOV_LDFLAGS="-fprofile-arcs -ftest-coverage"

..get included in my CFLAGS and LDFLAGS respectively. On OS X 10.7.4 using g++-4.2 (installed by homebrew), everything works fine.

On Ubuntu 12.04 using g++ 4.6.3, libtool fails to link one of my tests:

/bin/bash ./libtool --tag=CXX   --mode=link g++ -Wall -Wextra -Werror -ansi -fprofile-arcs -ftest-coverage -g -O0 -fprofile-arcs -ftest-coverage -L/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib   -o myproj/inttests/locale_test myproj/inttests/locale_test.o myproj/app/libapp.la -lboost_thread-mt -lboost_system-mt -pthread -llog4cplus  
libtool: link: g++ -Wall -Wextra -Werror -ansi -fprofile-arcs -ftest-coverage -g -O0 -fprofile-arcs -ftest-coverage -Wl,-rpath -Wl,/usr/local/lib -o myproj/inttests/.libs/locale_test myproj/inttests/locale_test.o -pthread  -L/usr/local/lib myproj/app/.libs/libapp.so -lboost_thread-mt -lboost_system-mt /usr/lib/liblog4cplus.so -pthread
/usr/bin/ld: myproj/inttests/.libs/locale_test: hidden symbol `atexit' in /usr/lib/x86_64-linux-gnu/libc_nonshared.a(atexit.oS) is referenced by DSO
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make[2]: *** [myproj/inttests/locale_test] Error 1

How do I fix my build on ubuntu/g++ 4.6?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T06:11:37+00:00Added an answer on June 9, 2026 at 6:11 am

    After googling around I see this thread, which suggests adding --coverage to CXXFLAGS when running ./configure. Indeed, though it didn’t work for that poster, it works for me:

    ./configure CXXFLAGS="--coverage"
    

    However this variable is reserved for the package installer, not the maintainer (me.) The question reduces to “How do I incorporate this into the build properly?”

    Here’s what’s not enough:

    GCOV_CFLAGS="-fprofile-arcs -ftest-coverage --coverage"
    GCOV_LDFLAGS="-fprofile-arcs -ftest-coverage"
    

    On the assumption that GCOV_CFLAGS gets included into the effective CXXFLAGS (not shown, but it does), it seems like this fix should work. It doesn’t.

    Digging in further, it seems we should at least get some traction if we drop CXXFLAGS="--coverage" from the command line and instead place it in configure.ac somewhere. This, actually, also did not work unless the line is placed above the AC_PROG_CXX call that selects the compiler.

    So now we gain a little insight. AC_PROG_CXX is altering something when it sees --coverage, which is very likely why the placement in GCOV_CFLAGS didn’t work: it was too late.

    Looking carefully through the logs, it appears the secret sauce is the automatic inclusion of -lgcov in the failing linking step. I’m not sure this library needed to be such a secret, but if I change my variables as so:

    GCOV_CFLAGS="-fprofile-arcs -ftest-coverage --coverage"
    GCOV_LDFLAGS="-fprofile-arcs -ftest-coverage"
    GCOV_LIBS="-lgcov"
    

    ..and ensure GCOV_LIBS is included in LIBS, then it all works, on all my platforms.

    EDIT: See also this thread.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a Subversion project that uses Gnu Autotools (i.e., automake, autoconf, and libtool)
We have a project that uses Maven as its build/dependency management tool. But our
I have a project that uses JQuery-UI. I recently found formee, which is a
I have a project that uses autotools. A nice feature of autotools is 'out-of-source'
I have a project that uses some legacy script for processing the source code.
I have inherited a pure C project that uses GNU Pth ( http://www.gnu.org/software/pth/ )
I have project that uses Hibernate: hibernate-core-3.6.7.Final.jar In its POM I found: <dependency> <groupId>org.hibernate.javax.persistence</groupId>
I have a project that uses a single .py file to build and zip
I have a project that uses two third party libraries, both of which make
We have a project that uses JPA/Hibernate on the server side, the mapped entity

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.