windowsbashcmakewindows-10subsystem

Missing C & C++ compilers in Windows Subsystem for Linux


I'm trying to compile LLVM using the Windows Subsystem for Linux (Windows 10 build 10.0.14342), but I keep getting cmake errors about how I'm missing C & C++ compilers. This is despite having gcc, g++, and build-essentials by using apt-get from within bash. My command is as follows:

cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86" ../llvm-3.8

I get a bunch of errors from CMake

CMake Error: Parse error in cache file /home/andrew-wsl/llvm/build/CMakeCache.txt. 
Offending entry: Debug Info builds.
CMake Error: Parse error in cache file /home/andrew-wsl/llvm/build/CMakeCache.txt. 
Offending entry: CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED
-- The C compiler identification is unknown
CMake Error at /usr/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake:186 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:54 (project)


-- The CXX compiler identification is unknown
CMake Error at /usr/share/cmake-2.8/Modules/CMakeDetermineCXXCompiler.cmake:185 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:54 (project)


-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:47 (try_compile):
  Unknown extension ".c" for file

    /home/andrew-wsl/llvm/build/CMakeFiles/CMakeTmp/testCCompiler.c

  try_compile() works only for enabled languages.  Currently these are:

    ASM C CXX

  See project() command to enable other languages.
Call Stack (most recent call first):
  CMakeLists.txt:54 (project)


-- Check for working C compiler: /usr/bin/cc -- broken
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "/usr/bin/cc" is not able to compile a simple test program.

  It fails with the following output:





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


-- Configuring incomplete, errors occurred!
See also "/home/andrew-wsl/llvm/build/CMakeFiles/CMakeOutput.log".
See also "/home/andrew-wsl/llvm/build/CMakeFiles/CMakeError.log".
andrew-wsl@COMPUTER:~/llvm/build$

CMakeError.log can be found here: http://pastebin.com/7rWYFGu5

CMakeOutput.log can be found here: http://pastebin.com/2BaEFTvR

I'm not sure what's going on as I was able to compile a helloworld program with gcc and g++ successfully.


Solution

  • Turns out this is a known bug: https://github.com/Microsoft/BashOnWindows/issues/272

    Long story short, it's fixed as of build 14352.