espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.69k stars 7.29k forks source link

ESP HFP API Build Error - Undefined reference to ... (IDFGH-2834) #4895

Closed searock35 closed 4 years ago

searock35 commented 4 years ago

Environment

Problem Description

I am trying to use the HFP AG API that was recently added. I have written some code that begins to implement the API but I can't get the file to build properly. When I build, It fails on the "linking CXX executable" stage for the elf file. It says that there are undefined references to the functions I reference from the esp_hf_ag_api.h file.

Expected Behavior

I expect the program to build properly.

Actual Behavior

It fails during the build on the "Linking CXX Executable" part. See log below.

Steps to reproduce

  1. Include references to the esp_hf_ag_api file and attempt to build the project.
  2. See the error unfold

Code to reproduce this issue

GIST

Debug Logs


C:\Users\cb1562\Documents\esp-idf\examples\bluetooth\bluedroid\classic_bt\hfp_fad>idf.py build
Executing action: all (aliases: build)
Running cmake in directory c:\users\cb1562\documents\esp-idf\examples\bluetooth\bluedroid\classic_bt\hfp_fad\build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 --warn-uninitialized -DCCACHE_ENABLE=1 c:\users\cb1562\documents\esp-idf\examples\bluetooth\bluedroid\classic_bt\hfp_fad"...
Warn about uninitialized values.
-- Found Git: C:/Users/cb1562/AppData/Local/Programs/Git/cmd/git.exe (found version "2.21.0.windows.1")
-- IDF_TARGET not set, using default target: esp32
-- ccache will be used for faster recompilation
-- The C compiler identification is GNU 8.2.0
-- The CXX compiler identification is GNU 8.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/Users/cb1562/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe
-- Check for working C compiler: C:/Users/cb1562/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe
-- Check for working C compiler: C:/Users/cb1562/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Users/cb1562/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++.exe
-- Check for working CXX compiler: C:/Users/cb1562/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32
Loading defaults file C:/Users/cb1562/Documents/esp-idf/examples/bluetooth/bluedroid/classic_bt/hfp_fad/sdkconfig.defaults...
-- Adding linker script C:/Users/cb1562/Documents/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs-time.ld
-- Adding linker script C:/Users/cb1562/Documents/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script C:/Users/cb1562/Documents/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script C:/Users/cb1562/Documents/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld
-- Adding linker script C:/Users/cb1562/Documents/esp-idf/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
-- Adding linker script C:/Users/cb1562/Documents/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Found PythonInterp: C:/Users/cb1562/.espressif/python_env/idf4.2_py3.5_env/Scripts/python.exe (found version "3.5.1")
-- Could NOT find Perl (missing: PERL_EXECUTABLE)
-- App "hfp_fad" version: v4.2-dev-560-g5f771fb7b
-- Adding linker script C:/Users/cb1562/Documents/esp-idf/examples/bluetooth/bluedroid/classic_bt/hfp_fad/build/esp-idf/esp32/esp32_out.ld
-- Adding linker script C:/Users/cb1562/Documents/esp-idf/components/esp32/ld/esp32.project.ld.in

(skipped some lines here)

