Skip to content

SoftwareSerial.h ssize_t undefined #6482

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
offcircuit opened this issue Sep 3, 2019 · 11 comments
Closed

SoftwareSerial.h ssize_t undefined #6482

offcircuit opened this issue Sep 3, 2019 · 11 comments

Comments

@offcircuit
Copy link

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
Copy link
Collaborator

d-a-v commented Sep 3, 2019

cc @dok-net

@earlephilhower
Copy link
Collaborator

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

@earlephilhower earlephilhower changed the title I belive you got a bug... SoftwareSerial.h ssize_t undefined Sep 3, 2019
@Romocitto
Copy link

Romocitto commented Sep 12, 2019

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

@earlephilhower
Copy link
Collaborator

@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
Copy link
Collaborator

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
Copy link
Contributor

dok-net commented Sep 12, 2019

@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
Copy link
Collaborator

@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
Copy link
Contributor

dok-net commented Sep 15, 2019

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
Copy link
Collaborator

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
Copy link
Contributor

dok-net commented Sep 15, 2019

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
Copy link
Collaborator

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.

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

No branches or pull requests

5 participants