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

Linker error in Debug mode, apprently due to "--coverage" #184

Open
oschonrock opened this issue Sep 14, 2021 · 2 comments
Open

Linker error in Debug mode, apprently due to "--coverage" #184

oschonrock opened this issue Sep 14, 2021 · 2 comments

Comments

@oschonrock
Copy link

oschonrock commented Sep 14, 2021

This is the linker error... googling suggests, it is to do with --coverage

/usr/bin/ld: lib/libcsv.a(basic_csv_parser.cpp.o): in function `__llvm_gcov_writeout':
basic_csv_parser.cpp:(.text+0x7324): undefined reference to `llvm_gcda_start_file'
/usr/bin/ld: basic_csv_parser.cpp:(.text+0x7349): undefined reference to `llvm_gcda_emit_function'
/usr/bin/ld: basic_csv_parser.cpp:(.text+0x735c): undefined reference to `llvm_gcda_emit_arcs'
/usr/bin/ld: basic_csv_parser.cpp:(.text+0x736b): undefined reference to `llvm_gcda_summary_info'
/usr/bin/ld: basic_csv_parser.cpp:(.text+0x7370): undefined reference to `llvm_gcda_end_file'
/usr/bin/ld: lib/libcsv.a(basic_csv_parser.cpp.o): in function `__llvm_gcov_init':

.... (many more similar lines)

commenting out this line in csv-parser/CMakeLists.txt

  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} --coverage -Og")

works around the problem

this is with clang-12 on ubuntu 20.04 and both ld and lld

@T-Maxxx
Copy link

T-Maxxx commented Sep 27, 2021

I met same problem.
There is no problem with single include header file. But when I try to switch to a static library + common header file same error occured in my libraries. The reason I want to do it because single header brings some warnings I have to shut down (my project errors are treated as errors).
Same OS, clang-12 (compiled by myself with compiler-rt), linker is lld.
Please, disable code coverage flag by default just like you did with CSV_DEVELOPER. Thank you.

@ionovanton
Copy link

Adding link_libraries(gcov) to CMakeLists.txt apparently fixes the issue.

mckravchyk added a commit to mckravchyk/csv-parser that referenced this issue Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants