clang doesn't find the appropriate libclang_rt.profile when compiling with profiling enabled. Step to reproduce: 1) Create a simple C program, e.g. prova.c, then compile it with profiling enabled: clang -o prova -fprofile-generate prova.c it would result in an invalid path for the library libclang_rt.profile-x86_64.a: /bin/ld: cannot find /usr/bin/../lib64/clang/3.8.1/lib/linux/libclang_rt.profile-x86_64.a: No such file or directory clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation) The library exists, but it's located in /usr/lib64/clang/3.8.1/lib/libclang_rt.profile-x86_64.a rather than /usr/lib64/clang/3.8.1/lib/linux/libclang_rt.profile-x86_64.a; the attached patch fix the problem.
Created attachment 8480 [details] patch to fix path for library libclang_rt.profile-x86_64.a
Assignee: bugsquad => basesystem
CC: (none) => basesystemAssignee: basesystem => thierry.vignaud
We follow FC. Does it work with FC24?
Keywords: (none) => NEEDINFO
I've not tried with FC24, but if you try with a simple C file, even this #include <stdio.h> int main() {printf("hello\n");} it would give the error above, while applying the patch included here would work. Regards FC24, I've not tried there, but I doubt it works there too if they don't changed the path (unless they installed directly in /usr/lib or /usr/lib64), as to use lib/linux/* is hardcoded in the compiler-rt sources.
Could you give it a try on FC24 Neal?
CC: (none) => ngompa13
On Fedora 24, I've tested with the following packages installed: clang-3.8.0-2.fc24 compiler-rt-3.8.0-2.fc24 (Note that compiler-rt had to be installed separately) The test case mentioned (using the sample code) works. [~]$ clang test-hello-clang.c -o test-hello-clang -fprofile-generate The program runs too. [~]$ ./test-hello-clang hello If I don't have compiler-rt installed, I get the error mentioned earlier.
Oh, and for verification purposes, this is what Fedora's compiler-rt has: [~]$ rpm -qil compiler-rt Name : compiler-rt Version : 3.8.0 Release : 2.fc24 Architecture: x86_64 Install Date: Mon 03 Oct 2016 05:36:43 PM EDT Group : Unspecified Size : 12704494 License : NCSA or MIT Signature : RSA/SHA256, Wed 04 May 2016 08:06:44 AM EDT, Key ID 73bde98381b46521 Source RPM : compiler-rt-3.8.0-2.fc24.src.rpm Build Date : Tue 03 May 2016 04:10:33 PM EDT Build Host : buildhw-10.phx2.fedoraproject.org Relocations : (not relocatable) Packager : Fedora Project Vendor : Fedora Project URL : http://llvm.org Summary : LLVM "compiler-rt" runtime libraries Description : The compiler-rt project is a part of the LLVM project. It provides implementation of the low-level target-specific hooks required by code generation, sanitizer runtimes and profiling library for code instrumentation, and Blocks C language extension. /usr/include/sanitizer /usr/include/sanitizer/allocator_interface.h /usr/include/sanitizer/asan_interface.h /usr/include/sanitizer/common_interface_defs.h /usr/include/sanitizer/coverage_interface.h /usr/include/sanitizer/dfsan_interface.h /usr/include/sanitizer/linux_syscall_hooks.h /usr/include/sanitizer/lsan_interface.h /usr/include/sanitizer/msan_interface.h /usr/include/sanitizer/tsan_interface_atomic.h /usr/lib64/clang/3.8.0 /usr/lib64/clang/3.8.0/asan_blacklist.txt /usr/lib64/clang/3.8.0/cfi_blacklist.txt /usr/lib64/clang/3.8.0/dfsan_abilist.txt /usr/lib64/clang/3.8.0/lib /usr/lib64/clang/3.8.0/lib/libclang_rt.asan-preinit-x86_64.a /usr/lib64/clang/3.8.0/lib/libclang_rt.asan-x86_64.a /usr/lib64/clang/3.8.0/lib/libclang_rt.asan-x86_64.a.syms /usr/lib64/clang/3.8.0/lib/libclang_rt.asan-x86_64.so /usr/lib64/clang/3.8.0/lib/libclang_rt.asan_cxx-x86_64.a /usr/lib64/clang/3.8.0/lib/libclang_rt.asan_cxx-x86_64.a.syms /usr/lib64/clang/3.8.0/lib/libclang_rt.builtins-x86_64.a /usr/lib64/clang/3.8.0/lib/libclang_rt.cfi-x86_64.a /usr/lib64/clang/3.8.0/lib/libclang_rt.cfi_diag-x86_64.a /usr/lib64/clang/3.8.0/lib/libclang_rt.dd-x86_64.a /usr/lib64/clang/3.8.0/lib/libclang_rt.dfsan-x86_64.a /usr/lib64/clang/3.8.0/lib/libclang_rt.dfsan-x86_64.a.syms /usr/lib64/clang/3.8.0/lib/libclang_rt.dyndd-x86_64.so /usr/lib64/clang/3.8.0/lib/libclang_rt.lsan-x86_64.a /usr/lib64/clang/3.8.0/lib/libclang_rt.msan-x86_64.a /usr/lib64/clang/3.8.0/lib/libclang_rt.msan-x86_64.a.syms /usr/lib64/clang/3.8.0/lib/libclang_rt.msan_cxx-x86_64.a /usr/lib64/clang/3.8.0/lib/libclang_rt.msan_cxx-x86_64.a.syms /usr/lib64/clang/3.8.0/lib/libclang_rt.profile-x86_64.a /usr/lib64/clang/3.8.0/lib/libclang_rt.safestack-x86_64.a /usr/lib64/clang/3.8.0/lib/libclang_rt.tsan-x86_64.a /usr/lib64/clang/3.8.0/lib/libclang_rt.tsan-x86_64.a.syms /usr/lib64/clang/3.8.0/lib/libclang_rt.tsan_cxx-x86_64.a /usr/lib64/clang/3.8.0/lib/libclang_rt.tsan_cxx-x86_64.a.syms /usr/lib64/clang/3.8.0/lib/libclang_rt.ubsan_standalone-x86_64.a /usr/lib64/clang/3.8.0/lib/libclang_rt.ubsan_standalone-x86_64.a.syms /usr/lib64/clang/3.8.0/lib/libclang_rt.ubsan_standalone_cxx-x86_64.a /usr/lib64/clang/3.8.0/lib/libclang_rt.ubsan_standalone_cxx-x86_64.a.syms /usr/lib64/clang/3.8.0/lib/linux /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.asan-preinit-x86_64.a /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.asan-x86_64.a /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.asan-x86_64.a.syms /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.asan-x86_64.so /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.asan_cxx-x86_64.a /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.asan_cxx-x86_64.a.syms /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.builtins-x86_64.a /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.cfi-x86_64.a /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.cfi_diag-x86_64.a /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.dd-x86_64.a /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.dfsan-x86_64.a /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.dfsan-x86_64.a.syms /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.dyndd-x86_64.so /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.lsan-x86_64.a /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.msan-x86_64.a /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.msan-x86_64.a.syms /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.msan_cxx-x86_64.a /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.msan_cxx-x86_64.a.syms /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.profile-x86_64.a /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.safestack-x86_64.a /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.tsan-x86_64.a /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.tsan-x86_64.a.syms /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.tsan_cxx-x86_64.a /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.tsan_cxx-x86_64.a.syms /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.ubsan_standalone-x86_64.a /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.ubsan_standalone-x86_64.a.syms /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.ubsan_standalone_cxx-x86_64.a /usr/lib64/clang/3.8.0/lib/linux/libclang_rt.ubsan_standalone_cxx-x86_64.a.syms /usr/lib64/clang/3.8.0/msan_blacklist.txt
in fact FC24 installs the libraries into lib/linux, as with the suggested patch.
or to be precise they install in both /usr/lib64/clang/3.8.0/lib/ and /usr/lib64/clang/3.8.0/lib/linux/ (a soft link?).
Here's the Fedora spec for compiler-rt: http://pkgs.fedoraproject.org/cgit/rpms/compiler-rt.git/tree/compiler-rt.spec It looks like they do some stuff to make that work...
yep, seems FC24 is using a soft link to place the libraries in both places (so at least once would hit). I thought to the double softlinking solution, but then looking at the code I realized that one place (the one with lib/linux) is enough, as the other won't never be reached anyway.
Please try compiler-rt-3.8.1-2.mga6
Yes, compiler-rt-3.8.1-2.mga6 works.
Closing then
Status: NEW => RESOLVEDResolution: (none) => FIXED