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

Why does building pc-ble-driver heart_rate_collector example fail?

I am trying to use the pc-ble-driver and as a first step want to use the heart_rate_collector example.  I downloaded the source as follows:

git clone https://github.com/NordicSemiconductor/pc-ble-driver.git pc-ble-driver.git

cd pc-gle-driver.git

git checkout v4.1.2

I then followed the instructions from https://github.com/NordicSemiconductor/pc-ble-driver/tree/v4.1.2#compiling-pc-ble-driver-from-source to try to build a Makefile for the example/heart_rate_collector sample.

My environment is 64-bit Windows 10 with VisualStudio Build tools 2019.  I used a "x64 Native Tools Command Prompt for VS 2019 to run the commands.  I ran into some errors and issues along the way and had to make some changes to handle them.  These are the commands I used:

git clone https://github.com/Microsoft/vcpkg.git

cd vcpkg

git checkout tags/2020.04

.\bootstrap-vcpkg.bat

C:\Projects\BLEapp\pc-ble-driver.git\build>echo %VCPKG_ROOT%
C:\Projects\BLEapp\pc-ble-driver.git\vcpkg

C:\Projects\BLEapp\pc-ble-driver.git\build>where gcc
C:\TDM-GCC-64\bin\gcc.exe

C:\Projects\BLEapp\pc-ble-driver.git\build>gcc --version
gcc (tdm64-1) 9.2.0


C:\Projects\BLEapp\pc-ble-driver.git

mkdir build
cd build
vcpkg install asio --triplet x64-windows
vcpkg install catch2 --triplet x64-windows
vcpkg install spdlog --triplet x64-windows

cmake -G Ninja ..

cmake --build .

The last line failed with:

[11/262] Building CXX object CMakeFiles/nrf_ble_driver_obj_sd_api_v2.dir/src/common/platform/win/enumser.cpp.obj
FAILED: CMakeFiles/nrf_ble_driver_obj_sd_api_v2.dir/src/common/platform/win/enumser.cpp.obj
C:\TDM-GCC-64\bin\c++.exe  -DASIO_STANDALONE -DHCI_LINK_CONTROL -DNRF_SD_BLE_API_VERSION=2 -DSD_RPC_EXPORTS -D_CRT_SECURE_NO_WARNINGS -isystem ../src/sd_api_common/sdk/components/libraries/util -isystem ../src/sd_api_v2/sdk/components/serialization/application/codecs/common -isystem ../src/sd_api_v2/sdk/components/serialization/application/codecs/s130/serializers -isystem ../src/sd_api_v2/sdk/components/serialization/common -isystem ../src/sd_api_v2/sdk/components/serialization/common/struct_ser/s130 -isystem ../include/common -isystem ../include/common/internal -isystem ../include/common/internal/transport -isystem ../vcpkg/installed/x64-windows/include -isystem ../include/common/config -isystem ../include/common/sdk_compat -isystem ../include/sd_api_v2 -Wall -Wno-unknown-pragmas -Wno-undef -Wno-long-long -Wfloat-equal -Wpointer-arith -Wlogical-op -std=c++14 -std=gnu++14 -MD -MT CMakeFiles/nrf_ble_driver_obj_sd_api_v2.dir/src/common/platform/win/enumser.cpp.obj -MF CMakeFiles\nrf_ble_driver_obj_sd_api_v2.dir\src\common\platform\win\enumser.cpp.obj.d -o CMakeFiles/nrf_ble_driver_obj_sd_api_v2.dir/src/common/platform/win/enumser.cpp.obj -c ../src/common/platform/win/enumser.cpp

There were many, many more lines of diagnostics created.  I can add them if necessary but the end result is the same; I cannot get the driver to build the Makefile I need to use the examples.

This could be caused by using gcc 9.2.0, or maybe VS 2019, or maybe 64-bit, or maybe something else.  

