
Vor dem Upgrade von Ubuntu 14.04 auf Ubuntu 16.04 konnte ich den folgenden Code mit mingw-64-gcc kompilieren
x86_64-w64-mingw32-gcc -fprofile-generate -o test.exe test.c -lgcov -static
//test.c
#include <stdio.h>
int main(void)
{puts("test");return 0;}
Jetzt kann das Programm aufgrund fehlender __gcov-Symbole nicht verknüpft werden.
x86_64-w64-mingw32-gcc -fprofile-generate -o test test.c
/tmp/cccj8pnx.o:test.c:(.text+0x1a): undefined reference to `__gcov_indirect_call_profiler_v2'
/tmp/cccj8pnx.o:test.c:(.text+0x46): undefined reference to `__gcov_time_profiler'
/tmp/cccj8pnx.o:test.c:(.data+0xa0): undefined reference to `__gcov_merge_time_profile'
/tmp/cccj8pnx.o:test.c:(.rdata$.refptr.__gcov_indirect_call_callee[.refptr.__gcov_indirect_call_callee]+0x0): undefined reference to `__gcov_indirect_call_callee'
collect2: error: ld returned 1 exit status
Was hat sich zwischen den beiden Ubuntu-Versionen geändert? Für jede Hilfe wäre ich dankbar.
Antwort1
Ich bin auf dasselbe Problem gestoßen und konnte es umgehen, indem ich auf -fprofile-arcs
statt verlinkt habe -lgcov
.