Bug #24792 compile-pentium-gcov fails while trying to compile bdb
Submitted: 4 Dec 2006 10:51 Modified: 31 Jan 2008 17:02
Reporter: Sergey Vojtovich Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:4.1 OS:Linux (Debian (Sarge))
Assigned to: Daniel Fischer CPU Architecture:Any

[4 Dec 2006 10:51] Sergey Vojtovich
Description:
BUILD/compile-pentium-gcov fails while trying to compile bdb. Seem to affect 4.1 only.

/bin/sh ./libtool --mode=link gcc -o db_archive -rdynamic \
    db_archive.o util_sig.o libdb.a -lpthread
gcc -o db_archive -rdynamic db_archive.o util_sig.o  libdb.a -lpthread
db_archive.o(.text+0x89d): In function `global constructors keyed to main_GCOV':
../.././bdb/dist/../db_archive/db_archive.c:180: undefined reference to `__gcov_init'
db_archive.o(.data+0x64): In function `main':
../.././bdb/dist/../db_archive/db_archive.c:48: undefined reference to `__gcov_merge_add'
util_sig.o(.text+0x16f): In function `global constructors keyed to __db_util_siginit_GCOV':
../.././bdb/dist/../common/util_sig.c:86: undefined reference to `__gcov_init'

How to repeat:
BUILD/compile-pentium-gcov
[4 Dec 2006 21:00] Sveta Smirnova
Thank you for the report.

Verified as described on Linux using last BK sources.
[7 Dec 2006 7:08] Kristian Nielsen
I think this might be solved by backporting relevant fixes to BUILD/compile-pentium-gcov from 5.0:

+# GCC4 needs -fprofile-arcs -ftest-coverage on the linker command line (as well
+# as on the compiler command line), and this requires setting LDFLAGS for BDB.
+export LDFLAGS="-fprofile-arcs -ftest-coverage"

Might also be good to include some other fixes:

+# Need to disable ccache, or we loose the gcov-needed compiler output files.
+CCACHE_DISABLE=1
+export CCACHE_DISABLE

-extra_flags="$pentium_cflags  -fprofile-arcs -ftest-coverage"
+# The  -fprofile-arcs and -ftest-coverage options cause GCC to instrument the
+# code with profiling information used by gcov.
+# the -DDISABLE_TAO_ASM is needed to avoid build failures in Yassl.
+extra_flags="$pentium_cflags -fprofile-arcs -ftest-coverage -DDISABLE_TAO_ASM"