Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 09 Oct 2014 04:35:49 +0200
From:      Jan Beich <jbeich@vfemail.net>
To:        "Jeremy C. Reed" <reed@reedmedia.net>
Cc:        freebsd-toolchain@freebsd.org
Subject:   Re: using code coverage with clang
Message-ID:  <a956-c6m2-wny@vfemail.net>
References:  <alpine.NEB.2.02.1410060852390.27307@t1.m.reedmedia.net>

next in thread | previous in thread | raw e-mail | index | archive | help
(redirected from -questions@ to -toolchain@)

"Jeremy C. Reed" <reed@reedmedia.net> writes:

> 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.

With recent Clang the error may error slightly different:

  $ clang35 foo.c -fprofile-arcs -ftest-coverage
  /usr/local/bin/ld: cannot find /usr/local/llvm35/bin/../lib/clang/3.5.0/lib/freebsd/libclang_rt.profile-amd64.a: No such file or directory
  clang: error: linker command failed with exit code 1 (use -v to see invocation)

Try installing one of lang/gcc* and adding --rtlib=libgcc to link flags.
--rtlib=compiler-rt requires more recent compiler-rt version than the
one shipped with FreeBSD base. There's an upstream bug but the patches
there have bitrotten to being mostly useless (predate --rtlib support).

http://llvm.org/bugs/show_bug.cgi?id=6122

Anyway, freebsd-toolchain@ folk probably know more about the state of
Clang coverage/profiling on FreeBSD such as:

- devel/compiler-rt being more ancient than version in base on 10.0R
- lang/clang* trying to use libgcc_p instead of libs from lang/gcc*
- coverage/profiling not agreeing on whether to use libgcc/compiler-rt

https://lists.freebsd.org/pipermail/freebsd-toolchain/2013-September/001030.html

>
> 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.)
>

Try either converting USE_GCC=yes ports to USES=compiler:gcc-c++11-lib
or adding -nostdinc++ -isystem/usr/include/c++/v1 to CXXFLAGS and
creating /usr/lib/libstdc++.so -> libc++.so symlink.

> Does anyone have suggestions for doing code coverage with clang?

Maybe pmcannotate(8) or dtrace(1) as compiler-agnostic alternatives.

>
> 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.)

-------------------------------------------------

VFEmail.net - http://www.vfemail.net
ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a956-c6m2-wny>