Create an empty sketch (doesn’t matter if Particle Dev or VS Code)
Use the Particle Libraries GUI (Particle Dev) or Particle: Install Library (VS Code) to install libraries “SDFat” and “MQTT-TLS”
Compile for any device or firmware.
Problem description:
Cloud Api Compile call returns the following error payload immediately:
{ ok: false,
code: 200,
output: 'Compiler timed out or encountered an error',
stdout: '',
errors: [] }
It will compile with either library but not both. If I use the toolchain to compile locally, it compiles with no errors.
My suspicion is that there is an issue with flattening out the file maps and duplicate file names or definitions somewhere, but regardless of the issue there should be a specific error message to enable fixing the issue.
hm. total long-shot but try this when you get a minute: in Workbench after you’ve run the Particle: Install Library command, open your project.properties file and delete the dependencies.xxxxx=n.n.n lines (remember to put them back when you are done). now try running the Particle: Cloud Compile command.
That is a possibility. There is a maximum size to an API command payload, and it could be that the two libraries together with the source exceed that limit. That would explain why the failure is immediate - it’s getting rejected on the compile API request, not during compilation.
@m_m I had previously tried that to no avail, just tried again, same thing. Plus, in my sample scenario using Particle Dev, the dependencies aren’t relevant. This also happens if I just copy paste in the libraries and not add with the tool.
@rickkas7 I doesn’t appear to be so. I changed the MQTT-TLS library to MQTT and then added a crap ton of other libraries. Before, MQTT-TLS + SDFat = ~700KB. With the other libraries total size was ~2MB, but compiled fine. EDIT: I haven’t actually checked the packet size with wireshark yet, I’ll confirm the filesize of the actual packet.
Since the libraries are copied into your project from the repo, the examples are copied too and that throws off the cloud compiler due to multiple sets of setup()/loop() in one project.
Remove the examples folders from both libraries.
So you’re partially right - the issue appears specific to having both libraries’ example files included. Either one by itself works fine. Having both the compiler errors out. Having examples in the libraries isn’t normally an issue, regardless of whether they are .ino or .cpp files.
Renaming the MQTT-TLS examples to .cpp didn’t do anything (so probably not a preprocessor issue. All the SDFat examples are already .cpp files.
So this is now at pretty much full wth level. Even both MQTT-TLS examples are commented fully out, the compiler still errors out. If I change the file extension to something bogus (.fake) there is no issue. If I delete all the comments, it compiles ok. If I delete one of the example files, comment the other one out, and then copy the following three lines into a .cpp file anywhere it errors out:
I’ll put it this way, the fact that changing comments alters behavior here indicates that there is an issue somewhere outside of the preprocessor and outside of the compiler itself. Something in the way those two things are being called, or files are being handled.
It seems like the next step would be for someone at particle to run their Cloud API locally with the breaking test case like I detailed in the first post and figure out where in their code it is erroring out.
I’d do it myself but I didn’t see any of that code online so I assume it’s more proprietary / not open source.
If anyone has ideas for what I can try locally I’m game, but this feels like something that should be looked into by someone with access to the API code.
Update, I tried removing the examples from all the libraries in my main firmware project (not the test proj I have been working on for debugging this issue. And I still get the same undefined error. I assume they are related, so I think the solution is still to dig into the API code and debug on the Particle end, but wanted to throw that data point out there - I still can’t cloud compile my primary firmware.