This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Trying to build pc-ble-driver for a nRF52840 dongle project

I'm trying to build the pc-ble-driver (https://github.com/NordicSemiconductor/pc-ble-driver) to be able to use the nRF52840 as a receiver for a thermometer.  See https://devzone.nordicsemi.com/f/nordic-q-a/65516/using-nrf52840-dongle-as-receiver-client-for-onset-thermometer for details.

I have followed the instructions I think, but got an error at building the pc-ble-driver:  See output below.  I was on step 2 of the section "Compiling pc-ble-driver from source". To handle the part about "CMake Select the Visual Studio compiler to use according to this article: Build C/C++ code on the command line" I opened a Developer Command Prompt for VS2019 which was one of the suggestions.  I am on a Windows 10 machine running Visual Studio 2019.

Can somebody tell me what I'm doing wrong?

Thanks,

Andrew

Console Output

C:\Nordic\pc-ble-driver>cd build

C:\Nordic\pc-ble-driver\build>cmake -G Ninja ..
-- NRF_BLE_DRIVER_VERSION not specified, setting it to 0.0.0
-- Architecture not set, using native 64-bit toolchain.
CMake Error at test/CMakeLists.txt:11 (find_package):
Could not find a package configuration file provided by "spdlog" with any
of the following names:

spdlogConfig.cmake
spdlog-config.cmake

Add the installation prefix of "spdlog" to CMAKE_PREFIX_PATH or set
"spdlog_DIR" to a directory containing one of the above files. If "spdlog"
provides a separate development package or SDK, be sure it has been
installed.


-- Configuring incomplete, errors occurred!
See also "C:/Nordic/pc-ble-driver/build/CMakeFiles/CMakeOutput.log".
See also "C:/Nordic/pc-ble-driver/build/CMakeFiles/CMakeError.log".

C:\Nordic\pc-ble-driver\build>

