using code coverage with clang

Eduardo Morras emorrasg at yahoo.es
Mon Oct 6 16:32:50 UTC 2014


On Mon, 6 Oct 2014 09:09:27 -0500 (CDT)
"Jeremy C. Reed" <reed at reedmedia.net> wrote:

> For a few years I have been building different code with
> -fprofile-arcs -ftest-coverage with gcc on different BSDs and
> different Linuxes. I would build with that, run various tests, and
> then use gcov or lcov to see the code that was ran.
> 
> When I changed from FreeBSD 9.x to 10.0-RELEASE-p1, I went from gcc
> to clang.  But this causes
> /usr/bin/ld: /usr/bin/../lib/libprofile_rt.a: No such file: No such
> file or directory
> 
> I don't have that library. Any suggestions on how to get it so I
> don't have to maintain later during upgrades.  I don't think the
> clang ports have it either.
> 
> I'd prefer to not maintain all my dependencies (ports) using gcc. 
> (Currently I cannot use gcc with the clang-built ports as some
> libraries appear to be built differently so references aren't seen
> the same.)
> 
> Does anyone have suggestions for doing code coverage with clang?

I use the static analyzer (in the Computer Science meaning of the term) from clang. F.ex.:

scan-build34 -o /home/gowen/projects/gummy_project/Analyze make -j 2 -e -f Makefile

Runs the clang34 static analyzer and outputs a html report. Perhaps it can help you.

> Or are there binary packages available for 10.0 on amd64 built with
> gcc?
> 
> (I found a forum discussion about it at
> https://forums.freebsd.org/viewtopic.php?f=35&t=47260 and several
> other reports about it.)

---   ---
Eduardo Morras <emorrasg at yahoo.es>


More information about the freebsd-questions mailing list