<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - clang cannot find cross-compiled compiler-rt files (e.g. address sanitizer)."
   href="https://bugs.llvm.org/show_bug.cgi?id=36053">36053</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang cannot find cross-compiled compiler-rt files (e.g. address sanitizer).
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>6.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Driver
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>pawel_sikora@zoho.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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)</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>