Parents
  • Hi,

    Fist, make sure you use a tagged release and not master. Currently, the latest release is 4.1.2, here: https://github.com/NordicSemiconductor/pc-ble-driver/tree/v4.1.2

    Before following the build instructions, did you follow the Installing dependencies on Windows instructions, and/or how does your setup differ from the described setup?

    What is the contents of the following log files, as mentioned in the console output that you provided?

    See also "C:/Nordic/pc-ble-driver/build/CMakeFiles/CMakeOutput.log".
    See also "C:/Nordic/pc-ble-driver/build/CMakeFiles/CMakeError.log".

    Please note that pc-ble-driver is not a driver that lets you use an nRF device with the Windows BLE API. Rather, it is serialization of our BLE stack. That means in order to communicate with other devices you need to implement an application (using pc-ble-driver), using the same BLE API as when developing for an nRF device. If that is not what you are looking for, you can have a look at White Paper 29: Zephyr Bluetooth Low Energy Controller. It describes how you can use our DKs or Dongles as a standard HCI Controller.

    Regards,
    Terje

  • File contents below.    I do believe I'm on Master so will try again with 4.1.2 when at work.

    Yes, I believe I followed all other directions.

    I believe I am trying to do exactly as you suggest.  I want to use the Nordic dongle (with your drivers and stack/host layer) to communicate with an Onset Intemp thermometer.   See https://devzone.nordicsemi.com/f/nordic-q-a/65516/using-nrf52840-dongle-as-receiver-client-for-onset-thermometer for details.

    I currently have things working using the Windows drivers and BLE host layer but I'm seeing problems after many hours of use.  It was suggested in the above mentioned post that skipping all the Windows BLE layer and using the Nordic dongle would be a good idea.  However, that's only if I can get it working!  Once I have everything built, I still need to communicate with your C++ layers from C#.  I'm surprised there are no examples of this or ideas on getting started given how popular C# is.

    Thanks,

    Andrew

    Contents of CMakeError.log

    Determining if the include file pthread.h exists failed with the following output:
    Change Dir: C:/Nordic/pc-ble-driver/build/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/PROGRA~2/MICROS~2/2019/PROFES~1/Common7/IDE/COMMON~1/MICROS~1/CMake/Ninja/ninja.exe cmTC_76034 && [1/2] Building C object CMakeFiles\cmTC_76034.dir\CheckIncludeFile.c.obj
    FAILED: CMakeFiles/cmTC_76034.dir/CheckIncludeFile.c.obj
    C:\PROGRA~2\MICROS~2\2019\PROFES~1\VC\Tools\MSVC\1427~1.291\bin\Hostx64\x64\cl.exe /nologo /DWIN32 /D_WINDOWS /W3 /MDd /Zi /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\cmTC_76034.dir\CheckIncludeFile.c.obj /FdCMakeFiles\cmTC_76034.dir\ /FS -c CheckIncludeFile.c
    CheckIncludeFile.c(1): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory
    ninja: build stopped: subcommand failed.

    Contents of CMakeOutput.log

    The system is: Windows - 10.0.18363 - AMD64
    Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
    Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe
    Build flags:
    Id flags:

    The output was:
    0
    Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29111 for x64
    Copyright (C) Microsoft Corporation. All rights reserved.

    CMakeCCompilerId.c
    Microsoft (R) Incremental Linker Version 14.27.29111.0
    Copyright (C) Microsoft Corporation. All rights reserved.

    /out:CMakeCCompilerId.exe
    CMakeCCompilerId.obj


    Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CMakeCCompilerId.exe"

    Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CMakeCCompilerId.obj"

    The C compiler identification is MSVC, found in "C:/Nordic/pc-ble-driver/build/CMakeFiles/3.18.2/CompilerIdC/CMakeCCompilerId.exe"

    Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
    Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe
    Build flags:
    Id flags:

    The output was:
    0
    Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29111 for x64
    Copyright (C) Microsoft Corporation. All rights reserved.

    CMakeCXXCompilerId.cpp
    Microsoft (R) Incremental Linker Version 14.27.29111.0
    Copyright (C) Microsoft Corporation. All rights reserved.

    /out:CMakeCXXCompilerId.exe
    CMakeCXXCompilerId.obj


    Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.exe"

    Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.obj"

    The CXX compiler identification is MSVC, found in "C:/Nordic/pc-ble-driver/build/CMakeFiles/3.18.2/CompilerIdCXX/CMakeCXXCompilerId.exe"

    Detecting C compiler ABI info compiled with the following output:
    Change Dir: C:/Nordic/pc-ble-driver/build/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/PROGRA~2/MICROS~2/2019/PROFES~1/Common7/IDE/COMMON~1/MICROS~1/CMake/Ninja/ninja.exe cmTC_ee0f5 && [1/2] Building C object CMakeFiles\cmTC_ee0f5.dir\CMakeCCompilerABI.c.obj
    [2/2] Linking C executable cmTC_ee0f5.exe

    Detecting CXX compiler ABI info compiled with the following output:
    Change Dir: C:/Nordic/pc-ble-driver/build/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/PROGRA~2/MICROS~2/2019/PROFES~1/Common7/IDE/COMMON~1/MICROS~1/CMake/Ninja/ninja.exe cmTC_48d2c && [1/2] Building CXX object CMakeFiles\cmTC_48d2c.dir\CMakeCXXCompilerABI.cpp.obj
    [2/2] Linking CXX executable cmTC_48d2c.exe

    Determining if the include file sys/types.h exists passed with the following output:
    Change Dir: C:/Nordic/pc-ble-driver/build/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/PROGRA~2/MICROS~2/2019/PROFES~1/Common7/IDE/COMMON~1/MICROS~1/CMake/Ninja/ninja.exe cmTC_4a588 && [1/2] Building C object CMakeFiles\cmTC_4a588.dir\CheckIncludeFile.c.obj
    [2/2] Linking C executable cmTC_4a588.exe

    Determining if the include file stdint.h exists passed with the following output:
    Change Dir: C:/Nordic/pc-ble-driver/build/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/PROGRA~2/MICROS~2/2019/PROFES~1/Common7/IDE/COMMON~1/MICROS~1/CMake/Ninja/ninja.exe cmTC_611fe && [1/2] Building C object CMakeFiles\cmTC_611fe.dir\CheckIncludeFile.c.obj
    [2/2] Linking C executable cmTC_611fe.exe

    Determining if the include file stddef.h exists passed with the following output:
    Change Dir: C:/Nordic/pc-ble-driver/build/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/PROGRA~2/MICROS~2/2019/PROFES~1/Common7/IDE/COMMON~1/MICROS~1/CMake/Ninja/ninja.exe cmTC_f9655 && [1/2] Building C object CMakeFiles\cmTC_f9655.dir\CheckIncludeFile.c.obj
    [2/2] Linking C executable cmTC_f9655.exe

    Determining size of unsigned short passed with the following output:
    Change Dir: C:/Nordic/pc-ble-driver/build/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/PROGRA~2/MICROS~2/2019/PROFES~1/Common7/IDE/COMMON~1/MICROS~1/CMake/Ninja/ninja.exe cmTC_e0790 && [1/2] Building C object CMakeFiles\cmTC_e0790.dir\CMAKE_SIZEOF_UNSIGNED_SHORT.c.obj
    [2/2] Linking C executable cmTC_e0790.exe

    Determining if the system is big endian passed with the following output:
    Change Dir: C:/Nordic/pc-ble-driver/build/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/PROGRA~2/MICROS~2/2019/PROFES~1/Common7/IDE/COMMON~1/MICROS~1/CMake/Ninja/ninja.exe cmTC_0b8c5 && [1/2] Building C object CMakeFiles\cmTC_0b8c5.dir\TestEndianess.c.obj
    [2/2] Linking C executable cmTC_0b8c5.exe


    TestEndianess.c:
    /* A 16 bit integer is required. */
    typedef unsigned short cmakeint16;

    /* On a little endian machine, these 16bit ints will give "THIS IS LITTLE ENDIAN."
    On a big endian machine the characters will be exchanged pairwise. */
    const cmakeint16 info_little[] = {0x4854, 0x5349, 0x4920, 0x2053, 0x494c, 0x5454, 0x454c, 0x4520, 0x444e, 0x4149, 0x2e4e, 0x0000};

    /* on a big endian machine, these 16bit ints will give "THIS IS BIG ENDIAN."
    On a little endian machine the characters will be exchanged pairwise. */
    const cmakeint16 info_big[] = {0x5448, 0x4953, 0x2049, 0x5320, 0x4249, 0x4720, 0x454e, 0x4449, 0x414e, 0x2e2e, 0x0000};

    #ifdef __CLASSIC_C__
    int main(argc, argv) int argc; char *argv[];
    #else
    int main(int argc, char *argv[])
    #endif
    {
    int require = 0;
    require += info_little[argc];
    require += info_big[argc];
    (void)argv;
    return require;
    }

  • Hi,

    It does look like something is wrong with the vcpkg dependencies. What is the output from running the following commands (from a command line):

    vcpkg install asio
    vcpkg install catch2
    vcpkg install --head spdlog

    Regards,
    Terje

  • Terje,

    I ran your commands. Please see output below.  Note that when I originally did this, I followed the directions and typed:

    vcpkg install asio catch2 spdlog

    I'm not sure if this made any difference or caused problems.
    Regards,
    Andrew

    C:\Nordic\pc-ble-driver\build>vcpkg install asio
    Computing installation plan...
    The following packages are already installed:
    asio[core]:x86-windows
    Package asio:x86-windows is already installed

    Total elapsed time: 1.737 ms

    The package asio:x86-windows provides CMake targets:

    find_package(asio CONFIG REQUIRED)
    target_link_libraries(main PRIVATE asio asio::asio)

    C:\Nordic\pc-ble-driver\build>vcpkg install catch2
    Computing installation plan...
    The following packages are already installed:
    catch2[core]:x86-windows
    Package catch2:x86-windows is already installed

    Total elapsed time: 3.383 ms

    The package catch2:x86-windows provides CMake targets:

    find_package(Catch2 CONFIG REQUIRED)
    target_link_libraries(main PRIVATE Catch2::Catch2)

    C:\Nordic\pc-ble-driver\build>vcpkg install --head spdlog
    Computing installation plan...
    The following packages are already installed:
    spdlog[core]:x86-windows
    Package spdlog:x86-windows is already installed

    Total elapsed time: 3.657 ms

    The package spdlog:x86-windows provides CMake targets:

    find_package(spdlog CONFIG REQUIRED)
    target_link_libraries(main PRIVATE spdlog::spdlog spdlog::spdlog_header_only)


    C:\Nordic\pc-ble-driver\build>