[96/99] Linking C static library esp-idf\spi_flash\libspi_flash.a
[97/99] Linking C static library esp-idf\main\libmain.a
[98/99] Linking C executable bootloader.elf
[99/99] Generating binary image from built executable
esptool.py v3.0-dev
Generated C:/Users/cb1562/Documents/esp-idf/examples/bluetooth/bluedroid/classic_bt/hfp_fad/build/bootloader/bootloader.bin
[1072/1173] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj
FAILED: esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj
ccache C:\Users\cb1562\.espressif\tools\xtensa-esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-gcc.exe -DHAVE_CONFIG_H -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX -Iconfig -I../main -I../../../../../../components/newlib/platform_include -I../../../../../../components/freertos/include -I../../../../../../components/freertos/xtensa/include -I../../../../../../components/heap/include -I../../../../../../components/log/include -I../../../../../../components/lwip/include/apps -I../../../../../../components/lwip/include/apps/sntp -I../../../../../../components/lwip/lwip/src/include -I../../../../../../components/lwip/port/esp32/include -I../../../../../../components/lwip/port/esp32/include/arch -I../../../../../../components/soc/src/esp32/. -I../../../../../../components/soc/src/esp32/include -I../../../../../../components/soc/include -I../../../../../../components/esp_rom/include -I../../../../../../components/esp_common/include -I../../../../../../components/xtensa/include -I../../../../../../components/xtensa/esp32/include -I../../../../../../components/esp32/include -I../../../../../../components/driver/include -I../../../../../../components/driver/esp32/include -I../../../../../../components/esp_ringbuf/include -I../../../../../../components/efuse/include -I../../../../../../components/efuse/esp32/include -I../../../../../../components/esp_timer/include -I../../../../../../components/soc/soc/esp32/. -I../../../../../../components/soc/soc/esp32/include -I../../../../../../components/soc/soc/esp32/../include -I../../../../../../components/vfs/include -I../../../../../../components/esp_wifi/include -I../../../../../../components/esp_wifi/esp32/include -I../../../../../../components/esp_event/include -I../../../../../../components/esp_netif/include -I../../../../../../components/esp_eth/include -I../../../../../../components/tcpip_adapter/include -I../../../../../../components/app_trace/include -I../../../../../../components/mbedtls/port/include -I../../../../../../components/mbedtls/mbedtls/include -I../../../../../../components/wpa_supplicant/include -I../../../../../../components/wpa_supplicant/port/include -I../../../../../../components/wpa_supplicant/include/esp_supplicant -I../../../../../../components/bootloader_support/include -I../../../../../../components/app_update/include -I../../../../../../components/spi_flash/include -I../../../../../../components/nvs_flash/include -I../../../../../../components/pthread/include -I../../../../../../components/espcoredump/include -I../../../../../../components/perfmon/include -I../../../../../../components/asio/asio/asio/include -I../../../../../../components/asio/port/include -I../../../../../../components/bt/include -I../../../../../../components/bt/common/osi/include -I../../../../../../components/bt/host/bluedroid/api/include/api -I../../../../../../components/cbor/port/include -I../../../../../../components/coap/port/include -I../../../../../../components/coap/port/include/coap -I../../../../../../components/coap/libcoap/include -I../../../../../../components/coap/libcoap/include/coap2 -I../../../../../../components/console -I../../../../../../components/nghttp/port/include -I../../../../../../components/nghttp/nghttp2/lib/includes -I../../../../../../components/esp-tls -I../../../../../../components/esp_adc_cal/include -I../../../../../../components/esp_gdbstub/include -I../../../../../../components/tcp_transport/include -I../../../../../../components/esp_http_client/include -I../../../../../../components/esp_http_server/include -I../../../../../../components/esp_https_ota/include -I../../../../../../components/protobuf-c/protobuf-c -I../../../../../../components/protocomm/include/common -I../../../../../../components/protocomm/include/security -I../../../../../../components/protocomm/include/transports -I../../../../../../components/mdns/include -I../../../../../../components/esp_local_ctrl/include -I../../../../../../components/sdmmc/include -I../../../../../../components/esp_serial_slave_link/include -I../../../../../../components/esp_websocket_client/include -I../../../../../../components/expat/expat/expat/lib -I../../../../../../components/expat/port/include -I../../../../../../components/wear_levelling/include -I../../../../../../components/fatfs/diskio -I../../../../../../components/fatfs/vfs -I../../../../../../components/fatfs/src -I../../../../../../components/freemodbus/common/include -I../../../../../../components/idf_test/include -I../../../../../../components/jsmn/include -I../../../../../../components/json/cJSON -I../../../../../../components/libsodium/libsodium/src/libsodium/include -I../../../../../../components/libsodium/port_include -I../../../../../../components/mqtt/esp-mqtt/include -I../../../../../../components/openssl/include -I../../../../../../components/spiffs/include -I../../../../../../components/ulp/include -I../../../../../../components/unity/include -I../../../../../../components/unity/unity/src -I../../../../../../components/wifi_provisioning/include -mlongcalls -Wno-frame-address   -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -ggdb -Og -std=gnu99 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER=\"v4.2-dev-560-g5f771fb7b\" -DESP_PLATFORM -MD -MT esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj -MF esp-idf\main\CMakeFiles\__idf_main.dir\main.c.obj.d -o esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj   -c ../main/main.c
../main/main.c:30:10: fatal error: bt_app_hf.h: No such file or directory
 #include "bt_app_hf.h"
          ^~~~~~~~~~~~~
compilation terminated.
[1081/1173] Building C object esp-idf/openssl/CMakeFiles/__idf_openssl.dir/platform/ssl_pm.c.obj
ninja: build stopped: subcommand failed.
ninja failed with exit code 1

Other items if possible

(I'm really sorry, I don't know how to link or attach my project files or logs here. Please ask me for more stuff when you will inevitably need it)

AbnerFederer commented 4 years ago

Hi,

Maybe you can remove the bt_app_hf.h file.

Thanks Abner

searock35 commented 4 years ago

Hi AbnerFederer, Thanks for responding. I removed that reference before I ran into this build error but mistakenly left it in the code. I changed the code on the GIST link to reflect that. My apologies, Corey

renzbagaporo commented 4 years ago

So does that mean this can be closed @searock35?

searock35 commented 4 years ago

Sorry, I should have made it more clear that the problem still persists. I am gonna try building it in the Eclipse build environment soon and maybe that will help?

renzbagaporo commented 4 years ago

Can you build the HFP examples? @searock35

renzbagaporo commented 4 years ago

Any updates @searock35 ?

searock35 commented 4 years ago

@renzbagaporo Sorry, I should've updated a while ago. I moved from my laptop to a different device and everything works fine there. I won't delve too deep into it now. Although I am closing this, I will answer your last question; I was able to build the examples, but my program I could not build. I might have forgotten to update the SDK config file when I did this, I'm not sure. Thanks for helping.