Skip to content

EthernetServer Error #88

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

Closed
esfx14 opened this issue Jan 18, 2019 · 13 comments
Closed

EthernetServer Error #88

esfx14 opened this issue Jan 18, 2019 · 13 comments
Labels
conclusion: off topic Off topic for this repository topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@esfx14
Copy link

esfx14 commented Jan 18, 2019

Board: Adafruit ESP Feather with Ethernet FeatherWing
Upload Speed: 115200
Flash Frequency: 80 MHz

I need this EthernetServer thing to work for my programm, but even this small one here does not work and I am not able to find out what I did wrong.

#include <Arduino.h>
#include <Ethernet.h>
EthernetServer server(80);
void setup() {
  // put your setup code here, to run once:
}
void loop() {
  // put your main code here, to run repeatedly:
}
sketch_jan17c:4:16: error: cannot declare variable 'server' to be of abstract type 'EthernetServer'

 EthernetServer server(80);

                ^

In file included from C:\Users\Documents\Arduino\sketch_jan17c\sketch_jan17c.ino:2:0:

C:\Users\Documents\Arduino\libraries\Ethernet\src/Ethernet.h:253:7: note:   because the following virtual functions are pure within 'EthernetServer':

 class EthernetServer : public Server {

       ^

In file included from C:\Users\Documents\ArduinoData\packages\esp32\hardware\esp32\1.0.1\cores\esp32/Arduino.h:158:0,

                 from C:\Users\Documents\Arduino\sketch_jan17c\sketch_jan17c.ino:1:

C:\Users\Documents\ArduinoData\packages\esp32\hardware\esp32\1.0.1\cores\esp32/Server.h:28:18: note: 	virtual void Server::begin(uint16_t)

     virtual void begin(uint16_t port=0) =0;

                  ^
@taylor-an
Copy link
Contributor

Hello esfx14,

How about execute any example on arduino IDE ?

cap 2019-01-18 17-03-05-426

@esfx14
Copy link
Author

esfx14 commented Jan 18, 2019

I've tried a few. Same problem everywhere where EthernetServer exists.

@PaulStoffregen
Copy link
Contributor

Try selecting "Arduino/Genuino Uno" in Tools > Boards. Do you get the same error if you click Verify for Uno?

@esfx14
Copy link
Author

esfx14 commented Jan 18, 2019

It's okay for this one. Maybe this part does not work for my kind of board ?

@PaulStoffregen
Copy link
Contributor

Use the boards manager. Which version of ESP32 do you have installed? Maybe upgrading or reverting to a different version will solve the compatibility problem?

If you discover which version do and don't work, please share... so maybe someone can look into what went wrong (if newer fail) and fix for everyone else.

@esfx14
Copy link
Author

esfx14 commented Jan 18, 2019

First I used version 1.0.1 and now tried 1.0.0. Neither of them works. More versions are not available.

@per1234
Copy link
Contributor

per1234 commented Jan 18, 2019

Here's the breaking change in the esp32 core: espressif/arduino-esp32@a59eafb
That mega-commit is a squash-merge of the PR: espressif/arduino-esp32#1539
The relevant commit in that PR is: espressif/arduino-esp32@5d15850


A workaround is to change line 28 of the ESP32 core's Server.h from:

    virtual void begin(uint16_t port=0) =0;

To:

    virtual void begin() =0;

However, that will break anything that uses the ESP32 WiFi library's WebServer class.

@esfx14
Copy link
Author

esfx14 commented Jan 18, 2019

Thanks. It works now.

@esfx14 esfx14 closed this as completed Jan 18, 2019
@per1234
Copy link
Contributor

per1234 commented Jan 18, 2019

I'm glad to hear it's working for you. Certainly my workaround is not to be considered a resolution of the issue.

The question is how can this issue truly be resolved? Since Server.h is part of the standard Arduino API, it seems that it should be fixed in the ESP32 core. Hopefully, they will eventually start using ArduinoCore-api. If so, they will need to work with the standard signature for this function then anyway.

@PaulStoffregen
Copy link
Contributor

I really do not see how the Arduino API stuff will help, if it exists as an advisory document rather than a mandatory compiler step which causes warnings or errors visible to users when using the default settings (no warnings shown).

@per1234
Copy link
Contributor

per1234 commented Jan 18, 2019

Maybe I don't understand you. I apologize in advance if the following completely misses the mark in addressing what you said:

The ArduinoCore-api repository contains the result of Project Chainsaw. This separates all the non-architecture specific code out of the core libraries so that the same code can be shared by all cores. This makes it much easier to maintain that code. The hope is that ArduinoCore-api will be used by the 3rd party hardware package authors in addition to its use by the official Arduino hardware packages. ArduinoCore-api is already in use in the Arduino megaAVR Boards package.

Server.h is part of ArduinoCore-api. If Arduino core for the ESP32 eventually switches to using ArduinoCore-api, they will be using the official Server.h, rather than their non-standard Server.h.

@PaulStoffregen
Copy link
Contributor

PaulStoffregen commented Jan 18, 2019

Ok, I'll admit, this is my cynical mode...

Look, if every core library (Arduino's and all 3rd party including ESP32's until recently) currently has "virtual void begin() =0", and a project like ESP32 decides they want to change to "virtual void begin(uint16_t port=0) =0", without any apparent care or concern it'll break other libs, what good is yet another copy of the exact same code in yet another github repository going to do?

Likewise for another copy of this code in a subdirectory under Arduino's core lib? If a software developer is already willing to veer off the long-established Server.h API, how is having another copy of it within Arduino's core library going to influence the ESP32 developers to strive for compatibility?

@per1234
Copy link
Contributor

per1234 commented Jan 18, 2019

If they're using the code from ArduinoCore-api, the only way they can change that code is to submit a PR to the ArduinoCore-api, where it will be reviewed well enough that a breaking change like this will not get through.

They can still break compatibility of the architecture-specific parts of the core library that can't be in ArduinoCore-api, but at least this encourages standardization of some of the core API.

Even if the 3rd party hardware package authors don't see a benefit in that, I think they will still see the benefit in having a lot of their core code written and maintained for them. This is especially true for people creating new hardware packages.

Contributors benefit by being able to submit a PR to a single repository and having that change propagate across all participating hardware packages after it's merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: off topic Off topic for this repository topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

4 participants