Reply
  • Terje,

    I ran your commands. Please see output below.  Note that when I originally did this, I followed the directions and typed:

    vcpkg install asio catch2 spdlog

    I'm not sure if this made any difference or caused problems.
    Regards,
    Andrew

    C:\Nordic\pc-ble-driver\build>vcpkg install asio
    Computing installation plan...
    The following packages are already installed:
    asio[core]:x86-windows
    Package asio:x86-windows is already installed

    Total elapsed time: 1.737 ms

    The package asio:x86-windows provides CMake targets:

    find_package(asio CONFIG REQUIRED)
    target_link_libraries(main PRIVATE asio asio::asio)

    C:\Nordic\pc-ble-driver\build>vcpkg install catch2
    Computing installation plan...
    The following packages are already installed:
    catch2[core]:x86-windows
    Package catch2:x86-windows is already installed

    Total elapsed time: 3.383 ms

    The package catch2:x86-windows provides CMake targets:

    find_package(Catch2 CONFIG REQUIRED)
    target_link_libraries(main PRIVATE Catch2::Catch2)

    C:\Nordic\pc-ble-driver\build>vcpkg install --head spdlog
    Computing installation plan...
    The following packages are already installed:
    spdlog[core]:x86-windows
    Package spdlog:x86-windows is already installed

    Total elapsed time: 3.657 ms

    The package spdlog:x86-windows provides CMake targets:

    find_package(spdlog CONFIG REQUIRED)
    target_link_libraries(main PRIVATE spdlog::spdlog spdlog::spdlog_header_only)


    C:\Nordic\pc-ble-driver\build>

