I need to perform some test coverage with gcov
on a shared library I am working on.
The problem is libtool
renames the object files from my-name.c
to libmylib_la-my-name.lo
and gcov
is unable to handle that conversion. Everytime I run it, the error cannot open notes file
is generated.
If I manually rename my-name.c
to libmylib_la-my-name.c
after the build gcov
works fine, so there is no other problem apart the filename mangling.
Addendum
Trying to provide a minimal working example I discovered the filename mangling happens only when lib..._la_CFLAGS
is set (and also when it is set to an empty value).
cat <<EOT > configure.ac
AC_INIT(sample,0.0.1)
AC_CONFIG_SRCDIR(configure.ac)
AM_INIT_AUTOMAKE(foreign)
LT_INIT
AC_PROG_CC
AC_CONFIG_FILES(Makefile)
AC_OUTPUT
EOT
cat <<EOT > Makefile.am
lib_LTLIBRARIES=libsample.la
libsample_la_SOURCES=sample.c
# The following line triggers the filename mangling (libsample_la-sample.lo instead of sample.lo)
libsample_la_CFLAGS=
EOT
touch sample.c && autoreconf -if && ./configure && make
Is there a way to avoid the filename mangling operated by libtool or to let gcov
understand the filename mangling scheme?
Makefile.am
- you need to supply more information. – Lalla