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

Fails to compile on Particle.io WebIDE #1073

Closed
shanevanj opened this issue Aug 13, 2019 · 6 comments
Closed

Fails to compile on Particle.io WebIDE #1073

shanevanj opened this issue Aug 13, 2019 · 6 comments
Labels

Comments

@shanevanj
Copy link

Fails to compile on Particle.io WebIDE

Error on WebIDE is
lib/ArduinoJson/ArduinoJson/Strings/SizedFlashStringAdapter.hpp:19:69: 'strncmp_P' was not declared in this scope

Particle.io WebIDE target device Gen3 Mesh (Argon or Xenon)
Library version ArduinoJson (6.11.4)

Reproduce
Open WebIDE
Select libraries, Search ArduinoJSON, select JsonParserExample.ino then select USE THIS EXAMPLE
Compile the App and error is produced

@bblanchon
Copy link
Owner

Hi @shanevanj,

Thank you for reporting this.

It seems to be a regression introduced by #1071.
I guess that Particle defines PROGMEM but doesn't implement the strncmp_P().
I wish we had a Continuous Integration for Particle, but I tried and it seemed impossible.

As a workaround, you can define ARDUINOJSON_ENABLE_PROGMEM to 0, or roll back to 6.11.3.

Best Regards,
Benoit

@bblanchon bblanchon added the bug label Aug 13, 2019
@bblanchon
Copy link
Owner

@shanevanj
Copy link
Author

you can define ARDUINOJSON_ENABLE_PROGMEM to 0, or roll back to 6.11.3.

Thanks I tried both

#include "Arduino.h"
#include <Particle.h>

#define ARDUINOJSON_ENABLE_PROGMEM 0

and

Included libraries

ArduinoJson (6.11.3)
LiquidCrystal_I2C_Spark (1.1.0)
MQTT (0.4.29)
PollingTimer (1.3.0)
PublishQueueAsyncRK (0.0.5)

and the compile still fails with same error - I guess its because the entry is missing in https://github.com/particle-iot/device-os/blob/1b1805fb4afcb93b0e92fbecfd28c082d6310285/wiring/inc/spark_wiring_arduino.h

I edited the same file on my local workbench install ( added in the strncmp_P() ) and the code compiles locally okay.

I have raised a bug request on particle (https://github.com/particle-iot/device-os/issues/1884) which they are now arguing about.

If I insert this the .h file above where the <ArduinoJson.h> is first used it compiles

#ifndef strncpy_P
#define strncpy_P strncpy
#endif

#ifndef strncmp_P
#define strncmp_P strncmp
#endif

#define ARDUINOJSON_ENABLE_PROGMEM 0

@bblanchon
Copy link
Owner

Hi @shanevanj,

Thanks for the update.

You must define ARDUINOJSON_ENABLE_PROGMEM before including ArduinoJson.h (be careful because the Web IDE insert #include statements at the top of the file); I checked, and it works.

You're right about 6.11.3: it doesn't work either.
That's good news because it means it's not a regression from #1071

Thanks for opening a bug request on Particle.
I'll continue to work on a workaround on my side: I'll try to detect when the PROGMEM macro is empty.

Best Regards,
Benoit

@shanevanj
Copy link
Author

Thanks for your patience ! - issue closed on particle with comment that

<Arduinio.h>

#define PARTICLE_WIRING_ARDUINO_COMPATIBILTY 1

must be included before any PROGMEM dependant code.

Regards Shane

@bblanchon
Copy link
Owner

A fix is included in ArduinoJson 6.11.5

Repository owner locked and limited conversation to collaborators Sep 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants