0

I have some trouble to compile an Ada project with gcov.

There are my options :

gprbuild -P project.gpr -XOS=Linus -j2 -s -k -p -cargs --coverage -largs --coverage

Compilation is ok (I see --coverage when the adb are compiled) but the linking is ko :

hidden symbol '-gcov_init' in [...]/libgcov.a(_gcov.o) is referenced by DSO

I'm new to ada, I don't know what information you need to help me, ask me for more.

Thank you.

EDIT:

On my .gpr I have some linked library (I paste here one example) :

package Compiler is 
    for Default_Switches ("C") use Rules.Compiler'Default_Switches ("C") &
    (
        "I" & external ("VOB_HOME") & "[path_to_folder]"
    )
end Compiler

package Linker is 
    for Default_Switches ("Ada") use Rules.Compiler'Default_Switches ("Ada") &
    (
        "L" & external ("VOB_HOME") & "[path_to_folder]" & Path_Lib
    )
end Linker

I think that theses libraries are not compiled with gcov, but I don't know how rebuild theses.

A.Pissicat
  • 3,023
  • 4
  • 38
  • 93
  • Which version of Gnat are you using and on which OS (even though I suspect a Linux ;) )? – Frédéric Praca May 02 '19 at 12:18
  • Moreover is _[...]/libgcov.a(_gcov.o)_ inside the same hierarchy as your compiler ? If not, it may mean that you're mixing two toolchains. – Frédéric Praca May 02 '19 at 13:10
  • This command works fine for me with a trivial project – Maxim Reznik May 02 '19 at 13:17
  • same here on Windows but I'm pretty sure this is the same with my Linux machine @ home – Frédéric Praca May 02 '19 at 13:24
  • Consider [this question](https://stackoverflow.com/questions/16122599/gcc-ld-error-libgcov-a-gcov-merge-add-o-is-referenced-by-dso?rq=1), maybe? – Simon Wright May 02 '19 at 16:16
  • @FrédéricPraca I'm working with gnat 7.3.1. I've try with a basic projet and it his working, but this project have many linked project/libraries and I don't really know witch one (I'm very new to this project). What do I have to look for ? – A.Pissicat May 03 '19 at 06:25
  • Are the linked project/libraries already compiled with profiling ? If so, the _libgcov_ version used by theses ones may be different from the one delivered with Gnat. Ideally, you should recompile also these ones with the same toolchain. But first, test the solution provided by @SimonWright – Frédéric Praca May 03 '19 at 08:14
  • @FrédéricPraca I have tried the Simon's solution but it didn't work for me. I think the problem comes from the linked library, I'll try to rebuild but I don't know if I can rebuild them by myself. – A.Pissicat May 03 '19 at 09:35

0 Answers0