[llvm-bugs] [Bug 36053] New: clang cannot find cross-compiled compiler-rt files (e.g. address sanitizer).

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jan 23 01:02:33 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=36053

            Bug ID: 36053
           Summary: clang cannot find cross-compiled compiler-rt files
                    (e.g. address sanitizer).
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: pawel_sikora at zoho.com
                CC: llvm-bugs at lists.llvm.org

hi,

i have a clang-6.0 (from svn branch) installed in
$HOME/src/toolchain/llvm/sysroot and cross-compiled
libc++abi/libc++/compiler-rt libs installed in separated directories
$HOME/src/toolchain/sysroot-${TARGET_ARCH}

basic c/c++ cross-compiling works fine, clang finds all required target libs
(crt*.o, glibc, libc++/abi) but cannot find address sanitizer libs.

afaics the internal clang option '-resource-dir' points to llvm/clang
installation dir instead of specified --sysroot arg. looks like a driver bug.


% ~/src/toolchain/llvm/sysroot/bin/clang++ -Wall -fuse-ld=lld -ggdb -gdwarf-4
-fno-omit-frame-pointer -fno-optimize-sibling-calls -Og -stdlib=libc++
hello-world.cpp -o hello-world.cpp-lnx64 -fsanitize=address -target
x86_64-linux-gnu --sysroot ~/src/toolchain/sysroot-x86_64-linux-gnu -v


clang version 6.0.0 (branches/release_60 323121)
Target: x86_64--linux-gnu
Thread model: posix
InstalledDir: /home/builder/src/toolchain/llvm/sysroot/bin
 "/home/builder/src/toolchain/llvm/sysroot/bin/clang-6.0" -cc1 -triple
x86_64--linux-gnu -emit-obj -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name hello-world.cpp -mrelocation-model static
-mthread-model posix -mdisable-fp-elim -mdisable-tail-calls -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -dwarf-column-info -debug-info-kind=limited -dwarf-version=4
-debugger-tuning=gdb -momit-leaf-frame-pointer -v -resource-dir
/home/builder/src/toolchain/llvm/sysroot/lib/clang/6.0.0 -isysroot
/home/builder/src/toolchain/sysroot-x86_64-linux-gnu -internal-isystem
/home/builder/src/toolchain/sysroot-x86_64-linux-gnu/usr/include/c++/v1
-internal-isystem
/home/builder/src/toolchain/sysroot-x86_64-linux-gnu/usr/local/include
-internal-isystem
/home/builder/src/toolchain/llvm/sysroot/lib/clang/6.0.0/include
-internal-externc-isystem
/home/builder/src/toolchain/sysroot-x86_64-linux-gnu/include
-internal-externc-isystem
/home/builder/src/toolchain/sysroot-x86_64-linux-gnu/usr/include -Og -Wall
-fdeprecated-macro -fdebug-compilation-dir /home/builder/src/toolchain
-ferror-limit 19 -fmessage-length 211 -fsanitize=address
-fsanitize-address-use-after-scope -fno-assume-sane-operator-new
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o
/tmp/hello-world-4cb3ac.o -x c++ hello-world.cpp
clang -cc1 version 6.0.0 based upon LLVM 6.0.0 default target
x86_64-unknown-linux-gnu
ignoring nonexistent directory
"/home/builder/src/toolchain/sysroot-x86_64-linux-gnu/usr/local/include"
ignoring duplicate directory
"/home/builder/src/toolchain/sysroot-x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/builder/src/toolchain/sysroot-x86_64-linux-gnu/usr/include/c++/v1
 /home/builder/src/toolchain/llvm/sysroot/lib/clang/6.0.0/include
 /home/builder/src/toolchain/sysroot-x86_64-linux-gnu/include
End of search list.
 "/home/builder/src/toolchain/llvm/sysroot/bin/ld.lld"
--sysroot=/home/builder/src/toolchain/sysroot-x86_64-linux-gnu --hash-style=gnu
--eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o
hello-world.cpp-lnx64
/home/builder/src/toolchain/sysroot-x86_64-linux-gnu/lib/crt1.o
/home/builder/src/toolchain/sysroot-x86_64-linux-gnu/lib/crti.o
/home/builder/src/toolchain/sysroot-x86_64-linux-gnu/lib/crtbegin.o
-L/home/builder/src/toolchain/sysroot-x86_64-linux-gnu/lib
-L/home/builder/src/toolchain/sysroot-x86_64-linux-gnu/usr/lib -whole-archive
/home/builder/src/toolchain/llvm/sysroot/lib/clang/6.0.0/lib/linux/libclang_rt.asan-x86_64.a
-no-whole-archive -whole-archive
/home/builder/src/toolchain/llvm/sysroot/lib/clang/6.0.0/lib/linux/libclang_rt.asan_cxx-x86_64.a
-no-whole-archive -export-dynamic /tmp/hello-world-4cb3ac.o -lc++ -lm
--no-as-needed -lpthread -lrt -lm -ldl -lgcc_s -lgcc -lc -lgcc_s -lgcc
/home/builder/src/toolchain/sysroot-x86_64-linux-gnu/lib/crtend.o
/home/builder/src/toolchain/sysroot-x86_64-linux-gnu/lib/crtn.o
/home/builder/src/toolchain/llvm/sysroot/bin/ld.lld: error: cannot open
/home/builder/src/toolchain/llvm/sysroot/lib/clang/6.0.0/lib/linux/libclang_rt.asan-x86_64.a:
No such file or directory
/home/builder/src/toolchain/llvm/sysroot/bin/ld.lld: error: cannot open
/home/builder/src/toolchain/llvm/sysroot/lib/clang/6.0.0/lib/linux/libclang_rt.asan_cxx-x86_64.a:
No such file or directory
clang-6.0: error: linker command failed with exit code 1 (use -v to see
invocation)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180123/d8ff48c7/attachment.html>


More information about the llvm-bugs mailing list