espressif / esp-google-iot

Google Cloud IoT SDK as an ESP-IDF Component
Apache License 2.0
143 stars 44 forks source link

Issues building this as component in unit test (CA-195) #31

Open mc18g13 opened 2 years ago

mc18g13 commented 2 years ago

Can't seem to get this building for host unit tests. Wondering if this would be the correct way to include this in a project. Or if I am missing some requires.

I have a bare bones example branch here.

Example branch

Running cmake in directory /home/mc18g13/esp-idf-example/example_project/components/my_component/host_test/test_my_component/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DIDF_TARGET=linux -DCCACHE_ENABLE=1 /home/mc18g13/esp-idf-example/example_project/components/my_component/host_test/test_my_component"...
-- Found Git: /usr/bin/git (found version "2.25.1") 
-- ccache will be used for faster recompilation
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- 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
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target linux
-- building FREERTOS MOCKS (only task and queue)
-- Project sdkconfig file /home/mc18g13/esp-idf-example/example_project/components/my_component/host_test/test_my_component/sdkconfig
Traceback (most recent call last):
  File "/opt/esp/idf/tools/kconfig_new/confgen.py", line 599, in <module>
    main()
  File "/opt/esp/idf/tools/kconfig_new/confgen.py", line 250, in main
    config = kconfiglib.Kconfig(args.kconfig)
  File "/opt/esp/python_env/idf5.0_py3.8_env/lib/python3.8/site-packages/kconfiglib.py", line 947, in __init__
    self._init(filename, warn, warn_to_stderr, encoding)
  File "/opt/esp/python_env/idf5.0_py3.8_env/lib/python3.8/site-packages/kconfiglib.py", line 1085, in _init
    self._parse_block(None, self.top_node, self.top_node).next = None
  File "/opt/esp/python_env/idf5.0_py3.8_env/lib/python3.8/site-packages/kconfiglib.py", line 3021, in _parse_block
    self._parse_block(_T_ENDMENU, node, node)
  File "/opt/esp/python_env/idf5.0_py3.8_env/lib/python3.8/site-packages/kconfiglib.py", line 2982, in _parse_block
    prev = self._parse_block(None, parent, prev)
  File "/opt/esp/python_env/idf5.0_py3.8_env/lib/python3.8/site-packages/kconfiglib.py", line 2982, in _parse_block
    prev = self._parse_block(None, parent, prev)
  File "/opt/esp/python_env/idf5.0_py3.8_env/lib/python3.8/site-packages/kconfiglib.py", line 3021, in _parse_block
    self._parse_block(_T_ENDMENU, node, node)
  File "/opt/esp/python_env/idf5.0_py3.8_env/lib/python3.8/site-packages/kconfiglib.py", line 3021, in _parse_block
    self._parse_block(_T_ENDMENU, node, node)
  File "/opt/esp/python_env/idf5.0_py3.8_env/lib/python3.8/site-packages/kconfiglib.py", line 2970, in _parse_block
    raise KconfigError(
kconfiglib.KconfigError: /opt/esp/idf/components/esp_hw_support/Kconfig:16: '/opt/esp/idf/components/esp_hw_support/./port/linux/Kconfig.mac' not found (in 'rsource "./port/$IDF_TARGET/Kconfig.mac"'). Check that environment variables are set correctly (e.g. $srctree, which is unset or blank). Also note that unset environment variables expand to the empty string.
CMake Error at /opt/esp/idf/tools/cmake/kconfig.cmake:178 (message):
  Failed to run confgen.py
  (/opt/esp/python_env/idf5.0_py3.8_env/bin/python;/opt/esp/idf/tools/kconfig_new/confgen.py;--list-separator=semicolon;--kconfig;/opt/esp/idf/Kconfig;--sdkconfig-rename;/opt/esp/idf/sdkconfig.rename;--config;/home/mc18g13/esp-idf-example/example_project/components/my_component/host_test/test_my_component/sdkconfig;--defaults;/home/mc18g13/esp-idf-example/example_project/components/my_component/host_test/test_my_component/sdkconfig.defaults;--env-file;/home/mc18g13/esp-idf-example/example_project/components/my_component/host_test/test_my_component/build/config.env).
  Error 1
Call Stack (most recent call first):
  /opt/esp/idf/tools/cmake/build.cmake:528 (__kconfig_generate_config)
  /opt/esp/idf/tools/cmake/project.cmake:422 (idf_build_process)
  CMakeLists.txt:15 (project)