Children
  • I get the same output as Andrew from running....

    ">cmake -G Ninja .."

    and

    "vcpkg install asio catch2 spdlog"

    What's different from Installing dependencies on Windows, is that I had to download vcpkg to a different directory, otherwise the following would occur from running boostrap in C:\Windows\System32\vcpkg>

    C:\Windows\System32\vcpkg>.\bootstrap-vcpkg.bat

    Building vcpkg.exe ...

    MSBUILD : error MSB1009: Project file does not exist.
    Switch: C:\Windows\System32\vcpkg\toolsrc\dirs.proj
    C:\Windows\System32\vcpkg\scripts\bootstrap.ps1 : Building vcpkg.exe failed. Please ensure you have installed Visual
    Studio with the Desktop C++ workload and the Windows SDK for Desktop C++.
    At line:1 char:4
    + & {& 'C:\Windows\System32\vcpkg\scripts\bootstrap.ps1' }
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,bootstrap.ps1

    Next step.. Then add the vcpkg location to the PATH and VCPKG_ROOT environment variable.

    And from there I added C:\Users\michael.larson\vcpkg to the user environment variable Path (NOT system variable!).  These are the only things that are different in my setup. Otherwise, again the output for

    ">cmake -G Ninja .."

    and

    "vcpkg install asio catch2 spdlog"

    are the same as Andre.. Any help would be appreciated!! 

     

Related