include sdk file issue

irobux
Posts: 9
Joined: Tue Jan 03, 2017 9:36 am

include sdk file issue

Postby irobux » Fri Jan 13, 2017 8:54 am

Hello,
Does anyone meet a include file issue witht he last update.
The last sample grom my git pull of this morning does not compile.

bta_api.h: No such file or directory
file is present in
components/bt/bluedroid/bta/include/

thanks
iRobux

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: include sdk file issue

Postby kolban » Tue Jan 17, 2017 5:22 am

Oooh ... I have just started to compile a project as well and now I am getting:

Code: Select all

$ make
CC module_bluetooth.o
/home/kolban/esp32/esptest/apps/workspace/duktape/main/./module_bluetooth.c:3:25: fatal error: esp_bt_main.h: No such file or directory
compilation terminated.
/home/kolban/esp32/esptest/esp-idf/make/component_wrapper.mk:176: recipe for target 'module_bluetooth.o' failed
make[1]: *** [module_bluetooth.o] Error 1
/home/kolban/esp32/esptest/esp-idf/make/project.mk:382: recipe for target 'main-build' failed
make: *** [main-build] Error 2
where previously I used to have clean compiles. Running:

Code: Select all

$ find . -name "esp_bt_main.h" -print
./components/bt/bluedroid/api/include/esp_bt_main.h
So the file exists. Checked its permissions and content and they seem ok ...

Later ... aha ...

For my problem, I had to enable "Bluetooth" in my "make menuconfig" -> Component config -> Bluetooth. Once understood, the original error isn't that bad ... however I don't think its the last we have heard of it. I'd suggest allowing an application to compile even if the "configuration" component says we haven't enabled bluetooth.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: include sdk file issue

Postby WiFive » Tue Jan 17, 2017 5:57 am

kolban wrote: I'd suggest allowing an application to compile even if the "configuration" component says we haven't enabled bluetooth.
When Bluetooth is disabled we don't want any Bluetooth code to be compiled or linked and that is going to cause an error if you are using it. Why wouldn't we want menuconfig to be the authority?

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: include sdk file issue

Postby kolban » Tue Jan 17, 2017 6:56 am

Howdy WiFive,
I'm all for "make menuconfig" being the source of configuration truth ... my discomfort comes from how disabled functions are manifested. If I disable a capability and then try and leverage it at compilation time, then in my ideal world we would see a compilation error of the form "Attempt to use <XYZ> function but that function is disabled." and not "Header file <PQR> not found".

Again ... my rambling is purely a data point ... but if the original poster's issue was the same as the one I found myself if, then that points to at least two looking for issues with include files and search paths for compilation.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: include sdk file issue

Postby WiFive » Tue Jan 17, 2017 7:11 am

kolban wrote: "Attempt to use <XYZ> function but that function is disabled." and not "Header file <PQR> not found.
Sounds good look forward to your pull request that covers all cases ;)

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: include sdk file issue

Postby kolban » Tue Jan 17, 2017 10:13 pm

As a workaround/solution ... when we activate Bluetooth in "make menuconfig", that sets the macro variable "CONFIG_BT_ENABLED". If we wish to conditionally compile code only when bluetooth is enabled we can use code similar to the following:

Code: Select all

#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#include <esp_bt_main.h>
#include <esp_gap_ble_api.h>
// etc etc etc
#endif // CONFIG_BT_ENABLED
// other code
I don't know about the prudence of this practice as a whole, but it seems to work for my needs.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

User avatar
ESP_krzychb
Posts: 400
Joined: Sat Oct 01, 2016 9:05 am
Contact:

Re: include sdk file issue

Postby ESP_krzychb » Wed Jan 18, 2017 11:53 am

in my ideal world we would see a compilation error of the form "Attempt to use <XYZ> function but that function is disabled."
I agree - this would be ideal.

In the meantime I think that another takeaway from this case is to watch for sdkconfig.defaults file that developers add to some examples. It provides other than default settings in menuconfig. All BT examples have such file with CONFIG_BT_ENABLED=y.

User avatar
rudi ;-)
Posts: 1729
Joined: Fri Nov 13, 2015 3:25 pm

Re: include sdk file issue

Postby rudi ;-) » Wed Jan 18, 2017 11:59 am

kolban wrote:As a workaround/solution ... when we activate Bluetooth in "make menuconfig", that sets the macro variable "CONFIG_BT_ENABLED". If we wish to conditionally compile code only when bluetooth is enabled we can use code similar to the following:

Code: Select all

#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#include <esp_bt_main.h>
#include <esp_gap_ble_api.h>
// etc etc etc
#endif // CONFIG_BT_ENABLED
// other code
I don't know about the prudence of this practice as a whole, but it seems to work for my needs.

yeap..
agree, here some things how it was solved:

other things:
https://github.com/espressif/esp-idf/co ... 7787c8b781
https://github.com/espressif/esp-idf/issues/238

or missing / deactivates..
possibles:
https://github.com/espressif/esp-idf/co ... 84577521d0

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

Who is online

Users browsing this forum: cdollar and 155 guests