esp-idf: NimBLE: Build fails with only Observer role enabled (IDFGH-8308)
Answers checklist.
- I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
- I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
- I have searched the issue tracker for a similar issue and not found a similar issue.
IDF version.
v.4.4.2
Operating System used.
macOS
How did you build your project?
VS Code IDE
If you are using Windows, please specify command line type.
No response
What is the expected behavior?
Build should be successful with no errors.
What is the actual behavior?
Build returns errors and doesn’t complete.
Steps to reproduce.
- Create a sample project or test on an existing project
- Enable BT and select NimBLE
- Disable al roles but Observer (menuconfig)
- Build the project
Build or installation Logs.
...
/Users/raver/espressif/esp-idf-v4.4.2/components/bt/host/nimble/nimble/nimble/host/src/ble_gap.c: In function 'ble_gap_disc_report':
/Users/raver/espressif/esp-idf-v4.4.2/components/bt/host/nimble/nimble/nimble/host/src/ble_gap.c:1007:5: error: implicit declaration of function 'ble_gap_master_extract_state'; did you mean 'ble_gap_slave_extract_cb'? [-Werror=implicit-function-declaration]
ble_gap_master_extract_state(&state, 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ble_gap_slave_extract_cb
/Users/raver/espressif/esp-idf-v4.4.2/components/bt/host/nimble/nimble/nimble/host/src/ble_gap.c:1008:9: error: implicit declaration of function 'ble_gap_has_client'; did you mean 'ble_gap_mtu_event'? [-Werror=implicit-function-declaration]
if (ble_gap_has_client(&state)) {
^~~~~~~~~~~~~~~~~~
ble_gap_mtu_event
/Users/raver/espressif/esp-idf-v4.4.2/components/bt/host/nimble/nimble/nimble/host/src/ble_gap.c: In function 'ble_gap_reset_state':
/Users/raver/espressif/esp-idf-v4.4.2/components/bt/host/nimble/nimble/nimble/host/src/ble_gap.c:1424:5: error: implicit declaration of function 'ble_gap_master_failed'; did you mean 'ble_gap_adv_finished'? [-Werror=implicit-function-declaration]
ble_gap_master_failed(reason);
^~~~~~~~~~~~~~~~~~~~~
ble_gap_adv_finished
/Users/raver/espressif/esp-idf-v4.4.2/components/bt/host/nimble/nimble/nimble/host/src/ble_gap.c: In function 'ble_gap_disc_cancel_no_lock':
/Users/raver/espressif/esp-idf-v4.4.2/components/bt/host/nimble/nimble/nimble/host/src/ble_gap.c:4420:5: error: implicit declaration of function 'ble_gap_master_reset_state'; did you mean 'ble_gap_slave_reset_state'? [-Werror=implicit-function-declaration]
ble_gap_master_reset_state();
^~~~~~~~~~~~~~~~~~~~~~~~~~
ble_gap_slave_reset_state
/Users/raver/espressif/esp-idf-v4.4.2/components/bt/host/nimble/nimble/nimble/host/src/ble_gap.c: In function 'ble_gap_disc':
/Users/raver/espressif/esp-idf-v4.4.2/components/bt/host/nimble/nimble/nimble/host/src/ble_gap.c:4748:9: error: implicit declaration of function 'ble_gap_master_set_timer'; did you mean 'ble_gap_master_timer'? [-Werror=implicit-function-declaration]
ble_gap_master_set_timer(duration_ticks);
^~~~~~~~~~~~~~~~~~~~~~~~
ble_gap_master_timer
At top level:
/Users/raver/espressif/esp-idf-v4.4.2/components/bt/host/nimble/nimble/nimble/host/src/ble_gap.c:835:1: warning: 'ble_gap_adv_finished' defined but not used [-Wunused-function]
ble_gap_adv_finished(uint8_t instance, int reason, uint16_t conn_handle,
^~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
[1073/1128] Building CXX object esp-idf/asio/CMakeFiles/__idf_asio.dir/asio/asio/src/asio.cpp.obj
ninja: build stopped: subcommand failed.
More Information.
Build fails with other IDF versions such as v4.3.4. No build errors with v4.2.4 or v5.0-beta1.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (1 by maintainers)
Hi @joaochainho ,
Can you please check if attached patch helps in your project for release/v4.4 and release/v4.3 ?
fix_compilation_issue.txt
Thanks, Rahul
Hi @joaochainho ,
ESP-IDF nimble code is forked clone of upstream apache mynewt-nimble codebase, and we try to maintain the code as equal as possible to uptream nimble code as it makes it easy for maintenance purpose and also end users to switch to ESP-IDF in case their solution already uses Nimble.
The issue you mentioned has been fixed upstream via https://github.com/apache/mynewt-nimble/pull/913 . However, if you observe, the change was not pushed to nimble-1.3 branch . It was pushed on master branch and then nimble-1.4 got created. Hence, you observe the failure on nimble-1.3 branch and not on nimble-1.4 . nimble-1.2 is fairly old branch which did not have code under stringent flag checks and hence it compiles.
One suggestion is to cherry-pick those commits and check if it helps resolve your issue.
Thanks, Rahul