Compile failed: "Compile input not allowed"

Hi all - I'm working on an Argon project I've been successfully using for a while now.

I can compile and flash locally no problem, but it fails when trying to do a cloud flash with the error:

MacBookPro:inverter_monitor chris$ particle compile argon . --target 6.4.1
Compiling code for argon
Targeting version: 6.4.1

Including:
    lib/BackgroundPublishRK/src/BackgroundPublishRK.cpp
    lib/BackgroundPublishRK/src/BackgroundPublishRK.h
    lib/LocalTimeRK/src/LocalTimeRK.cpp
    lib/LocalTimeRK/src/LocalTimeRK.h
    lib/ModbusMaster-Particle/src/ModbusMaster-Particle.cpp
    lib/ModbusMaster-Particle/src/ModbusMaster-Particle.h
    lib/ModbusMaster-Particle/src/ModbusMaster-Particle/ModbusMaster-Particle.h
    lib/ModbusMaster-Particle/src/util/arduino-electron-fixes.h
    lib/ModbusMaster-Particle/src/util/crc16.h
    lib/ModbusMaster-Particle/src/util/word.h
    lib/PublishQueuePosixRK/src/PublishQueuePosixRK.cpp
    lib/PublishQueuePosixRK/src/PublishQueuePosixRK.h
    lib/SequentialFileRK/src/SequentialFileRK.cpp
    lib/SequentialFileRK/src/SequentialFileRK.h
    project.properties
    src/inverter_monitor.ino

Compile failed: Compile input not allowed

But local compile is fine:

MacBookPro:inverter_monitor chris$ particle compile argon . --compiler local --target 6.4.1
Compiling code for argon

Including:
    lib/BackgroundPublishRK/src/BackgroundPublishRK.cpp
    lib/BackgroundPublishRK/src/BackgroundPublishRK.h
    lib/LocalTimeRK/src/LocalTimeRK.cpp
    lib/LocalTimeRK/src/LocalTimeRK.h
    lib/ModbusMaster-Particle/src/ModbusMaster-Particle.cpp
    lib/ModbusMaster-Particle/src/ModbusMaster-Particle.h
    lib/ModbusMaster-Particle/src/ModbusMaster-Particle/ModbusMaster-Particle.h
    lib/ModbusMaster-Particle/src/util/arduino-electron-fixes.h
    lib/ModbusMaster-Particle/src/util/crc16.h
    lib/ModbusMaster-Particle/src/util/word.h
    lib/PublishQueuePosixRK/src/PublishQueuePosixRK.cpp
    lib/PublishQueuePosixRK/src/PublishQueuePosixRK.h
    lib/SequentialFileRK/src/SequentialFileRK.cpp
    lib/SequentialFileRK/src/SequentialFileRK.h
    project.properties
    src/inverter_monitor.cpp
    src/inverter_monitor.ino

Targeting version: 6.4.1


:::: COMPILING APPLICATION

Creating /Users/chris/development/inverter_monitor/target/6.4.1/argon/platform_user_ram.ld ...
Creating /Users/chris/development/inverter_monitor/target/6.4.1/argon/platform_user_ram.ld ...
   text	   data	    bss	    dec	    hex	filename
  34504	    178	   1260	  35942	   8c66	/Users/chris/development/inverter_monitor/target/6.4.1/argon/inverter_monitor.elf

*** COMPILED SUCCESSFULLY ***


Compile succeeded.

Saved firmware to: /Users/chris/development/inverter_monitor/argon_firmware_1793216510087.bin

...and of course:

MacBookPro:inverter_monitor chris$ particle --version

3.52.3

Any ideas?

There is a problem with the ModbusMaster-Particle library that is triggering one of the validation checks for cloud compiles. Those checks are not done for local builds.

The issue is being investigated, but I don't have a timeline for resolution.

As always, thanks Rick! If it helps, I was able to cloud flash yesterday or day before - so this issue is something very recent.

Further update - I was able to manually copy my source out of VSCode/workbench and into the Particle Web IDE.

After including the dependent libraries in the Web IDE (Modbus-Master-Particle, PublishQueuePosixRK, LocalTimeRK), I was able to cloud compile and cloud flash to the Argon without error via the Web IDE.

Trying to do same in VSCode/workbench still produces a "Compile input not allowed" error. So I'm curious if the issue really is with the Modbus-Master-Particle library or workbench<->cloud calls?

I noticed that my local-dependency libraries were behind the Web IDE ones, so I removed and reinstalled the local copies, did an app clean, and local compile works fine as before. Cloud compile still fails, as before.

I did a little investigation. It's easily solvable, scroll to the end for the solution.

I created a new project in Workbench using Particle: Create New Project and used Particle: Install Library to install ModbusMaster-Particle.

Added this to the main application file (it was ModbusTest.cpp for my test):

#include "ModbusMaster-Particle.h"

I was building with Device OS 6.6.0 for Photon 2, but it doesn't particularly matter.

With this configuration:

  • Cloud compile fails with "Compile failed: Compile input not allowed"
  • Local compile works

When you Particle: Install Library it actually does two things: Adds the dependency to project.properties, and downloads the source to the lib directory in your project.

I then moved the local copy out of the way so cloud compile would only use the library version:

mv lib .ignore-lib

I was then able to cloud compile, both the Particle: Cloud Compile and also using:

particle compile p2 . --saveTo firmware.bin --target 6.6.0

The Workbench cloud compile really just calls the Particle CLI, so I would expect them to behave the same way.

I then moved the local copy back to see what was the cause.

mv .ignore-lib lib

To be fair, I happened to know what the internal error was, so this wasn't a complete guess, but all I needed to do was delete the ModbusMaster-Particle directory inside lib/ModbusMaster-Particle/src and I was able to build both cloud and local.

The reason it fails is that the inner ModbusMaster-Particle.h references a file that does not exist in the upload. The .h inner file includes "../ModbusMaster.h" but the file is really "../ModbusMaster-Particle.h" which is probably a porting error. In any case, that inner .h file isn't used and never really worked so deleting it is fine.

The reason for the check is that relative includes are sanitized to make sure they don't reference files outside of the upload for security reasons.