Steps to Reproduce the issue
#include<iostream>
int main(){
std::cout << "Hello World" << std::endl;
}
Write main.cpp
Download Toolchain from this link
Compile with below commands.
- . /opt/poky/1.6/environment-setup-armv7a-vfp-neon-poky-linux-gnueabi
- arm-poky-linux-gnueabi-g++ main.cpp -o main --coverage
Will get an error like below.
Error
/opt/poky/1.6.1/sysroots/i686-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.8.3/ld: cannot find -lgcov collect2: error: ld returned 1 exit status
Problem Statement
How to generate a libgcov.so file for ARM poky toolchain?
-fprofile-args --coverage -ftest-coverage
I'm able to generate a the code coverage report using x86 linux g++ compiler by installing
- sudo apt-get install gcovr
- g++ main.cpp -o main --coverage
Is there any source code or git repository from which I can generate the libgcov.so file for the ARM poky toolchain? Or Is there any solution to get the coverage of a program from ARM poky toolchain?
I have tried cloning and compiling the below repository as a library but the issue is not resolved.
How to generate the code coverage report file for a program written using ARM toolchain(poky 1.6) on Ubuntu 18.04?
Build the application using yocto build system
bitbake
Copy the libgcov.so generated from /tmp/deploy/ into /opt/poky/1.6.1/sysroots/i686-pokysdk-linux/usr/lib/
Trigger the build using g++