This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to configure toolchains to generate build files for unit tests?

Hi There,

I am trying to generate build files for unit tests according to nRF5 SDK for Mesh v5.0.0. It could succeed. I try everything, it still cannot work. (In windows 10)

1. Enter "cmake -G Ninja -DBUILD_HOST=ON -DCMAKE_BUILD_TYPE=Debug .."

 CMake Error at C:/Program Files/CMake/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler

"C:/MinGW/bin/gcc.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: C:/BLE/Mesh/sdk/blecom/nrf5_SDK_for_Mesh_v5.0.0_src/build_host/CMakeFiles/CMakeTmp

Run Build Command(s):C:/ProgramData/chocolatey/bin/ninja.exe cmTC_e3c7c && [1/2] Building C object CMakeFiles\cmTC_e3c7c.dir\testCCompiler.c.obj
FAILED: CMakeFiles/cmTC_e3c7c.dir/testCCompiler.c.obj
C:\MinGW\bin\gcc.exe --std=gnu99 -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin --short-enums -m32 -Wall -Wextra -Werror=implicit-function-declaration -Wno-format -Wno-unused-parameter -Wno-missing-field-initializers -Wno-expansion-to-defined -mno-ms-bitfields -o CMakeFiles\cmTC_e3c7c.dir\testCCompiler.c.obj -c C:\BLE\Mesh\sdk\blecom\nrf5_SDK_for_Mesh_v5.0.0_src\build_host\CMakeFiles\CMakeTmp\testCCompiler.c
ninja: build stopped: subcommand failed.

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

************************************************************************************************************

2. Enter "cmake -G Ninja -DCMOKE_ROOT=C: ..\..\CMock\ -DBUILD_HOST=ON -DCMAKE_BUILD_TYPE=Debug .."

CMake Error at C:/Program Files/CMake/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler

"C:/MinGW/bin/gcc.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: C:/BLE/Mesh/sdk/blecom/nrf5_SDK_for_Mesh_v5.0.0_src/build_host/CMakeFiles/CMakeTmp

Run Build Command(s):C:/ProgramData/chocolatey/bin/ninja.exe cmTC_0baa4 && [1/2] Building C object CMakeFiles\cmTC_0baa4.dir\testCCompiler.c.obj
FAILED: CMakeFiles/cmTC_0baa4.dir/testCCompiler.c.obj
C:\MinGW\bin\gcc.exe --std=gnu99 -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin --short-enums -m32 -Wall -Wextra -Werror=implicit-function-declaration -Wno-format -Wno-unused-parameter -Wno-missing-field-initializers -Wno-expansion-to-defined -mno-ms-bitfields -o CMakeFiles\cmTC_0baa4.dir\testCCompiler.c.obj -c C:\BLE\Mesh\sdk\blecom\nrf5_SDK_for_Mesh_v5.0.0_src\build_host\CMakeFiles\CMakeTmp\testCCompiler.c
ninja: build stopped: subcommand failed.

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

Parents
  • Hi,

    I assume that you have successfully installed the dependencies listed under Optional: Additional tools for building unit tests (host), and that you are following the instructions under Generating build files for unit tests (host).

    I do not get similar errors when trying this in my end, so it is probably because of a difference between our systems.

    From what terminal are you issuing the build command? (cmd.exe? git bash? WSL shell?)
    From what path are you issuing the build command?
    Is what you printed the full printout, or were there more printed to the console?
    What is your version of MinGW?
    Did you "git checkout 7cc41dd" from the CMock directory, in order to use the same version of CMock as in the tool listing?

    Regards,
    Terje

  • Hi,

    I have tried all terminals. The tree is in the nrf_mesh_SDK, it is in the same directory level as the build folder. 

    I have checked out the git branch. And the mingw-get version is 0.6.2. It still cannot work. I am confused. The build folder is work.

    Regards,

    Gaosheng 

  • Hi,

    I assumed that you solved it by building from the build folder, since you wrote "the build folder is work." Can you confirm this, so that the case can be closed, or have you still not been able to build?

    Regards,
    Terje

  • Hi,

    Sorry for that. "the build folder is work" which means I can build the project in the build folder.

    I still cannot do the unit tests.

    Regards,

    Gaosheng Liu

Reply Children
Related