Can't build pc-ble-driver on Windows 10

I following description of https://github.com/NordicSemiconductor/pc-ble-driver#Compiling-pc-ble-driver-from-source to build pc-ble-driver

pc-ble-driver\build> cmake -G Ninja ..
-- NRF_BLE_DRIVER_VERSION not specified, setting it to 0.0.0
CMake Warning at D:/vcpkg/scripts/buildsystems/vcpkg.cmake:116 (message):
  Unable to determine target architecture, continuing without vcpkg.
Call Stack (most recent call first):
  build/CMakeFiles/3.14.0/CMakeSystem.cmake:6 (include)
  CMakeLists.txt:25 (project)


-- The C compiler identification is Clang 13.0.0
CMake Error at D:/vcpkg/downloads/tools/cmake-3.14.0-windows/cmake-3.14.0-win32-x86/share/cmake-3.14/Modules/CMakeDetermineCompilerId.cmake:859 (message):
  The Clang compiler tool

    "C:/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/clang.exe"

  targets the MSVC ABI but has a GNU-like command-line interface.  This is
  not supported.  Use 'clang-cl' instead, e.g.  by setting 'CC=clang-cl' in
  the environment.  Furthermore, use the MSVC command-line environment.
Call Stack (most recent call first):
  D:/vcpkg/downloads/tools/cmake-3.14.0-windows/cmake-3.14.0-win32-x86/share/cmake-3.14/Modules/CMakeDetermineCCompiler.cmake:114 (CMAKE_DIAGNOSE_UNSUPPORTED_CLANG)
  CMakeLists.txt:25 (project)


CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "D:/pc-ble-driver/build/CMakeFiles/CMakeOutput.log".

  • log

    The system is: Windows - 10.0.19044 - AMD64
    Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
    Compiler: C:/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/clang.exe 
    Build flags: 
    Id flags:  
    
    The output was:
    0
    
    
    Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.exe"
    
    The C compiler identification is Clang, found in "D:/Andy/workspace_C_Win10/pc-ble-driver/build/CMakeFiles/3.14.0/CompilerIdC/a.exe"
    
    

  • Hi,

    I'm checking with the team to see what can be wrong here. 

    Have you followed the instruction pointed in the documentation: https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170&viewFallbackFrom=vs-2015

    Could you try to follow the suggestion by Pierre here. It seems that they have similar issue to you. 


    One of my coworker also suggested that he only managed to build on his computer using the visual studio command prompt, could you give it a try ? 

  • Thanks for your suggestion! I can run "cmake -G Ninja .." command successfully.

    C:\Windows\system32>%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
    **********************************************************************
    ** Visual Studio 2019 Developer Command Prompt v16.11.16
    ** Copyright (c) 2021 Microsoft Corporation
    **********************************************************************
    [vcvarsall.bat] Environment initialized for: 'x64'

    C:\Windows\System32>d:



    D:\>cd pc-ble-driver

    D:\pc-ble-driver>cd build

    D:\pc-ble-driver\build>cmake -G Ninja ..
    CMake Warning (dev) at CMakeLists.txt:7:
      Syntax Warning in cmake code at column 40

      Argument not separated from preceding token by whitespace.
    This warning is for project developers.  Use -Wno-dev to suppress it.

    -- NRF_BLE_DRIVER_VERSION not specified, setting it to 0.0.0
    -- The C compiler identification is MSVC 19.28.29924.0
    -- The CXX compiler identification is MSVC 19.28.29924.0
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe
    -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Architecture not set, using native 64-bit toolchain.
    -- Found Git: D:/Program Files/Git/cmd/git.exe (found version "2.37.0.windows.1")
    -- Check if the system is big endian
    -- Searching 16 bit integer
    -- Looking for sys/types.h
    -- Looking for sys/types.h - found
    -- Looking for stdint.h
    -- Looking for stdint.h - found
    -- Looking for stddef.h
    -- Looking for stddef.h - found
    -- Check size of unsigned short
    -- Check size of unsigned short - done
    -- Using unsigned short
    -- Check if the system is big endian - little endian
    -- Looking for pthread.h
    -- Looking for pthread.h - not found
    -- Found Threads: TRUE
    -- Compiled tests are installed in directory "bin"
    -- Compiled examples are installed in directory "bin"
    -- Found Python: D:/Python/Python37/python.exe (found version "3.7.8") found components:  Interpreter
    -- Did not find clang-tidy, target tidy is disabled.
    -- If clang-tidy is installed, make sure run-clang-tidy.py and clang-tidy is in PATH
    -- Configuring done
    -- Generating done
    -- Build files have been written to: D:pc-ble-driver/build

  • But command "cmake --build ." is failed.

    c:
    cd C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build
    vcvars64.bat
    d:
    cd D:\pc-ble-driver\
    mkdir build
    cd build
    cmake -G Ninja ..
    cmake --build .

    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\yvals_core.h(575): fatal error C1189: #error:  STL1001: Unexpected compiler version, expected MSVC 19.29 or newer.

  • Hi,

    Have you tried to update MSVC to the expected version  ?

Related