<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">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color: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>