eclipse-wakaama / wakaama

Eclipse Wakaama is a C implementation of the Open Mobile Alliance's LightWeight M2M protocol (LwM2M).
BSD 3-Clause "New" or "Revised" License
505 stars 375 forks source link

Cmake problems with wakaama #625

Closed samupf41 closed 2 years ago

samupf41 commented 3 years ago

Hi,

I'm trying to use LwM2M server with wakaama and emqx on a Raspberry Pi following this: https://github.com/eclipse/wakaama So I made the following:

git clone https://github.com/eclipse/wakaama.git
cd wakaama/
tools/ci/run_ci.sh --run-build

Then, I receive the following response:

pi@raspberrypi:~ $ cd wakaama/
pi@raspberrypi:~/wakaama $ tools/ci/run_ci.sh --run-build
CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "/home/pi/wakaama/build-wakaama/CMakeFiles/CMakeOutput.log".
pi@raspberrypi:~/wakaama $ 

The thing is that I have installed cmake 3.21.3. Moreover I've tried to do it on Ubuntu, installing everything from 0 and I've got the same error.

Does anyone have any idea?

Best regards

Samuel

rettichschnidi commented 3 years ago

Seems like you do not have Ninja installed. It is not strictly needed when you invoke CMake manually, but in case you actually want to use the build pipeline tools, then you can install it like this:

sudo apt install ninja-build
samupf41 commented 3 years ago

Once I've installed it, I still receive some errors from the building:

pi@raspberrypi:~ $ cd wakaama/
pi@raspberrypi:~/wakaama $ tools/ci/run_ci.sh --run-build
-- The C compiler identification is GNU 8.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/wakaama/build-wakaama
[1/146] Building C object tests/CMakeFiles/lwm2munittests.dir/block1tests.c.o
FAILED: tests/CMakeFiles/lwm2munittests.dir/block1tests.c.o 
/usr/bin/cc -DLWM2M_CLIENT_MODE -DLWM2M_COAP_DEFAULT_BLOCK_SIZE=1024 -DLWM2M_LITTLE_ENDIAN -DLWM2M_SUPPORT_JSON -DLWM2M_SUPPORT_SENML_JSON -DLWM2M_SUPPORT_TLV -D_POSIX_C_SOURCE=200809 -I/home/pi/wakaama/core/../include -I/home/pi/wakaama/coap -I/home/pi/wakaama/data -I/home/pi/wakaama/core -I/home/pi/wakaama/examples/shared -O2 -g -DNDEBUG -pedantic -Wall -Wextra -Wfloat-equal -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wswitch-default -MD -MT tests/CMakeFiles/lwm2munittests.dir/block1tests.c.o -MF tests/CMakeFiles/lwm2munittests.dir/block1tests.c.o.d -o tests/CMakeFiles/lwm2munittests.dir/block1tests.c.o -c /home/pi/wakaama/tests/block1tests.c
In file included from /home/pi/wakaama/tests/block1tests.c:19:
/home/pi/wakaama/tests/tests.h:21:10: fatal error: CUnit/CUError.h: No such file or directory
 #include "CUnit/CUError.h"
          ^~~~~~~~~~~~~~~~~
compilation terminated.
[2/146] Building C object tests/CMakeFiles/lwm2munittests.dir/tlvtests.c.o
FAILED: tests/CMakeFiles/lwm2munittests.dir/tlvtests.c.o 
/usr/bin/cc -DLWM2M_CLIENT_MODE -DLWM2M_COAP_DEFAULT_BLOCK_SIZE=1024 -DLWM2M_LITTLE_ENDIAN -DLWM2M_SUPPORT_JSON -DLWM2M_SUPPORT_SENML_JSON -DLWM2M_SUPPORT_TLV -D_POSIX_C_SOURCE=200809 -I/home/pi/wakaama/core/../include -I/home/pi/wakaama/coap -I/home/pi/wakaama/data -I/home/pi/wakaama/core -I/home/pi/wakaama/examples/shared -O2 -g -DNDEBUG -pedantic -Wall -Wextra -Wfloat-equal -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wswitch-default -MD -MT tests/CMakeFiles/lwm2munittests.dir/tlvtests.c.o -MF tests/CMakeFiles/lwm2munittests.dir/tlvtests.c.o.d -o tests/CMakeFiles/lwm2munittests.dir/tlvtests.c.o -c /home/pi/wakaama/tests/tlvtests.c
In file included from /home/pi/wakaama/tests/tlvtests.c:19:
/home/pi/wakaama/tests/tests.h:21:10: fatal error: CUnit/CUError.h: No such file or directory
 #include "CUnit/CUError.h"
          ^~~~~~~~~~~~~~~~~
compilation terminated.
[3/146] Building C object tests/CMakeFiles/lwm2munittests.dir/convert_numbers_test.c.o
FAILED: tests/CMakeFiles/lwm2munittests.dir/convert_numbers_test.c.o 
/usr/bin/cc -DLWM2M_CLIENT_MODE -DLWM2M_COAP_DEFAULT_BLOCK_SIZE=1024 -DLWM2M_LITTLE_ENDIAN -DLWM2M_SUPPORT_JSON -DLWM2M_SUPPORT_SENML_JSON -DLWM2M_SUPPORT_TLV -D_POSIX_C_SOURCE=200809 -I/home/pi/wakaama/core/../include -I/home/pi/wakaama/coap -I/home/pi/wakaama/data -I/home/pi/wakaama/core -I/home/pi/wakaama/examples/shared -O2 -g -DNDEBUG -pedantic -Wall -Wextra -Wfloat-equal -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wswitch-default -MD -MT tests/CMakeFiles/lwm2munittests.dir/convert_numbers_test.c.o -MF tests/CMakeFiles/lwm2munittests.dir/convert_numbers_test.c.o.d -o tests/CMakeFiles/lwm2munittests.dir/convert_numbers_test.c.o -c /home/pi/wakaama/tests/convert_numbers_test.c
In file included from /home/pi/wakaama/tests/convert_numbers_test.c:21:
/home/pi/wakaama/tests/tests.h:21:10: fatal error: CUnit/CUError.h: No such file or directory
 #include "CUnit/CUError.h"
          ^~~~~~~~~~~~~~~~~
