ESPHOME/BT PROXY OTA Compile fails - esp files not found

I opened an issue for this (ESPHOME/BT Proxy - Missing dependencies · Issue #4734 · esphome/issues · GitHub) but there has been no one assigned.

Asking here for any assistance as to what I may need to add in my BT Proxy Yaml to specify the location of esp_mac.h that is not found and causing a fatal compile error.

Details/logs are in #4734.

Thanks!

Have you tried the documented yaml? https://github.com/esphome/bluetooth-proxies/blob/6ccc74c87fc658dc1ba56bec1771aea4a9f86a6b/esp32-generic.yaml

Thanks Nick. No I had not tried that esp32-generic.yaml. I was using the default yaml created when BT Proxy was installed via the config ui.

So I just replaced it with the documented yaml and only modified it to include the wifi info. Not quite there yet as there are now 2 dependency conflicts (click 8.1.6, not 8.1.3 & pyparsing 2.3.1 not >=3.0). There are additional cmake compile errors beyond that I don’t understand.

Updating /config/esphome/esp32-bluetooth-proxy-578a40.yaml
------------------------------------------------------------

INFO ESPHome 2023.7.0
INFO Reading configuration /config/esphome/esp32-bluetooth-proxy-578a40.yaml...
INFO Generating C++ source...
INFO Core config or version changed, cleaning build files...
INFO Compiling app...
Processing esp32-bt-proxy-578a40 (board: esp32dev; framework: espidf; platform: platformio/[email protected])
--------------------------------------------------------------------------------
Platform Manager: Installing platformio/espressif32 @ 5.3.0
INFO Installing platformio/espressif32 @ 5.3.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Platform Manager: [email protected] has been installed!
INFO [email protected] has been installed!
Tool Manager: Installing espressif/toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
INFO Installing espressif/toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%          
Tool Manager: [email protected]+2021r2-patch5 has been installed!
INFO [email protected]+2021r2-patch5 has been installed!
Tool Manager: Installing platformio/framework-espidf @ ~3.40404.0
INFO Installing platformio/framework-espidf @ ~3.40404.0
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%          
Tool Manager: [email protected] has been installed!
INFO [email protected] has been installed!
Tool Manager: Installing platformio/tool-esptoolpy @ ~1.40400.0
INFO Installing platformio/tool-esptoolpy @ ~1.40400.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Tool Manager: [email protected] has been installed!
INFO [email protected] has been installed!
Library Manager: Installing esphome/Improv @ 1.2.3
INFO Installing esphome/Improv @ 1.2.3
Unpacking  [####################################]  100%
Library Manager: [email protected] has been installed!
INFO [email protected] has been installed!
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - framework-espidf @ 3.40404.0 (4.4.4) 
 - tool-cmake @ 3.16.9 
 - tool-ninja @ 1.10.2 
 - toolchain-esp32ulp @ 2.35.0-20220830 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Installing ESP-IDF's Python dependencies
Collecting idf-component-manager~=1.0
  Downloading idf_component_manager-1.3.2-py2.py3-none-any.whl (135 kB)
Collecting packaging
  Downloading packaging-23.1-py3-none-any.whl (48 kB)
Collecting urllib3<2
  Downloading urllib3-1.26.16-py2.py3-none-any.whl (143 kB)
Collecting six
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting requests-file
  Downloading requests_file-1.5.1-py2.py3-none-any.whl (3.7 kB)
Collecting requests<3
  Downloading requests-2.31.0-py3-none-any.whl (62 kB)
Collecting schema
  Downloading schema-0.7.5-py2.py3-none-any.whl (17 kB)
Collecting requests-toolbelt
  Downloading requests_toolbelt-1.0.0-py2.py3-none-any.whl (54 kB)
Collecting tqdm<5
  Downloading tqdm-4.65.0-py3-none-any.whl (77 kB)
Collecting pyyaml>5.2
  Downloading PyYAML-6.0.1.tar.gz (125 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
    Preparing wheel metadata: started
    Preparing wheel metadata: finished with status 'done'
Collecting contextlib2>0.6.0
  Downloading contextlib2-21.6.0-py2.py3-none-any.whl (13 kB)
Collecting colorama
  Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Collecting cachecontrol[filecache]>0.12.6
  Downloading cachecontrol-0.13.1-py3-none-any.whl (22 kB)
Collecting click
  Downloading click-8.1.6-py3-none-any.whl (97 kB)
Collecting msgpack>=0.5.2
  Downloading msgpack-1.0.5.tar.gz (127 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
    Preparing wheel metadata: started
    Preparing wheel metadata: finished with status 'done'
Collecting filelock>=3.8.0
  Downloading filelock-3.12.2-py3-none-any.whl (10 kB)
Collecting charset-normalizer<4,>=2
  Downloading charset_normalizer-3.2.0-py3-none-any.whl (46 kB)
Collecting certifi>=2017.4.17
  Downloading certifi-2023.7.22-py3-none-any.whl (158 kB)
Collecting idna<4,>=2.5
  Downloading idna-3.4-py3-none-any.whl (61 kB)
Building wheels for collected packages: msgpack, pyyaml
  Building wheel for msgpack (PEP 517): started
  Building wheel for msgpack (PEP 517): finished with status 'done'
  Created wheel for msgpack: filename=msgpack-1.0.5-cp39-cp39-linux_armv7l.whl size=15530 sha256=d569aa746c4b11ed8464213cfd7b1de13509540728e26ca59c241cef670dc87b
  Stored in directory: /tmp/pip-ephem-wheel-cache-v06fhi2m/wheels/eb/44/0f/b80f03579913a122a0c32b2e60cc73f07d5d9caf452b02bc9a
  Building wheel for pyyaml (PEP 517): started
  Building wheel for pyyaml (PEP 517): finished with status 'done'
  Created wheel for pyyaml: filename=PyYAML-6.0.1-cp39-cp39-linux_armv7l.whl size=45359 sha256=cd88917bf6e565411c7867627119456d6eb5315fe3ec7309b266f0bf000d840b
  Stored in directory: /tmp/pip-ephem-wheel-cache-v06fhi2m/wheels/1c/ff/88/3a317d1db793206ab64cb66367bf6f84186b75849656be786a
Successfully built msgpack pyyaml
Installing collected packages: urllib3, idna, charset-normalizer, certifi, requests, msgpack, six, filelock, contextlib2, cachecontrol, tqdm, schema, requests-toolbelt, requests-file, pyyaml, packaging, colorama, click, idf-component-manager
  Attempting uninstall: urllib3
    Found existing installation: urllib3 1.26.16
    Uninstalling urllib3-1.26.16:
      Successfully uninstalled urllib3-1.26.16
  Attempting uninstall: idna
    Found existing installation: idna 3.4
    Uninstalling idna-3.4:
      Successfully uninstalled idna-3.4
  Attempting uninstall: charset-normalizer
    Found existing installation: charset-normalizer 3.1.0
    Uninstalling charset-normalizer-3.1.0:
      Successfully uninstalled charset-normalizer-3.1.0
  Attempting uninstall: certifi
    Found existing installation: certifi 2023.5.7
    Uninstalling certifi-2023.5.7:
      Successfully uninstalled certifi-2023.5.7
  Attempting uninstall: requests
    Found existing installation: requests 2.31.0
    Uninstalling requests-2.31.0:
      Successfully uninstalled requests-2.31.0
  Attempting uninstall: six
    Found existing installation: six 1.16.0
    Not uninstalling six at /usr/lib/python3/dist-packages, outside environment /usr
    Can't uninstall 'six'. No files were found to uninstall.
  Attempting uninstall: pyyaml
    Found existing installation: PyYAML 6.0.1
    Uninstalling PyYAML-6.0.1:
      Successfully uninstalled PyYAML-6.0.1
  Attempting uninstall: packaging
    Found existing installation: packaging 23.1
    Uninstalling packaging-23.1:
      Successfully uninstalled packaging-23.1
  Attempting uninstall: colorama
    Found existing installation: colorama 0.4.6
    Uninstalling colorama-0.4.6:
      Successfully uninstalled colorama-0.4.6
  Attempting uninstall: click
    Found existing installation: click 8.1.3
    Uninstalling click-8.1.3:
      Successfully uninstalled click-8.1.3
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
esphome 2023.7.0 requires click==8.1.3, but you have click 8.1.6 which is incompatible.
esphome 2023.7.0 requires pyparsing>=3.0, but you have pyparsing 2.3.1 which is incompatible.
Successfully installed cachecontrol-0.13.1 certifi-2023.7.22 charset-normalizer-3.2.0 click-8.1.6 colorama-0.4.6 contextlib2-21.6.0 filelock-3.12.2 idf-component-manager-1.3.2 idna-3.4 msgpack-1.0.5 packaging-23.1 pyyaml-6.0.1 requests-2.31.0 requests-file-1.5.1 requests-toolbelt-1.0.0 schema-0.7.5 six-1.16.0 tqdm-4.65.0 urllib3-1.26.16
Reading CMake configuration...
-- Found Git: /usr/bin/git (found version "2.30.2") 
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: /data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/xtensa-esp32-elf-gcc
-- Check for working C compiler: /data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/xtensa-esp32-elf-gcc
-- Check for working C compiler: /data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/xtensa-esp32-elf-gcc -- broken
-- Configuring incomplete, errors occurred!
See also "/data/esp32-bt-proxy-578a40/.pioenvs/esp32-bt-proxy-578a40/CMakeFiles/CMakeOutput.log".
See also "/data/esp32-bt-proxy-578a40/.pioenvs/esp32-bt-proxy-578a40/CMakeFiles/CMakeError.log".

fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
CMake Error at /data/cache/platformio/packages/tool-cmake/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/xtensa-esp32-elf-gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /data/esp32-bt-proxy-578a40/.pioenvs/esp32-bt-proxy-578a40/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/data/cache/platformio/packages/tool-ninja/ninja cmTC_2c0d2 && [1/2] Building C object CMakeFiles/cmTC_2c0d2.dir/testCCompiler.c.obj
    [2/2] Linking C executable cmTC_2c0d2
    FAILED: cmTC_2c0d2 
    : && /data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/xtensa-esp32-elf-gcc -mlongcalls -Wno-frame-address   CMakeFiles/cmTC_2c0d2.dir/testCCompiler.c.obj  -o cmTC_2c0d2   && :
    /data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../libexec/gcc/xtensa-esp32-elf/8.4.0/liblto_plugin.so: error loading plugin: /data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../libexec/gcc/xtensa-esp32-elf/8.4.0/liblto_plugin.so: cannot open shared object file: No such file or directory
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  /data/cache/platformio/packages/framework-espidf/tools/cmake/project.cmake:296 (__project)
  CMakeLists.txt:3 (project)



========================= [FAILED] Took 205.07 seconds =========================
 [ERROR] /config/esphome/esp32-bluetooth-proxy-578a40.yaml 



======================== [SUMMARY] ========================
  - /config/esphome/esp32-bluetooth-proxy-578a40.yaml: FAILED

EDIT: Oh, there was one other change to the yaml I had to make. The auto-generated name in the substitutions section - name: esp32-bluetooth-proxy-578a40 was not accepted with the documented yaml. Error said it was too long! So I just removed the -578a40 and it accepted that. BUT - Esphome auto detected the BT Proxy again with the same name and is asking me to adopt it.

Have you tried cleaning the build files?

yes, I tried the clean build files option, then install again - same errors as before.

The odd thing now (see EDIT in previous post) is that after shortening the name so it would be accepted, I now have duplicate BT Proxy entries. One is Bluetooth Proxy 578a40 that wants to be adopted and the other has the shortened name Bluetooth Proxy, but is using esp32-bluetooth-proxy-578a40.yaml containing the documented github yaml.

It appears I cannot change the name to make it shorter without causing it to discover it again.

substitutions:
  name: esp32-bluetooth-proxy
  friendly_name: Bluetooth Proxy

packages:
  esphome.bluetooth-proxy: github://esphome/bluetooth-proxies/esp32-generic.yaml@main

esphome:
  name: ${name}
  name_add_mac_suffix: true
  friendly_name: ${friendly_name}

  project:
    name: esphome.bluetooth-proxy
    version: "1.0"

api:
  encryption:
    key: 3xuo2z/JkQssKC2pfHbOVav/mCE................
logger:
ota:
improv_serial:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

dashboard_import:
  package_import_url: github://esphome/bluetooth-proxies/esp32-generic.yaml@main

esp32_ble_tracker:
  scan_parameters:
    active: true

bluetooth_proxy:
  active: true

button:
- platform: safe_mode
  name: Safe Mode Boot
  entity_category: diagnostic

I gave up trying to get BT Proxy firmware updated OTA via ESPHOME due to all the unresolved compile errors. Reconnected to a PC and rebuilt BT Proxy yesterday to 2023.7.0 which worked just fine.

Now today there is a firmware upgrade notice, so I tried it via the Update notice page (not ESPHOME). It seemed to work fine as no errors were displayed.

BUT - ESPHOME says it’s not updated. What’s strange is that using ESPHOME to Verify the config, it says it is valid and lists 2023.7.1 as being installed!

INFO ESPHome 2023.7.1
INFO Reading configuration /config/esphome/esp32-bluetooth-proxy-578a40.yaml...
INFO Configuration is valid!
substitutions:
  name: esp32-bluetooth-proxy-578a40
  friendly_name: Bluetooth Proxy 578a40
esphome:
  name: esp32-bluetooth-proxy-578a40
  friendly_name: Bluetooth Proxy 578a40
  name_add_mac_suffix: false
  project:
    name: esphome.bluetooth-proxy
    version: '1.0'
  build_path: .esphome/build/esp32-bluetooth-proxy-578a40
  platformio_options: {}
  includes: []
  libraries: []
  min_version: 2023.7.1

So I tried ESPHOME to update it anyway to see if the CMake problems are solved… Nope. same errors as before. And now HA is showing that BT Proxy is still 2023.7.0 and needs to be updated.

Sigh.

Have you ever resolved that? Same issues for me as of August 2024

Sorry, no.

I just stumbled across this… The package moved, see here firmware/bluetooth-proxy/esp32-generic.yaml at 0f6fad0860b8bd2c251162abde5064be1ae29546 · esphome/firmware · GitHub

I updated the yaml of my proxy to fix… note the extra esp32-generic

packages:
esphome.bluetooth-proxy: github://esphome/bluetooth-proxies/esp32-generic/esp32-generic.yaml@main