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

lwm2m_client sample fails with "Compiling the C compiler identification source file "CMakeCCompilerId.c" failed."

Hello, 

I am trying to build the lwm2m_client sample on my ubuntu 16.04 machine.  I tried building for nrf9160_pca10090ns and nrf9160_pca20035ns The build fails with:

ninja: build stopped: subcommand failed.
ERROR: command exited with status 1: /usr/local/bin/cmake --build /home/pascal/nrf/samples/nrf9160/lwm2m_client/build

When I look at the CMakeError.log file this is what it says:

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /opt/gnuarmemb/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gcc 
Build flags: 
Id flags:  

The output was:
1
/opt/gnuarmemb/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: /opt/gnuarmemb/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): in function `exit':
exit.c:(.text.exit+0x2c): undefined reference to `_exit'
collect2: error: ld returned 1 exit status


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /opt/gnuarmemb/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-g++ 
Build flags: 
Id flags:  

The output was:
1
/opt/gnuarmemb/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: /opt/gnuarmemb/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): in function `exit':
exit.c:(.text.exit+0x2c): undefined reference to `_exit'
collect2: error: ld returned 1 exit status

I should mention that I only run into this error with this one particular sample, I have successfully built applications with this compiler before.

I am not sure what this due to. I tried using a more recent compiler. I installed gcc-arm-none-eabi-9-2019-q4-major and edited my env variables accordingly but I get the same error with the new compiler as well.

Regards,

  • Hello Heidi,

    So I found the mcuboot folder in an older installation on my windows machine. I copied it to the ncs folder and ran west update. Now the sample builds fine for nrf9160_pca10090ns, but when I try to build it for nrf9160_20035ns (My actual target hardware). I get these errors:

    ../src/lwm2m/lwm2m_button.c: In function 'handle_button_events':
    ../src/lwm2m/lwm2m_button.c:32:23: error: operator '>' has no left operand
     #if CONFIG_FLIP_INPUT > 0
                           ^
    ../src/lwm2m/lwm2m_button.c: In function 'lwm2m_init_button':
    ../src/lwm2m/lwm2m_button.c:65:23: error: operator '!=' has no left operand
     #if CONFIG_FLIP_INPUT != UI_BUTTON_1
                           ^~
    ../src/lwm2m/lwm2m_button.c:76:23: error: operator '!=' has no left operand
     #if CONFIG_FLIP_INPUT != UI_BUTTON_2
                           ^~
    ../src/lwm2m/lwm2m_button.c:87:23: error: operator '!=' has no left operand
     #if CONFIG_FLIP_INPUT != UI_SWITCH_1
                           ^~
    ../src/lwm2m/lwm2m_button.c:98:23: error: operator '!=' has no left operand
     #if CONFIG_FLIP_INPUT != UI_SWITCH_2
                           ^~
    At top level:
    ../src/lwm2m/lwm2m_button.c:20:14: warning: 'timestamp' defined but not used [-Wunused-variable]
     static s32_t timestamp[4];
    

    Are there some configs I need to set or is this sample not compatible with that board. 

    Regards,

  • Hi, 

    Unfortunately, the LwM2M Client sample has not been written for the pca20035 board. In theory, the sample should work on the board, so you could try to port it yourself.

  • Got it.

    I am very new to all this. Which files would I need to edit in order to port it to the pca20035?

Related