-
Notifications
You must be signed in to change notification settings - Fork 192
Compile error for ESP32C3 #480
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
Comments
@justind000 I will need to look into this very carefully. Is it a simple type inference order difference or are there other reasons? |
My guess was that the IPAddress constructor definition changed somewhere; adding or dropping some constructor that made passing 0U ambiguous to the compiler. I didn't compare previous/past versions or core files to confirm. |
I don't think so; in 2.0.3-rc1, there are no changes in the core On the other hand, there is no constructor originally defined for the IPAddress class that takes only one In other words, it is not appropriate to call the constructor with a
And
This deployment by Espressif SDK follows the same approach as up to ESP32-S2. However, they have changed to a different deployment method to support ESP-C3, even though ESP-C3 also has the same RISC architecture as ESP-S2. ESP-IDF4.4 is accompanied by these breaking changes. It is at the expense of backward compatibility. I suspect that the equivalence of You have identified a similar issue in the ESPAyncWebServer library. And PR to fix, which is a cast to uint32_t, has not yet been merged. So I suspect that things are not so simple. But maybe it is a simple matter of |
Perhaps (uint32_t) will just have to be a crude workaround of Espressif's "sort it out later" attitude they have taken to their SDK. |
@justind000 I deployed the ESP-IDF tool chain to explore the source of this phenomenon. As I thought, the type alias in the ESP-IDF RISC-V based tool chain is different with
During the course of the research, I found out the approach esp-idf has adopted in supporting ESP32-C3. Their priority was to ensure the continued compatibility of the RISC-V tool-chain. That makes sense. Many Arduino libraries assume that uint32_t will be assigned to an unsigned int. That is never a good practice (including AutoConnect). However, the most stable solution may not be to wait for individual library fixes. To override the type with a tweak that is only available at Arudino build time. |
Well I see it is a bit more involved than a changed definition. I will leave it up to you to decide the best course for your library and keep some note for next time I get a -C3 compile error. |
@justind000 In the end, it seems that the alias definition of uint32_t in the riscv-32 toolchain will still settle on unsigned long. So, I decided to rely on forced type matching by casting for the 32-bit signature of IPAddress. After all, your outlook was the least risky way. I will release AutoConnect v1.3.5 soon, which will include ESP32-C3 support. You can pre-verify it in the enhance/v135 branch. Thank you for your contribution. |
I guess this is a case of technically-correct versus popularly-correct. |
With the most recent ESP32 core (2.0.3-RC1), there are compile errors when compiling for ESP32C3. I haven't tried with different core versions.
Full error log here
Relevant error is
AutoConnect.h:94:12: error: call of overloaded 'IPAddress(unsigned int)' is ambiguous dns2(0U) {}
A quick search shows this error has come up for another library as well with no upstream fix yet.
Fix is to change AutoConnect.h lines 90-94 and 134-138 by adding a typecast.
staip(0U), staGateway(0U), staNetmask(0U), dns1(0U), dns2(0U) {}
to
staip((uint32_t)0U), staGateway((uint32_t)0U), staNetmask((uint32_t)0U), dns1((uint32_t)0U), dns2((uint32_t)0U) {}
The text was updated successfully, but these errors were encountered: