<div dir="ltr">I'm building LLVM with the trunk as of this writing Clang.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 4, 2020 at 2:13 PM Itaru Kitayama <<a href="mailto:itaru.kitayama@gmail.com">itaru.kitayama@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Mehdi,</div><div><br></div><div>On the supercomputer at Kyushu University, I see:</div><div>$ cat test.c</div>int main() {<br><div>}</div><div>$ clang -v test.c<br></div>clang version 11.0.0 (/home/usr4/c74014i/projects/llvm-project/clang 63e65082219983f1dba4faf273bad311715da14e)<br>Target: x86_64-unknown-linux-gnu<br>Thread model: posix<br>InstalledDir: /home/usr4/c74014i/opt/clang/current/bin<br>Found CUDA installation: /usr/local/cuda, version 8.0<br> (in-process)<br> "/home/usr4/c74014i/opt/clang/202002040908/bin/clang-11" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name test.c -mrelocation-model static -mthread-model posix -mframe-pointer=all -fmath-errno -fno-rounding-math -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -fno-split-dwarf-inlining -debugger-tuning=gdb -v -resource-dir /home/usr4/c74014i/opt/clang/202002040908/lib/clang/11.0.0 -internal-isystem /usr/local/include -internal-isystem /home/usr4/c74014i/opt/clang/202002040908/lib/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /home/usr4/c74014i -ferror-limit 19 -fmessage-length 0 -fgnuc-version=4.2.1 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -faddrsig -o /tmp/test-f00510.o -x c test.c<br>clang -cc1 version 11.0.0 based upon LLVM 11.0.0git default target x86_64-unknown-linux-gnu<br>ignoring nonexistent directory "/include"<br>#include "..." search starts here:<br>#include <...> search starts here:<br> /usr/local/include<br> /home/usr4/c74014i/opt/clang/202002040908/lib/clang/11.0.0/include<br> /usr/include<br>End of search list.<br> "/usr/bin/ld" --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /lib/../lib64/crt1.o /lib/../lib64/crti.o crtbegin.o -L/lib/../lib64 -L/usr/lib/../lib64 -L/home/usr4/c74014i/opt/clang/202002040908/bin/../lib -L/lib -L/usr/lib -L/home/usr4/c74014i/opt/clang/current/lib -L. /tmp/test-f00510.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed crtend.o /lib/../lib64/crtn.o<br>/usr/bin/ld: cannot find crtbegin.o: No such file or directory<br>/usr/bin/ld: cannot find -lgcc<br>/usr/bin/ld: cannot find -lgcc_s<br>clang-11: error: linker command failed with exit code 1 (use -v to see invocation)<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 4, 2020 at 2:07 PM Mehdi AMINI <<a href="mailto:joker.eph@gmail.com" target="_blank">joker.eph@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 3, 2020 at 4:33 PM Itaru Kitayama via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Trunk clang does not pass CMake C Compiler test like below:<div><br></div><div>CMake Error at /home/usr4/c74014i/opt/cmake-3.16.3-Linux-x86_64/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):<br>  The C compiler<br><br>    "/home/usr4/c74014i/opt/clang/current/bin/clang"<br><br>  is not able to compile a simple test program.<br><br>  It fails with the following output:<br><br>    Change Dir: /home/usr4/c74014i/work/build/202002040929/CMakeFiles/CMakeTmp<br><br>    Run Build Command(s):/home/usr4/c74014i/opt/ninja/bin/ninja cmTC_35cb3 && [1/2] Building C object CMakeFiles/cmTC_35cb3.dir/testCCompiler.c.o<br>    [2/2] Linking C executable cmTC_35cb3<br>    FAILED: cmTC_35cb3<br>    : && /home/usr4/c74014i/opt/clang/current/bin/clang    CMakeFiles/cmTC_35cb3.dir/testCCompiler.c.o  -o cmTC_35cb3   && :<br>    /usr/bin/ld: cannot find crtbegin.o: No such file or directory<br>    /usr/bin/ld: cannot find -lgcc<br>    /usr/bin/ld: cannot find -lgcc_s<br>    clang-11: error: linker command failed with exit code 1 (use -v to see invocation)<br>    ninja: build stopped: subcommand failed.<br><br><br><br><br><br>  CMake will not be able to correctly generate this project.<br>Call Stack (most recent call first):<br>  CMakeLists.txt:49 (project)<br></div><div><br></div><div>My configuration is shown below:</div><div>cmake -G Ninja -DBUILD_SHARED_LIBS=ON -DLLVM_PARALLEL_LINK_JOBS=2 -DLLVM_ENABLE_LLD=ON -DLLVM_ENABLE_LIBCXX=OFF -DCMAKE_BUILD_TYPE=Release -DGCC_INSTALL_PREFIX=/pathto/gcc-7.5.0/ -DLIBOMPTARGET_ENABLE_DEBUG=ON -DCMAKE_INSTALL_PREFIX=$HOME/opt/clang/${today} -DCMAKE_C_COMPILER=clang -DCMAKE_C_FLAGS="" -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS="" -DLLVM_ENABLE_PROJECTS="clang;openmp;lld;libcxx;libcxxabi" -DCLANG_OPENMP_NVPTX_DEFAULT_ARCH=sm_60 -DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES=60 -DLLVM_TARGETS_TO_BUILD=all $HOME/projects/llvm-project/llvm<br></div></div></blockquote><div><br></div><div>Before running cmake, are you able to compile a trivial C program by invoking `clang test.c` ?  (create test.c with an empty main function first).</div><div><br></div><div>If not then your clang install is just not working and I'd start by looking into this. Running `clang -v test.c` will display a bunch of information about what toolchain your clang driver found and what is it passing to the linker invocation.</div><div><br></div><div>-- </div><div>Mehdi</div><div><br></div></div></div></div>
</blockquote></div>
</blockquote></div>