compilation terminated.
[4/146] Building C object tests/CMakeFiles/lwm2munittests.dir/unittests.c.o
FAILED: tests/CMakeFiles/lwm2munittests.dir/unittests.c.o 
/usr/bin/cc -DLWM2M_CLIENT_MODE -DLWM2M_COAP_DEFAULT_BLOCK_SIZE=1024 -DLWM2M_LITTLE_ENDIAN -DLWM2M_SUPPORT_JSON -DLWM2M_SUPPORT_SENML_JSON -DLWM2M_SUPPORT_TLV -D_POSIX_C_SOURCE=200809 -I/home/pi/wakaama/core/../include -I/home/pi/wakaama/coap -I/home/pi/wakaama/data -I/home/pi/wakaama/core -I/home/pi/wakaama/examples/shared -O2 -g -DNDEBUG -pedantic -Wall -Wextra -Wfloat-equal -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wswitch-default -MD -MT tests/CMakeFiles/lwm2munittests.dir/unittests.c.o -MF tests/CMakeFiles/lwm2munittests.dir/unittests.c.o.d -o tests/CMakeFiles/lwm2munittests.dir/unittests.c.o -c /home/pi/wakaama/tests/unittests.c
/home/pi/wakaama/tests/unittests.c:21:10: fatal error: CUnit/Basic.h: No such file or directory
 #include "CUnit/Basic.h"
          ^~~~~~~~~~~~~~~
compilation terminated.
[5/146] Building C object tests/CMakeFiles/lwm2munittests.dir/tlv_json_lwm2m_data_test.c.o
FAILED: tests/CMakeFiles/lwm2munittests.dir/tlv_json_lwm2m_data_test.c.o 
/usr/bin/cc -DLWM2M_CLIENT_MODE -DLWM2M_COAP_DEFAULT_BLOCK_SIZE=1024 -DLWM2M_LITTLE_ENDIAN -DLWM2M_SUPPORT_JSON -DLWM2M_SUPPORT_SENML_JSON -DLWM2M_SUPPORT_TLV -D_POSIX_C_SOURCE=200809 -I/home/pi/wakaama/core/../include -I/home/pi/wakaama/coap -I/home/pi/wakaama/data -I/home/pi/wakaama/core -I/home/pi/wakaama/examples/shared -O2 -g -DNDEBUG -pedantic -Wall -Wextra -Wfloat-equal -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wswitch-default -MD -MT tests/CMakeFiles/lwm2munittests.dir/tlv_json_lwm2m_data_test.c.o -MF tests/CMakeFiles/lwm2munittests.dir/tlv_json_lwm2m_data_test.c.o.d -o tests/CMakeFiles/lwm2munittests.dir/tlv_json_lwm2m_data_test.c.o -c /home/pi/wakaama/tests/tlv_json_lwm2m_data_test.c
In file included from /home/pi/wakaama/tests/tlv_json_lwm2m_data_test.c:30:
/home/pi/wakaama/tests/tests.h:21:10: fatal error: CUnit/CUError.h: No such file or directory
 #include "CUnit/CUError.h"
          ^~~~~~~~~~~~~~~~~
compilation terminated.
[6/146] Building C object tests/CMakeFiles/lwm2munittests.dir/senml_json_tests.c.o
FAILED: tests/CMakeFiles/lwm2munittests.dir/senml_json_tests.c.o 
/usr/bin/cc -DLWM2M_CLIENT_MODE -DLWM2M_COAP_DEFAULT_BLOCK_SIZE=1024 -DLWM2M_LITTLE_ENDIAN -DLWM2M_SUPPORT_JSON -DLWM2M_SUPPORT_SENML_JSON -DLWM2M_SUPPORT_TLV -D_POSIX_C_SOURCE=200809 -I/home/pi/wakaama/core/../include -I/home/pi/wakaama/coap -I/home/pi/wakaama/data -I/home/pi/wakaama/core -I/home/pi/wakaama/examples/shared -O2 -g -DNDEBUG -pedantic -Wall -Wextra -Wfloat-equal -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wswitch-default -MD -MT tests/CMakeFiles/lwm2munittests.dir/senml_json_tests.c.o -MF tests/CMakeFiles/lwm2munittests.dir/senml_json_tests.c.o.d -o tests/CMakeFiles/lwm2munittests.dir/senml_json_tests.c.o -c /home/pi/wakaama/tests/senml_json_tests.c
In file included from /home/pi/wakaama/tests/senml_json_tests.c:31:
/home/pi/wakaama/tests/tests.h:21:10: fatal error: CUnit/CUError.h: No such file or directory
 #include "CUnit/CUError.h"
          ^~~~~~~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
rettichschnidi commented 3 years ago

You will need the CUnit package:

sudo apt install libcunit1-dev

Please see https://github.com/eclipse/wakaama/blob/master/README.md#dependencies-and-tools for all dependencies.

mlasch commented 3 years ago

sudo apt install libcunit1-dev

@samupf41 did this solve your issue? If so, I would close this issue.