Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Bridge example over Wi-Fi (CHIPoBLE disabled) compilation error #24203

Closed
CrowdedFuzzball opened this issue Dec 24, 2022 · 4 comments · Fixed by #24303
Closed

[BUG] Bridge example over Wi-Fi (CHIPoBLE disabled) compilation error #24203

CrowdedFuzzball opened this issue Dec 24, 2022 · 4 comments · Fixed by #24303
Labels

Comments

@CrowdedFuzzball
Copy link

CrowdedFuzzball commented Dec 24, 2022

Reproduction steps

Hello,

When trying to get the bridge device example to work over a local network (only over WiFi), I ran into the following problem:

If you disable the CHIPoBLE option in the menuconfig, the project is not built.

Compiller output
`
matter/examples/bridge-app/esp32/third_party/connectedhomeip/examples/platform/esp32/common/CommonDeviceCallbacks.cpp
In file included from matter/src/lib/dnssd/Resolver.h:31,
               from matter/src/lib/dnssd/TxtFields.h:21,
               from matter/src/lib/dnssd/Advertiser.h:26,
               from matter/src/app/server/CommissioningModeProvider.h:20,
               from matter/src/app/server/Dnssd.h:20,
               from matter/examples/bridge-app/esp32/third_party/connectedhomeip/examples/platform/esp32/common/CommonDeviceCallbacks.cpp:35:
matter/src/lib/dnssd/Constants.h:56:60: error: macro "max" requires 2 arguments, but only 1 given
constexpr size_t kSubTypeMaxLength      = std::max(SUBTYPES);
                                                          ^
In file included from matter/src/lib/dnssd/Resolver.h:31,
               from matter/src/lib/dnssd/TxtFields.h:21,
               from matter/src/lib/dnssd/Advertiser.h:26,
               from matter/src/app/server/CommissioningModeProvider.h:20,
               from matter/src/app/server/Dnssd.h:20,
               from matter/examples/bridge-app/esp32/third_party/connectedhomeip/examples/platform/esp32/common/CommonDeviceCallbacks.cpp:35:
matter/src/lib/dnssd/Constants.h:76:60: error: macro "max" requires 2 arguments, but only 1 given
constexpr size_t kSubTypeMaxLength      = std::max(SUBTYPES);
                                                          ^
In file included from matter/src/app/util/af.h:43,
               from matter/src/app/util/util.h:53,
               from matter/examples/bridge-app/esp32/third_party/connectedhomeip/examples/platform/esp32/common/CommonDeviceCallbacks.cpp:36:
matter/src/lib/support/SafeInt.h:69:58: error: macro "max" requires 2 arguments, but only 1 given
       if (static_cast<intmax_t>(numeric_limits<V>::max()) <= static_cast<intmax_t>(numeric_limits<T>::max()) &&
                                                        ^
matter/src/lib/support/SafeInt.h:69:109: error: macro "max" requires 2 arguments, but only 1 given
       if (static_cast<intmax_t>(numeric_limits<V>::max()) <= static_cast<intmax_t>(numeric_limits<T>::max()) &&
                                                                                                           ^
matter/src/lib/support/SafeInt.h:70:58: error: macro "min" requires 2 arguments, but only 1 given
           static_cast<intmax_t>(numeric_limits<V>::min()) >= static_cast<intmax_t>(numeric_limits<T>::min()))
                                                        ^
matter/src/lib/support/SafeInt.h:70:109: error: macro "min" requires 2 arguments, but only 1 given
           static_cast<intmax_t>(numeric_limits<V>::min()) >= static_cast<intmax_t>(numeric_limits<T>::min()))
                                                                                                           ^
matter/src/lib/support/SafeInt.h:77:61: error: macro "min" requires 2 arguments, but only 1 given
       return static_cast<intmax_t>(numeric_limits<T>::min()) <= static_cast<intmax_t>(arg) &&
                                                           ^
matter/src/lib/support/SafeInt.h:78:88: error: macro "max" requires 2 arguments, but only 1 given
           static_cast<intmax_t>(arg) <= static_cast<intmax_t>(numeric_limits<T>::max());
                                                                                      ^
matter/src/lib/support/SafeInt.h:83:59: error: macro "max" requires 2 arguments, but only 1 given
       if (static_cast<uintmax_t>(numeric_limits<V>::max()) <= static_cast<uintmax_t>(numeric_limits<T>::max()))
                                                         ^
matter/src/lib/support/SafeInt.h:83:111: error: macro "max" requires 2 arguments, but only 1 given
       if (static_cast<uintmax_t>(numeric_limits<V>::max()) <= static_cast<uintmax_t>(numeric_limits<T>::max()))
                                                                                                             ^
matter/src/lib/support/SafeInt.h:90:93: error: macro "max" requires 2 arguments, but only 1 given
       return static_cast<uintmax_t>(arg) <= static_cast<uintmax_t>(numeric_limits<T>::max());
                                                                                           ^
matter/src/lib/support/SafeInt.h:95:46: error: macro "max" requires 2 arguments, but only 1 given
       static_assert(numeric_limits<T>::max() >= 0, "What weird type is this?");
                                            ^
matter/src/lib/support/SafeInt.h:96:59: error: macro "max" requires 2 arguments, but only 1 given
       if (static_cast<uintmax_t>(numeric_limits<V>::max()) <= static_cast<uintmax_t>(numeric_limits<T>::max()))
                                                         ^
matter/src/lib/support/SafeInt.h:96:111: error: macro "max" requires 2 arguments, but only 1 given
       if (static_cast<uintmax_t>(numeric_limits<V>::max()) <= static_cast<uintmax_t>(numeric_limits<T>::max()))
                                                                                                             ^
matter/src/lib/support/SafeInt.h:101:93: error: macro "max" requires 2 arguments, but only 1 given
       return static_cast<uintmax_t>(arg) <= static_cast<uintmax_t>(numeric_limits<T>::max());
                                                                                           ^
matter/src/lib/support/SafeInt.h:104:101: error: macro "max" requires 2 arguments, but only 1 given
   return 0 <= arg && static_cast<uintmax_t>(arg) <= static_cast<uintmax_t>(numeric_limits<T>::max());
                                                                                                   ^
matter/src/lib/support/SafeInt.h:133:64: error: macro "max" requires 2 arguments, but only 1 given
   if (arg <= static_cast<T>(numeric_limits<signed_type>::max()))
                                                              ^
matter/src/lib/support/SafeInt.h:145:72: error: macro "max" requires 2 arguments, but only 1 given
   signed_type diff = static_cast<signed_type>(numeric_limits<T>::max() - arg);
                                                                      ^
In file included from matter/src/lib/dnssd/Resolver.h:31,
               from matter/src/lib/dnssd/TxtFields.h:21,
               from matter/src/lib/dnssd/Advertiser.h:26,
               from matter/src/app/server/CommissioningModeProvider.h:20,
               from matter/src/app/server/Dnssd.h:20,
               from matter/examples/bridge-app/esp32/third_party/connectedhomeip/examples/platform/esp32/common/CommonDeviceCallbacks.cpp:35:
matter/src/lib/dnssd/Constants.h:56:48: error: cannot resolve overloaded function 'max' based on conversion to type 'const size_t' {aka 'const unsigned int'}
constexpr size_t kSubTypeMaxLength      = std::max(SUBTYPES);
                                              ^~~
In file included from matter/src/lib/dnssd/Resolver.h:31,
               from matter/src/lib/dnssd/TxtFields.h:21,
               from matter/src/lib/dnssd/Advertiser.h:26,
               from matter/src/app/server/CommissioningModeProvider.h:20,
               from matter/src/app/server/Dnssd.h:20,
               from matter/examples/bridge-app/esp32/third_party/connectedhomeip/examples/platform/esp32/common/CommonDeviceCallbacks.cpp:35:
matter/src/lib/dnssd/Constants.h:76:48: error: cannot resolve overloaded function 'max' based on conversion to type 'const size_t' {aka 'const unsigned int'}
constexpr size_t kSubTypeMaxLength      = std::max(SUBTYPES);
                                              ^~~
In file included from /esp-idf/components/bt/host/nimble/nimble/porting/nimble/include/os/os_mempool.h:32,
               from /esp-idf/components/bt/host/nimble/nimble/nimble/include/nimble/ble_hci_trans.h:24,
               from /esp-idf/components/bt/host/nimble/esp-hci/include/esp_nimble_hci.h:25,
               from matter/examples/bridge-app/esp32/third_party/connectedhomeip/examples/platform/esp32/common/CommonDeviceCallbacks.cpp:24:
/esp-idf/components/bt/host/nimble/nimble/porting/nimble/include/os/os.h:34:19: error: expected unqualified-id before '(' token
#define max(a, b) ((a)>(b)?(a):(b))
                 ^
matter/src/lib/dnssd/Constants.h:89:48: note: in expansion of macro 'max'
constexpr size_t kInstanceNameMaxLength = std::max(Operational::kInstanceNameMaxLength, Commission::kInstanceNameMaxLength);
                                              ^~~
/esp-idf/components/bt/host/nimble/nimble/porting/nimble/include/os/os.h:34:19: error: expected unqualified-id before '(' token
#define max(a, b) ((a)>(b)?(a):(b))
                 ^
matter/src/lib/dnssd/Constants.h:90:48: note: in expansion of macro 'max'
constexpr size_t kSubTypeMaxNumber      = std::max(Operational::kSubTypeMaxNumber, Commission::kSubTypeMaxNumber);
                                              ^~~
/esp-idf/components/bt/host/nimble/nimble/porting/nimble/include/os/os.h:34:19: error: expected unqualified-id before '(' token
#define max(a, b) ((a)>(b)?(a):(b))
                 ^
matter/src/lib/dnssd/Constants.h:91:48: note: in expansion of macro 'max'
constexpr size_t kSubTypeMaxLength      = std::max(Operational::kSubTypeMaxLength, Commission::kSubTypeMaxLength);
                                              ^~~
/esp-idf/components/bt/host/nimble/nimble/porting/nimble/include/os/os.h:34:19: error: expected unqualified-id before '(' token
#define max(a, b) ((a)>(b)?(a):(b))
                 ^
matter/src/lib/dnssd/Constants.h:92:48: note: in expansion of macro 'max'
constexpr size_t kSubTypeTotalLength    = std::max(Operational::kSubTypeTotalLength, Commission::kSubTypeTotalLength);
                                              ^~~
matter/src/lib/dnssd/Advertiser.h: In member function 'Derived& chip::Dnssd::BaseAdvertisingParams<Derived>::SetMac(chip::ByteSpan)':
/esp-idf/components/bt/host/nimble/nimble/porting/nimble/include/os/os.h:30:19: error: expected unqualified-id before '(' token
#define min(a, b) ((a)<(b)?(a):(b))
                 ^
matter/src/lib/dnssd/Advertiser.h:84:27: note: in expansion of macro 'min'
       mMacLength = std::min(mac.size(), kMaxMacSize);
                         ^~~
matter/src/lib/dnssd/Advertiser.h: At global scope:
/esp-idf/components/bt/host/nimble/nimble/porting/nimble/include/os/os.h:34:19: error: expected unqualified-id before '(' token
#define max(a, b) ((a)>(b)?(a):(b))
                 ^
matter/src/lib/dnssd/Advertiser.h:143:55: note: in expansion of macro 'max'
   static constexpr uint8_t kTxtMaxKeySize    = std::max(kCommonTxtMaxKeySize, MaxKeyLen(TxtKeyUse::kCommission));
                                                     ^~~
/esp-idf/components/bt/host/nimble/nimble/porting/nimble/include/os/os.h:34:19: error: expected unqualified-id before '(' token
#define max(a, b) ((a)>(b)?(a):(b))
                 ^
matter/src/lib/dnssd/Advertiser.h:144:55: note: in expansion of macro 'max'
   static constexpr uint8_t kTxtMaxValueSize  = std::max(kCommonTxtMaxValueSize, MaxValueLen(TxtKeyUse::kCommission));
                                                     ^~~
In file included from matter/src/messaging/ExchangeMgr.h:33,
               from matter/src/app/util/util.h:21,
               from matter/examples/bridge-app/esp32/third_party/connectedhomeip/examples/platform/esp32/common/CommonDeviceCallbacks.cpp:36:
matter/src/messaging/ReliableMessageMgr.h:225:69: error: template argument 2 is invalid
   ObjectPool<RetransTableEntry, CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE> mRetransTable;
                                                                   ^
matter/src/messaging/ReliableMessageMgr.h: In member function 'void chip::Messaging::ReliableMessageMgr::EnumerateRetransTable(F&&)':
matter/src/messaging/ReliableMessageMgr.h:204:23: error: request for member 'ForEachActiveObject' in '((chip::Messaging::ReliableMessageMgr*)this)->chip::Messaging::ReliableMessageMgr::mRetransTable', which is of non-class type 'int'
       mRetransTable.ForEachActiveObject(std::forward<F>(functor));
                     ^~~~~~~~~~~~~~~~~~~
matter/examples/bridge-app/esp32/third_party/connectedhomeip/examples/platform/esp32/common/CommonDeviceCallbacks.cpp: In member function 'virtual void CommonDeviceCallbacks::DeviceEventCallback(const chip::DeviceLayer::ChipDeviceEvent*, intptr_t)':
matter/examples/bridge-app/esp32/third_party/connectedhomeip/examples/platform/esp32/common/CommonDeviceCallbacks.cpp:83:13: error: 'ble_hs_is_enabled' was not declared in this scope
       if (ble_hs_is_enabled())
           ^~~~~~~~~~~~~~~~~
matter/examples/bridge-app/esp32/third_party/connectedhomeip/examples/platform/esp32/common/CommonDeviceCallbacks.cpp:83:13: note: maximum limit of 1000 namespaces searched for 'ble_hs_is_enabled'
matter/examples/bridge-app/esp32/third_party/connectedhomeip/examples/platform/esp32/common/CommonDeviceCallbacks.cpp:83:13: note: suggested alternative: 'dhcps_dns_enabled'
       if (ble_hs_is_enabled())

It can be solved by direct include host/ble_hs.h in /examples/platform/esp32/common/CommonDeviceCallbacks.cpp

#define min
#define max
#include "host/ble_hs.h"
#undef min
#undef max

Looks like a bug

Bug prevalence

Every time during compilation

GitHub hash of the SDK that was being used

V1.0.0.1

Platform

esp32

Platform Version(s)

4.4.2

Anything else?

No response

@CrowdedFuzzball CrowdedFuzzball changed the title [BUG] Bridge example over Wi-Fi (CHIPoBLE disabled) seems to be broken [BUG] Bridge example over Wi-Fi (CHIPoBLE disabled) compilation error Dec 24, 2022
@bzbarsky-apple
Copy link
Contributor

@dhrishi @shubhamdp

@dhrishi
Copy link
Contributor

dhrishi commented Jan 6, 2023

Thanks for the tag @bzbarsky-apple

@CrowdedFuzzball We will check this

@PSONALl
Copy link
Contributor

PSONALl commented Jan 6, 2023

Hi @CrowdedFuzzball The above error occurs because the nimble related code gets compiled even when CHIPoBLE option is disabled
Added a fix here: #24303

@CrowdedFuzzball
Copy link
Author

Great, it works now!
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants