bilke / cmake-modules

Additional CMake functionality. Most of the modules are from Ryan Pavlik (https://github.com/rpavlik/cmake-modules)
Boost Software License 1.0
547 stars 214 forks source link

CodeCoverage with Xcode (Clang): Undefined symbols for architecture x86_64 #84

Open carlocorradini opened 10 months ago

carlocorradini commented 10 months ago

During the linking phase of my GitHub action, I encounter the following errors while using Xcode 14.2 (Clang) (not on Linux/Ubuntu):

[100%] Linking CXX executable [NAME]
Undefined symbols for architecture x86_[64]
  "_llvm_gcda_emit_arcs", referenced from:
      ___llvm_gcov_writeout in [FILE.o]
      ...
  "_llvm_gcda_emit_function", referenced from:
      ___llvm_gcov_writeout in test.[FILE.o]
      ...
  "_llvm_gcda_end_file", referenced from:
      ___llvm_gcov_writeout in in test.[FILE.o]
      ...
  "_llvm_gcda_start_file", referenced from:
      ___llvm_gcov_writeout in in test.[FILE.o]
      ...
  "_llvm_gcda_summary_info", referenced from:
      ___llvm_gcov_writeout in in test.[FILE.o]
      ...
  "_llvm_gcov_init", referenced from:
      ___llvm_gcov_init in in test.[FILE.o]
      ...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It looks like that something is missing during the linking phase (maybe a flag ?). Any thoughts? Thanks 🥳

KrukDallan commented 10 months ago

Same issue here😥

How can I solve this in my CI?