When running `configure`, using `--with-devkit=` to point to a typical linux devkit along with `--with-toolchain-path=` and `--with-toolchain-type=clang` to point to a clang-based toolchain results in:
configure:75064: checking whether the C compiler works configure:75086: /dl/tools/clang -m64 -isysroot /dl/x86_64-linux-gnu-to-x86_64-linux-gnu/x86_64-linux-gnu/sysroot -isysroot /dl/x86_64-linux-gnu-to-x86_64-linux-gnu/x86_64-linux-gnu/sysroot -m64 -isysroot /dl/x86_64-linux-gnu-to-x86_64-linux-gnu/x86_64-linux-gnu/sysroot conftest.c >&5 d.lld: error: cannot open crt1.o: No such file or directory ld.lld: error: cannot open crti.o: No such file or directory ld.lld: error: cannot open crtbegin.o: No such file or directory ld.lld: error: unable to find library -lgcc ld.lld: error: unable to find library -lgcc_s ld.lld: error: unable to find library -lc ld.lld: error: unable to find library -lgcc ld.lld: error: unable to find library -lgcc_s ld.lld: error: cannot open crtend.o: No such file or directory ld.lld: error: cannot open crtn.o: No such file or directory clang-12: error: linker command failed with exit code 1 (use -v to see invocation) ``` This is because clang is unable to locate the gcc installation from the devkit. The gcc toolchain is not in the location clang expects in the sysroot (that's not how our devkits are structured). Note that it might go unnoticed on machines that have gcc installed because clang will fallback to system-global locations. We can help clang by letting it now about the gcc location in the devkit with `--gcc-toolchain=`. However that's not enough and we then get: ld.lld: error: cannot open crt1.o: No such file or directory ld.lld: error: cannot open crti.o: No such file or directory ld.lld: error: unable to find library -lc ld.lld: error: cannot open crtn.o: No such file or directory clang was able to locate the gcc support libraries but is not able to locate required system libraries. That's because `-isysroot` is not intended for libraries (only headers) but also because `-isysroot` has no effect for clang on linux (see [llvm#11503](https://bugs.llvm.org/show_bug.cgi?id=11503)). Using `--sysroot=` in this case (clang on linux) resolves this issue. ------------- Commit messages: - 8278954: Using clang together with devkit on linux doesn't work for building Changes: https://git.openjdk.java.net/jdk/pull/6880/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6880&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8278954 Stats: 15 lines in 1 file changed: 13 ins; 0 del; 2 mod Patch: https://git.openjdk.java.net/jdk/pull/6880.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/6880/head:pull/6880 PR: https://git.openjdk.java.net/jdk/pull/6880