Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build with gcov is broken #497

Closed
marthtz opened this issue Jan 15, 2021 · 4 comments · Fixed by #499
Closed

Build with gcov is broken #497

marthtz opened this issue Jan 15, 2021 · 4 comments · Fixed by #499
Labels
bug Something isn't working

Comments

@marthtz
Copy link
Contributor

marthtz commented Jan 15, 2021

Required information

Operating system:
Ubuntu 20.04 LTS

Compiler version:
GCC 7.5.0

Observed result or behaviour:
Build with coverage enabled fails.

Expected result or behaviour:
Build works with coverage.

Conditions where it occurred / Performed steps:
Build broke when PR #487 was merged.
Build command: ./tools/iceoryx_build_test.sh build-strict clean debug test -c all
Error:

/usr/bin/ld: CMakeFiles/test_stress_sofi.dir/stresstests/test_stress_sofi.cpp.o: in function `_GLOBAL__sub_I_00100_0__ZN51SoFiStress_SimultaneouslyPushAndPopOnEmptySoFi_Test10test_info_E':
/home/htm2abt/repo/ice_github/iceoryx_utils/test/stresstests/test_stress_sofi.cpp:552: undefined reference to `__gcov_init'
/usr/bin/ld: CMakeFiles/test_stress_sofi.dir/stresstests/test_stress_sofi.cpp.o: in function `_GLOBAL__sub_D_00100_1__ZN51SoFiStress_SimultaneouslyPushAndPopOnEmptySoFi_Test10test_info_E':
/home/htm2abt/repo/ice_github/iceoryx_utils/test/stresstests/test_stress_sofi.cpp:552: undefined reference to `__gcov_exit'
/usr/bin/ld: CMakeFiles/test_stress_sofi.dir/stresstests/test_stress_sofi.cpp.o:(.data.rel+0x20): undefined reference to `__gcov_merge_add'
collect2: error: ld returned 1 exit status

@marthtz marthtz added the bug Something isn't working label Jan 15, 2021
@elBoberido
Copy link
Member

That's weird. I had a look at the CMakeLists.txt and the target for that stress test has the same compiler and linker flags like the other tests ... okay, I ran the command locally and the other tests also have the same linker issues.
The mentioned PR should not cause this effect. Maybe it was the previous one and that one just made it visible?

@dkroenke
Copy link
Member

@elBoberido no, the flag build-static for linking gcov with static libs of iceoryx is missing. Then it will work fine.
Iceoryx is build per default as shared lib. But for tools like gcov or the adress-sanitizer we need to build static-libs.

The documentation needs to be adapted to make that more clear.

@marthtz
Copy link
Contributor Author

marthtz commented Jan 15, 2021

Ok, I figured it's not a bug in the code but more of missing documentation thing.
As iceoryx is dynamically linked by default this is not compatible with gcov. Hence, the build arg build-static to allow static build that works with gcov.

Beside updating the documentation, wouldn't it be good to automatically enable build-static when --coverage is used or at least check for it?

@marthtz
Copy link
Contributor Author

marthtz commented Jan 15, 2021

@dkroenke should I re-label it to documentation?

dkroenke added a commit to ApexAI/iceoryx that referenced this issue Jan 15, 2021
Signed-off-by: Dietrich Krönke <dietrich.kroenke@apex.ai>
dkroenke added a commit to ApexAI/iceoryx that referenced this issue Jan 15, 2021
Signed-off-by: Dietrich Krönke <dietrich.kroenke@apex.ai>
dkroenke added a commit that referenced this issue Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants