-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
Description
On macOS Mojave (v10.14.6 - 18G95), from a fresh clone of ARMmbed/mbed-os (f5dd7db), running:
$ mbed test --unittestsgives the following error:
[ 66%] Building CXX object CMakeFiles/features-cellular-framework-AT-athandler.MbedOS.dir/Users/ladislas/dev/mbed/mbed-os/features/cellular/framework/AT/ATHandler.cpp.o
In file included from /Users/ladislas/dev/mbed/mbed-os/features/cellular/framework/AT/ATHandler.cpp:25:
In file included from /Users/ladislas/dev/mbed/mbed-os/UNITTESTS/../rtos/ThisThread.h:26:
In file included from /Users/ladislas/dev/mbed/mbed-os/UNITTESTS/../rtos/mbed_rtos_types.h:21:
/Users/ladislas/dev/mbed/mbed-os/UNITTESTS/target_h/cmsis_os2.h:66:9: warning: empty struct has size 0 in C, size 1 in C++ [-Wextern-c-compat]
typedef struct {
^
/Users/ladislas/dev/mbed/mbed-os/features/cellular/framework/AT/ATHandler.cpp:750:5: error: use of undeclared identifier 'errno'
errno = 0;
^
/Users/ladislas/dev/mbed/mbed-os/features/cellular/framework/AT/ATHandler.cpp:753:55: error: use of undeclared identifier 'errno'
if ((result == LONG_MIN || result == LONG_MAX) && errno == ERANGE) {
^
1 warning and 2 errors generated.
gmake[2]: *** [CMakeFiles/features-cellular-framework-AT-athandler.MbedOS.dir/build.make:63: CMakeFiles/features-cellular-framework-AT-athandler.MbedOS.dir/Users/ladislas/dev/mbed/mbed-os/features/cellular/framework/AT/ATHandler.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1878: CMakeFiles/features-cellular-framework-AT-athandler.MbedOS.dir/all] Error 2
gmake: *** [Makefile:141: all] Error 2
Building unit tests failed.
[mbed] ERROR: "/usr/local/opt/python/bin/python3.7" returned error.
Code: 2
Path: "/Users/ladislas/dev/github/mbed-os"
Command: "/usr/local/opt/python/bin/python3.7 /Users/ladislas/dev/mbed/mbed-os/UNITTESTS/mbed_unittest.py --build ./BUILD/unittests"
Tip: You could retry the last command with "-v" flag for verbose output
I also tried the manual approach by running:
$ cd UNITTESTS && mkdir build && cd build
$ cmake ..
$ gmakeand the same issue arises.
On the other hand after installing gcc and make with homebrew, running the following:
$ cmake .. -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=True -DCMAKE_MAKE_PROGRAM=/usr/local/bin/gmake -DCMAKE_CXX_COMPILER=/usr/local/bin/g++-9 -DCMAKE_C_COMPILER=/usr/local/bin/gcc-9
$ gmake VERBOSE=1
$ ctest -vworks well and all tests pass with no issues.
I think the reason is that mbed test --unittests is using the default gcc/g++ on macOS which points to clang and that clang cannot build the tests.
So it is either a bug or we need to improve the documentation for macOS, ask users to install gcc through brew install gcc and pass the correct flags to cmake to point to the gcc@9.
Issue request type
[ ] Question
[ ] Enhancement
[x] Bug