3

while I am building glibc library using yocto project it is giving
error: missing attribute ((constructor)) support??

after adding the coverage flags:

TARGET_CFLAGS += "-fprofile-arcs -ftest-coverage"
TARGET_LDFLAGS += "-lgcov -fprofile-arcs -ftest-coverage"

still, I am getting an error for glibc.

Please find the link of config log file : https://drive.google.com/file/d/14tiQJ8JIFE_tDWt3H9tS8zBBQROcZDNa/view

It is not working even after adding the following line in conf/local.conf :

EXTRA_OECONF = "libc_cv_ctors_header=yes"

Even i tried this

EXTRA_OECONF_append = "libc_cv_ctors_header=yes"

please find the config log file generated during compilation : https://drive.google.com/open?id=1kxTu8pt7h_9ty55OywP9Ilmmp04T61Rr

So, How to resolve this error?


Log file error Point

poky-linux/gcc/i586-poky-linux/8.2.0/ld: /tmp/ccxetEc1.o: in function    `_GLOBAL__sub_D_00100_1__start':
conftest.c:(.text.exit+0x40): undefined reference to `__gcov_exit'<br>
collect2: error: ld returned 1 exit status<br>
configure:5682: $? = 1<br>
configure:5702: error: missing __attribute__ ((constructor)) support??
Ajay.kundu
  • 195
  • 2
  • 10

2 Answers2

0

You are trying to build glibc with -fprofile-arcs -ftest-coverage in CFLAGS. That will not work. The errors you see are a result of these incorrect compiler flags.

A profiling glibc requires fairly substantial changes throughout the library and needs to be created by building with --enable-profile (which is not the default).

Florian Weimer
  • 32,022
  • 3
  • 48
  • 92
  • Thank you so much sir actually I am trying to integrate yocto project with gcov after removing flags from Glibc I am able to build successfully. – Ajay.kundu Feb 11 '19 at 10:58
0

I had this error while I tried to enable coverage on a C project using a C++ test harness (CppUTest). Build system was handled by CMake.

Compilers and gcov were aligned on the same version (gcc --version, g++ --version and gcov --version gave the same version) but it seems that my build system was generated with a gcc 5 (resulting to an additional included directory by the linker: usr/lib/gcc/x86_64-linux-gnu/5). I clean the build tree and generated it again thanks to CMake which fixed the error.

quent
  • 1,936
  • 1
  • 23
  • 28