Any suggestions on how to get the Makefile for example/heart_rate_collector to be generated?

  • I realized after posting that the error information isn't in the original post.  Here it almost was.  Seems the insert code cannot handle that much (1000+ lines).  Here is the output up to the first error:

    In file included from ../src/common/platform/win/stdafx.h:74,
                     from ../src/common/platform/win/enumser.cpp:59:
    ../src/common/platform/win/stdstring.h: In function 'WCHAR* StdCodeCvt(PWSTR, int, PCSTR, int, const std::locale&)':
    ../src/common/platform/win/stdstring.h:896:22: warning: unused variable 'res' [-Wunused-variable]
      896 |    SSCodeCvt::result res = conv.in(st,
          |                      ^~~
    ../src/common/platform/win/stdstring.h: In function 'CHAR* StdCodeCvt(PSTR, int, PCWSTR, int, const std::locale&)':
    ../src/common/platform/win/stdstring.h:934:22: warning: unused variable 'res' [-Wunused-variable]
      934 |    SSCodeCvt::result res = conv.out(st,
          |                      ^~~
    ../src/common/platform/win/stdstring.h: In function 'void ssasn(std::string&, const wstring&)':
    ../src/common/platform/win/stdstring.h:1358:3: warning: statement has no effect [-Wunused-value]
     1358 |   szCvt;
          |   ^~~~~
    ../src/common/platform/win/stdstring.h: In function 'void ssasn(std::string&, PCWSTR)':
    ../src/common/platform/win/stdstring.h:1388:3: warning: statement has no effect [-Wunused-value]
     1388 |   szCvt;
          |   ^~~~~
    In file included from ../src/common/platform/win/stdafx.h:74,
                     from ../src/common/platform/win/enumser.cpp:59:
    ../src/common/platform/win/stdstring.h: In function 'void ssasn(std::string&, int)':
    ../src/common/platform/win/stdstring.h:1398:9: warning: statement has no effect [-Wunused-value]
     1398 |  UNUSED(nNull);
          |         ^~~~~
    ../src/common/platform/win/stdstring.h:686:21: note: in definition of macro 'UNUSED'
      686 |   #define UNUSED(x) x
          |                     ^
    ../src/common/platform/win/stdstring.h: In function 'void ssasn(std::wstring&, int)':
    ../src/common/platform/win/stdstring.h:1475:9: warning: statement has no effect [-Wunused-value]
     1475 |  UNUSED(nNull);
          |         ^~~~~
    ../src/common/platform/win/stdstring.h:686:21: note: in definition of macro 'UNUSED'
      686 |   #define UNUSED(x) x
          |                     ^
    In file included from ../src/common/platform/win/stdafx.h:74,
                     from ../src/common/platform/win/enumser.cpp:59:
    ../src/common/platform/win/stdstring.h: In function 'void ssadd(std::string&, const wstring&)':
    ../src/common/platform/win/stdstring.h:1508:3: warning: statement has no effect [-Wunused-value]
     1508 |   szCvt;
          |   ^~~~~
    ../src/common/platform/win/stdstring.h: In function 'void ssadd(std::string&, PCWSTR)':
    ../src/common/platform/win/stdstring.h:1536:3: warning: statement has no effect [-Wunused-value]
     1536 |   szCvt;
          |   ^~~~~
    ../src/common/platform/win/stdstring.h: In function 'void ssadd(std::wstring&, const string&)':
    ../src/common/platform/win/stdstring.h:1581:3: warning: statement has no effect [-Wunused-value]
     1581 |   szCvt;
          |   ^~~~~
    ../src/common/platform/win/stdstring.h: In function 'void ssadd(std::wstring&, PCSTR)':
    ../src/common/platform/win/stdstring.h:1601:3: warning: statement has no effect [-Wunused-value]
     1601 |   szCvt;
          |   ^~~~~
    ../src/common/platform/win/stdstring.h: At global scope:
    ../src/common/platform/win/stdstring.h:3335:44: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
     3335 |  void FormatMessage(PCMYSTR szFormat, ...) throw(std::exception)
          |                                            ^~~~~
    ../src/common/platform/win/stdstring.h:3352:42: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
     3352 |  void FormatMessage(UINT nFormatId, ...) throw(std::exception)
          |                                          ^~~~~
    ../src/common/platform/win/stdstring.h: In member function 'void CStdStr<CT>::FormatV(const CT*, va_list)':
    ../src/common/platform/win/stdstring.h:3218:3: error: 'size_type' was not declared in this scope; did you mean 'size_t'?
     3218 |   size_type nActual = 0;
          |   ^~~~~~~~~
          |   size_t
    ../src/common/platform/win/stdstring.h:3231:4: error: 'nActual' was not declared in this scope
     3231 |    nActual   = nUsed == -1 ? nChars-1 : SSMIN(nUsed, nChars-1);
          |    ^~~~~~~
    ../src/common/platform/win/stdstring.h:3239:22: error: 'nActual' was not declared in this scope
     3239 |   this->assign(pBuf, nActual);
          |                      ^~~~~~~

  • Hi, and sorry for the late answer, but because of summer vacations we are a bit short on staff at the moment.

    I am unable to reproduce your errors.

    Could you pipe the output from both the configuration and build step, and send the files to me?

    cmake -G Ninja .. > cmake.txt
    cmake --build . > build.txt

    Best regards,

    Didrik

  • Hi ,  

    I am facing a similar problem.

    Could you pipe the output from both the configuration and build step, and send the files to me?

    I am attaching the files that you have asked for, Can you please look into it and help me?

    Thanks,

    Vraj Joshi

    8345.build.txt

    -- NRF_BLE_DRIVER_VERSION not specified, setting it to 0.0.0
    -- Architecture not set, using native 64-bit toolchain.
    -- Building with build type: Debug.
    -- Compiled tests are installed in directory "bin"
    -- Compiled examples are installed in directory "bin"
    -- 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: E:/pc-ble-driver/build
    

  • Hi ,

    I recommend you open a new ticket, rather than commenting on one that is 1,5 years old.

    In the new ticket, please include the steps you took when building the pc-ble-driver, and the errors you get.

    It could also be helpful if you include which versions of the toolchains you are using.

    Best regards,

    Didrik

Related