esp8266 / Arduino

ESP8266 core for Arduino
GNU Lesser General Public License v2.1
15.99k stars 13.34k forks source link

SoftwareSerial.h ssize_t undefined #6482

Closed offcircuit closed 5 years ago

offcircuit commented 5 years ago

Hi,

I dont know if this is a bug

SoftwareSerial.h

line 113

ifndef ESP32

ssize_t m_swsInstsIdx = -1; <---- this should be size_t m_swsInstsIdx

endif

I found this at

file C:\Users\offcircuit\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.5.2\libraries\SoftwareSerial\src/SoftwareSerial.h

dowloaded from

http://arduino.esp8266.com/stable/package_esp8266com_index.json

error

In file included from sketch\Nextion.h:7:0,

         from sketch\Nextion.cpp:1:

C:\Users\offcircuit\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.5.2\libraries\SoftwareSerial\src/SoftwareSerial.h:113:2: error: 'ssize_t' does not name a type

ssize_t m_swsInstsIdx = -1;

^

exit status 1 Erro ao compilar para a placa LOLIN(WEMOS) D1 R2 & mini.

Thanks, Helder Rodrigues

d-a-v commented 5 years ago

cc @dok-net

earlephilhower commented 5 years ago

ssize_t is legal and a signed-size type, size_t is unsigned, so it's not a matter of a typo there.

This sounds like just a case of a missing #include <sys/types.h> in SioftwareSerial.h

Romocitto commented 5 years ago

I found the same error, solved adding #include <sys/types.h> in SioftwareSerial.h Thx @earlephilhower!

earlephilhower commented 5 years ago

@Romocitto or @offcircuit , please open a bug at the repo we're pulling SWSerial from? We don't change anything here, just reference it.

https://github.com/plerup/espsoftwareserial

Closing here, since it's not something we control.

earlephilhower commented 5 years ago

On second thought, let us keep this open here as a reminder to pull in the update to @plerup's repo when he addresses this.

dok-net commented 5 years ago

@earlephilhower This is all quite confusing. This and other compilation errors are ocurring only on some combinations of (ancient, counting by months) versions of EspSoftwareSerial and/or ESP8266 Arduino. Library dependencies are a very new feature of the Arduino library manager; I am not aware that there is yet a way to tag a dependency on BSP versions. Maybe it's all my fault by "releasing" (tagging as such in GitHub) versions of EspSoftwareSerial that rely on ESP8266 Arduino master HEAD, but somehow I suspect that supporting not just ESP8266, but also ESP32, both with there own release cadences, will sooner or later leave the user responsible for cobbling together BSPs and libraries that match over and again anyhow. I must leave devising a fix to this riddle to someone else in the community, please PR either ESP8266 Arduino, EspSoftwareSerial, or both. I'll keep closing issues of this sort in the EspSoftwareSerial repo with wontfix - if only because I don't know if releasing patched, backward versions, tagged in GitHub, is any use to the Arduino library manager.

earlephilhower commented 5 years ago

@dok-net, a user should not be using library manager to get SWSerial. It's part of the GIT repo as a submodule, so it's actually checked out in the git core tree. Use the web interface, you can see the actual git rev, and that it's coming from plreup's repo, not yours. So the change would need to be in his git repo, not your fork.

The user reported this path as the error: C:\Users\offcircuit\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.5.2\libraries\SoftwareSerial\src/SoftwareSerial.h So that's the correct location.

dok-net commented 5 years ago

Dear @earlephilhower, names can be misleading... the current developer and one active maintainer of https://github.com/plerup/espsoftwareserial/, is... well, look closer... hint... you've just kind of p*** him off ;-)

earlephilhower commented 5 years ago

Ah, I looked at the URL and owner, not at the commit log. Sorry, mate!

Anyway, they're not using the lib manager to install the repo, it's the version included in the release.zip from esp8266 as far as I can see. Maybe they're using it in a way that isn't standard, so it is included before an Arduino.h or something, so ssize_t isn't defined yet.

If the ssize thing was fixed after 2.5.2, then this can be closed. But I don't see sys/types.h included anywhere on my quick perusal. Just adding it to the main header and bumping the git reference in the 8266 tree here (w/a PR here) would take care of it, no?

dok-net commented 5 years ago

ssize_t was dropped some time ago, probably in conjunction with the acceptance of the attachInterruptArg() PR.

6526 should make things consistent for the next ESP8266 Arduino release.

I've not added another include, as there were no reports concerning size_t (only the disused ssize_t).

earlephilhower commented 5 years ago

Ah, got it. Then, @offcircuit , you need to pull the latest GIT head for the ESP8266 Arduino repo, then do a "git submodule init; git submodule update" because it looks like you have a repo that's not quite git head and not quite an official release 2.5.2.

Closing, there's nothing to do here.