[llvm-dev] CMakeTestCCompiler fails
Itaru Kitayama via llvm-dev
llvm-dev at lists.llvm.org
Mon Feb 3 21:15:37 PST 2020
I'm building LLVM with the trunk as of this writing Clang.
On Tue, Feb 4, 2020 at 2:13 PM Itaru Kitayama <itaru.kitayama at gmail.com>
wrote:
> Mehdi,
>
> On the supercomputer at Kyushu University, I see:
> $ cat test.c
> int main() {
> }
> $ clang -v test.c
> clang version 11.0.0 (/home/usr4/c74014i/projects/llvm-project/clang
> 63e65082219983f1dba4faf273bad311715da14e)
> Target: x86_64-unknown-linux-gnu
> Thread model: posix
> InstalledDir: /home/usr4/c74014i/opt/clang/current/bin
> Found CUDA installation: /usr/local/cuda, version 8.0
> (in-process)
> "/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
> clang -cc1 version 11.0.0 based upon LLVM 11.0.0git default target
> x86_64-unknown-linux-gnu
> ignoring nonexistent directory "/include"
> #include "..." search starts here:
> #include <...> search starts here:
> /usr/local/include
> /home/usr4/c74014i/opt/clang/202002040908/lib/clang/11.0.0/include
> /usr/include
> End of search list.
> "/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
> /usr/bin/ld: cannot find crtbegin.o: No such file or directory
> /usr/bin/ld: cannot find -lgcc
> /usr/bin/ld: cannot find -lgcc_s
> clang-11: error: linker command failed with exit code 1 (use -v to see
> invocation)
>
> On Tue, Feb 4, 2020 at 2:07 PM Mehdi AMINI <joker.eph at gmail.com> wrote:
>
>>
>> On Mon, Feb 3, 2020 at 4:33 PM Itaru Kitayama via llvm-dev <
>> llvm-dev at lists.llvm.org> wrote:
>>
>>> Trunk clang does not pass CMake C Compiler test like below:
>>>
>>> CMake Error at
>>> /home/usr4/c74014i/opt/cmake-3.16.3-Linux-x86_64/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60
>>> (message):
>>> The C compiler
>>>
>>> "/home/usr4/c74014i/opt/clang/current/bin/clang"
>>>
>>> is not able to compile a simple test program.
>>>
>>> It fails with the following output:
>>>
>>> Change Dir:
>>> /home/usr4/c74014i/work/build/202002040929/CMakeFiles/CMakeTmp
>>>
>>> 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
>>> [2/2] Linking C executable cmTC_35cb3
>>> FAILED: cmTC_35cb3
>>> : && /home/usr4/c74014i/opt/clang/current/bin/clang
>>> CMakeFiles/cmTC_35cb3.dir/testCCompiler.c.o -o cmTC_35cb3 && :
>>> /usr/bin/ld: cannot find crtbegin.o: No such file or directory
>>> /usr/bin/ld: cannot find -lgcc
>>> /usr/bin/ld: cannot find -lgcc_s
>>> clang-11: error: linker command failed with exit code 1 (use -v to
>>> see invocation)
>>> ninja: build stopped: subcommand failed.
>>>
>>>
>>>
>>>
>>>
>>> CMake will not be able to correctly generate this project.
>>> Call Stack (most recent call first):
>>> CMakeLists.txt:49 (project)
>>>
>>> My configuration is shown below:
>>> 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
>>>
>>
>> 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).
>>
>> 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.
>>
>> --
>> Mehdi
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200204/45f681c0/attachment-0001.html>
More information about the llvm-dev
mailing list