GoogleCloudPlatform / iot-device-sdk-embedded-c

Cloud IoT Device SDK for Connectivity to IoT Core.
Other
247 stars 83 forks source link

Zepyhr: make PRESET=ZEPHYR fails #103

Closed mikevoyt closed 4 years ago

mikevoyt commented 4 years ago

v1.0.2 fails to build for Zephyr when following the Zephyr RTOS example: Getting Started on Ubuntu 20.04 LTS:

$ make PRESET=ZEPHYR
# Using build PRESET "ZEPHYR" to set CONFIG and TARGET variables:
.    IOTC_BSP_PLATFORM: [zephyr] 
.    IOTC_BSP_TLS:      [mbedtls] 

# 
# Google IoT Core Embedded C Client Makefile 
#  Please see ./README.md for more information.
# 

.    CONFIG:          [memory_fs-tls_bsp]
.    TARGET:          [zephyr-static-debug]
.    COMPILER:        [cc] 

#  
# NOTE! Makefile executing 3rd Party TLS build: 
# 

...

make[2]: Leaving directory '/home/mikevoyt/IoT/iot-device-sdk-embedded-c/third_party/tls/mbedtls/tests'
make[2]: Entering directory '/home/mikevoyt/IoT/iot-device-sdk-embedded-c/third_party/tls/mbedtls'
make[2]: Leaving directory '/home/mikevoyt/IoT/iot-device-sdk-embedded-c/third_party/tls/mbedtls'
make[1]: Leaving directory '/home/mikevoyt/IoT/iot-device-sdk-embedded-c/third_party/tls/mbedtls'
mbedTLS Build Complete.
IOTC Zephyr build: git clone Zephyr repository to /home/mikevoyt/IoT/iot-device-sdk-embedded-c/third_party/zephyr/
Cloning into '/home/mikevoyt/IoT/iot-device-sdk-embedded-c/third_party/zephyr'...
remote: Enumerating objects: 32, done.
remote: Counting objects: 100% (32/32), done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 453496 (delta 15), reused 4 (delta 0), pack-reused 453464
Receiving objects: 100% (453496/453496), 324.81 MiB | 4.88 MiB/s, done.
Resolving deltas: 100% (341731/341731), done.
Updating files: 100% (12081/12081), done.
Updating files: 100% (17088/17088), done.
Note: switching to 'zephyr-v1.14.0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at cebe11544e release: Zephyr 1.14.0
#  source /home/mikevoyt/IoT/iot-device-sdk-embedded-c/third_party/zephyr//zephyr-env.sh; cd /home/mikevoyt/IoT/iot-device-sdk-embedded-c/examples/zephyr_native_posix; ./prebuild.sh
cd /home/mikevoyt/IoT/iot-device-sdk-embedded-c/examples/zephyr_native_posix; ./prebuild.sh
Requirement already satisfied: pyelftools in /home/mikevoyt/.local/lib/python3.8/site-packages (0.26)
Zephyr version: 1.14.0
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.2", minimum required is "3.4") 
-- Selected BOARD native_posix
CMake Error at /home/mikevoyt/IoT/iot-device-sdk-embedded-c/third_party/zephyr/cmake/host-tools.cmake:57 (message):
  Unable to find dtc
Call Stack (most recent call first):
  /home/mikevoyt/IoT/iot-device-sdk-embedded-c/third_party/zephyr/cmake/app/boilerplate.cmake:381 (include)
  CMakeLists.txt:18 (include)

-- Configuring incomplete, errors occurred!
make[1]: Entering directory '/home/mikevoyt/IoT/iot-device-sdk-embedded-c/examples/zephyr_native_posix/build'
make[1]: *** No rule to make target 'zephyr/include/generated/autoconf.h'.  Stop.
make[1]: Leaving directory '/home/mikevoyt/IoT/iot-device-sdk-embedded-c/examples/zephyr_native_posix/build'
make[1]: Entering directory '/home/mikevoyt/IoT/iot-device-sdk-embedded-c/examples/zephyr_native_posix/build'
make[1]: *** No rule to make target 'syscall_list_h_target'.  Stop.
make[1]: Leaving directory '/home/mikevoyt/IoT/iot-device-sdk-embedded-c/examples/zephyr_native_posix/build'
make[1]: Entering directory '/home/mikevoyt/IoT/iot-device-sdk-embedded-c/examples/zephyr_native_posix/build'
make[1]: *** No rule to make target 'syscall_macros_h_target'.  Stop.
make[1]: Leaving directory '/home/mikevoyt/IoT/iot-device-sdk-embedded-c/examples/zephyr_native_posix/build'
make[1]: Entering directory '/home/mikevoyt/IoT/iot-device-sdk-embedded-c/examples/zephyr_native_posix/build'
make[1]: *** No rule to make target 'kobj_types_h_target'.  Stop.
make[1]: Leaving directory '/home/mikevoyt/IoT/iot-device-sdk-embedded-c/examples/zephyr_native_posix/build'
mikevoyt commented 4 years ago

Fixed this issue with: sudo apt-get install device-tree-compiler gperf. Perhaps Zephyr RTOS example: Getting Started can note this requirement.

galz10 commented 4 years ago

Hi mike thanks for your feedback and how you fixed the issue!, i'll add the fix to the getting started guide.

galz10 commented 4 years ago

PR #104