Repository navigation
SCONS_BUILD_FIX
This error occurs during PlatformIO's SCons build process when compiling painlessMeshSTA.cpp and similar files.
The following fixes have been applied to the painlessMesh library itself:
// src/painlessmesh/mesh.hpp
#include <vector> // Required for std::vector usageWhy: The mesh.hpp file uses std::vector but wasn't including the header, causing compilation errors.
{
"srcDir": "src",
"includeDir": "src"
}Why: Tells PlatformIO exactly where source files are located.
Before:
{
"export": {
"include": "src"
}
}After: (Removed completely)
Why: The export.include conflicts with srcDir and causes path resolution issues in SCons.
- ✅ All
.cppfiles insrc/directory - ✅
painlessMeshSTA.cppatsrc/painlessMeshSTA.cpp - ✅ No source files in root directory
- ✅ No duplicate
library.jsonfiles
- ✅
library.propertiesreferencespainlessMesh.h - ✅ Both
painlessMesh.handAlteriomPainlessMesh.havailable
If you're still getting errors, apply these fixes in YOUR project:
# Delete PlatformIO cache
pio run --target clean
# Or delete manually
rm -rf .pio
rm -rf .pioenvs
rm -rf .piolibdepsMake sure you're pulling the latest fixes:
[env:esp32]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps =
; Use the LATEST commit with fixes
https://github.com/Alteriom/painlessMesh#copilot/start-phase-2-implementation# Remove cached library
rm -rf .pio/libdeps/*/AlteriomPainlessMesh
# Or use PlatformIO's update command
pio pkg update# Check version
pio --version
# Update if needed (requires >= 6.0.0)
pip install -U platformio# List installed libraries
pio pkg list
# Remove any duplicate painlessMesh installations
pio pkg uninstall -g painlessMesh
pio pkg uninstall -g AlteriomPainlessMeshmkdir test-painlessmesh
cd test-painlessmesh
pio init --board esp32dev[env:esp32]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_deps =
https://github.com/Alteriom/painlessMesh#copilot/start-phase-2-implementation#include <Arduino.h>
#include <painlessMesh.h>
Scheduler userScheduler;
painlessMesh mesh;
void setup() {
Serial.begin(115200);
mesh.setDebugMsgTypes(ERROR | STARTUP);
mesh.init("TestMesh", "password", &userScheduler, 5555);
Serial.println("Mesh initialized!");
}
void loop() {
mesh.update();
}pio runExpected Output:
Building .pio/build/esp32/src/main.cpp.o
Building .pio/build/esp32/.pio/libdeps/esp32/AlteriomPainlessMesh/...
Linking .pio/build/esp32/firmware.elf
Building .pio/build/esp32/firmware.bin
SUCCESS
# Get verbose build output
pio run -v > build.log 2>&1
# Check library structure
cd .pio/libdeps/esp32/AlteriomPainlessMesh
ls -la
cat library.json1. Verify srcDir in downloaded library:
cd .pio/libdeps/esp32/AlteriomPainlessMesh
cat library.json | grep srcDir
# Should show: "srcDir": "src",2. Verify source files exist:
ls -la src/
# Should show: painlessMeshSTA.cpp, scheduler.cpp, wifi.cpp3. Check for duplicate files:
find . -name "painlessMeshSTA.cpp"
# Should only show: ./src/painlessMeshSTA.cpp4. Verify no export.include:
cat library.json | grep export
# Should show: (nothing) or not include "include": "src"- PlatformIO version >= 6.0.0
- Clean build cache (
pio run --target clean) - Remove
.piodirectory - Update library.json has
srcDirandincludeDir - No
export.includein library.json - All
.cppfiles insrc/directory - Force library re-download from GitHub
- Test with minimal example
- Check verbose build log for actual error
This error occurs in PlatformIO's SCons build system when:
- Path resolution fails: SCons can't determine the source directory
- Conflicting settings: Multiple directory specifications conflict
- Cache corruption: Old cached metadata from previous builds
-
Missing metadata: No
srcDirspecified in library.json
{
"name": "AlteriomPainlessMesh",
"srcDir": "src", // ← Explicit source directory
"includeDir": "src" // ← Explicit include directory
// "export": {...} // ← REMOVED (was causing conflicts)
}If issues persist after trying all fixes:
-
Check your build log:
pio run -v 2>&1 | tee build-verbose.log
-
Verify library was actually updated:
cd .pio/libdeps/YOUR_ENV/AlteriomPainlessMesh git log -1 --oneline # Should show recent commit with fixes
-
Try a completely fresh project:
- New directory
- Fresh
pio init - No existing
.piofolder - Copy minimal example above
-
Report issue with:
- PlatformIO version
- Platform (espressif32/espressif8266)
- Full build log
- Contents of
.pio/libdeps/*/AlteriomPainlessMesh/library.json
After applying fixes, your build should succeed with output like:
Dependency Graph
|-- AlteriomPainlessMesh @ 1.7.0
| |-- AsyncTCP @ 3.4.7
| |-- ArduinoJson @ 7.4.2
| |-- TaskScheduler @ 4.0.0
| |-- WiFi @ 2.0.0
Building .pio/build/esp32/lib/.../painlessMeshSTA.cpp.o
...
SUCCESS
Last Updated: October 15, 2025
Library Version: 1.7.0
Branch: copilot/start-phase-2-implementation
Status: ✅ SCons build issues resolved