Page 1 of 1

include sdk file issue

Posted: Fri Jan 13, 2017 8:54 am
by irobux
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

Re: include sdk file issue

Posted: Tue Jan 17, 2017 5:22 am
by kolban
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.

Re: include sdk file issue

Posted: Tue Jan 17, 2017 5:57 am
by WiFive
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?

Re: include sdk file issue

Posted: Tue Jan 17, 2017 6:56 am
by kolban
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.

Re: include sdk file issue

Posted: Tue Jan 17, 2017 7:11 am
by WiFive
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 ;)

Re: include sdk file issue

Posted: Tue Jan 17, 2017 10:13 pm
by kolban
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.

Re: include sdk file issue

Posted: Wed Jan 18, 2017 11:53 am
by ESP_krzychb
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.

Re: include sdk file issue

Posted: Wed Jan 18, 2017 11:59 am
by rudi ;-)
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 ;-)