[CMake] Problem using VS-compiled Clang as a C/C++ compiler.

Anton Yartsev anton.yartsev at gmail.com
Fri Mar 4 07:24:15 EST 2016


> Hi,
>
> On 4 March 2016 at 11:16, Anton Yartsev <anton.yartsev at gmail.com> wrote:
>> Hi Cristian,
>>
>> thanks for the replay. I have clang-cl first in PATH, the problem persists.
> Just to check. Did you run cmake in a new (i.e. empty) build directory
> when you fixed that? IIRC once a compiler has been picked
> during configure you can't change it so if you need to change it you
> have to build in a new build directory or delete everything in
> the current build directory.
>
> Shouldn't the following work (assuming clang-cl.exe is in your path)
>
> CXX=clang-cl.exe CC=clang-cl.exe cmake -G "Ninja" ..
>
> ?
Hi Dan,

I haven't fixed that, clang/clang-cl was initially first in PATH. I 
deleted CMakeFiles dir and CMakeCache.txt before each try.
Just tried to build from the scratch in the new empty directory - the 
problem persists.

Here are the results from 'CXX=clang-cl.exe CC=clang-cl.exe cmake -G 
"Ninja" ..' :

$ set CXX=clang-cl
$ set CC=clang-cl
$ cmake -G "Ninja" ..

-- No build type selected, default to Debug
-- The C compiler identification is Clang 3.7.1
-- The CXX compiler identification is Clang 3.7.1
-- Check for working C compiler using: Ninja
-- Check for working C compiler using: Ninja -- broken
CMake Error at C:/Program 
Files/CMake/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61 (message):
   The C compiler "D:/-Work-/llvm-3.7.1.src/-VS_build VS
   2013-/Release/bin/clang-cl.exe" is not able to compile a simple test
   program.

   It fails with the following output:

    Change Dir: D:/-Work-/llvm-3.7.1.src/-CLANG-/CMakeFiles/CMakeTmp

   Run Build Command:"C:/PROGRA~1/ninja/ninja.exe" "cmTC_75d21"

   [1/2] Building C object CMakeFiles\cmTC_75d21.dir\testCCompiler.c.obj

   [2/2] Linking C executable cmTC_75d21.exe

   FAILED: cmd.exe /C "cd .  && "C:\Program Files\CMake\bin\cmake.exe" -E
   vs_link_exe --intdir=CMakeFiles\cmTC_75d21.dir --manifests --
   CMAKE_LINKER-NOTFOUND /nologo 
CMakeFiles\cmTC_75d21.dir\testCCompiler.c.obj
   /out:cmTC_75d21.exe /implib:cmTC_75d21.lib /pdb:cmTC_75d21.pdb 
/version:0.0
   /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib 
user32.lib
   gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
   comdlg32.lib advapi32.lib && cd ."

   RC Pass 1 failed to run.

   ninja: build stopped: subcommand failed.

   CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
   CMakeLists.txt:29 (project)

-- Configuring incomplete, errors occurred!
See also "D:/-Work-/llvm-3.7.1.src/-CLANG-/CMakeFiles/CMakeOutput.log".
See also "D:/-Work-/llvm-3.7.1.src/-CLANG-/CMakeFiles/CMakeError.log".

-- 
Anton



More information about the CMake mailing list