platformio / platform-atmelsam

Atmel SAM: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/atmelsam
Apache License 2.0
82 stars 108 forks source link

Missing `Print.h` and other headers when building libraries #134

Closed bazfp closed 3 years ago

bazfp commented 3 years ago

This was working fine on my Windows machine, but I've recently tried building my project fresh on my Linux machine and it is refusing to build due to missing files like Print.h and others. I suspect this is due to a missing include directory

/.platformio/packages/framework-arduino-samd/cores/arduino/api

platformio.ini

[env:zeroUSB]
platform = atmelsam
board = zeroUSB
framework = arduino
lib_deps = 
    sparkfun/SparkFun LSM6DS3 Breakout@^1.0.0
    arduino-libraries/Arduino Low Power@^1.2.1
    javos65/WDTZero@^1.3.0
    bakercp/CRC32@^2.0.0
    mikalhart/TinyGPSPlus@^1.0.2
    arduino-libraries/SD@^1.2.4
; Uncomment Below to fix builds
;build_flags =
;  -I/home/user/.platformio/packages/framework-arduino-samd/cores/arduino/api

Adding the missing directory above to my build flag includes resolves this?


> Executing task in folder firmware: pio run <

Processing zeroUSB (platform: atmelsam; board: zeroUSB; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelsam/zeroUSB.html
PLATFORM: Atmel SAM (5.0.2) > Arduino Zero (USB Native Port)
HARDWARE: SAMD21G18A 48MHz, 32KB RAM, 256KB Flash
DEBUG: Current (atmel-ice) External (atmel-ice, blackmagic, jlink)
PACKAGES: 
 - framework-arduino-samd 1.8.10 
 - framework-cmsis 1.40500.0 (4.5.0) 
 - framework-cmsis-atmel 1.2.0 
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 19 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <SparkFun LSM6DS3 Breakout> 1.0.0
|   |-- <SPI> 1.0
|   |-- <Wire> 1.0
|-- <Arduino Low Power> 1.2.2
|   |-- <RTCZero> 1.6.0
|-- <WDTZero> 1.3.0
|-- <CRC32> 2.0.0
|-- <TinyGPSPlus> 1.0.2
|-- <SD> 1.2.4
|   |-- <SPI> 1.0
|-- <SDU> 1.0.0
|-- <SPI> 1.0
|-- <Wire> 1.0
Building in release mode
Compiling .pio/build/zeroUSB/src/main.cpp.o
Archiving .pio/build/zeroUSB/lib2a2/libSPI.a
In file included from /home/user/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd21/include/samd21.h:69:0,
                 from /home/user/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd.h:105,
                 from /home/user/.platformio/packages/framework-arduino-samd/cores/arduino/Arduino.h:34,
                 from include/a9g.h:3,
                 from src/main.cpp:15:
/home/user/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd21/include/samd21g18a.h:226:0: warning: "LITTLE_ENDIAN" redefined
 #define LITTLE_ENDIAN          1

In file included from /home/user/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/sys/types.h:67:0,
                 from /home/user/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/stdio.h:61,
                 from /home/user/.platformio/packages/framework-arduino-samd/cores/arduino/api/Print.h:22,
                 from /home/user/.platformio/packages/framework-arduino-samd/cores/arduino/api/ArduinoAPI.h:31,
                 from /home/user/.platformio/packages/framework-arduino-samd/cores/arduino/Arduino.h:23,
                 from include/a9g.h:3,
                 from src/main.cpp:15:
/home/user/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/machine/endian.h:17:0: note: this is the location of the previous definition
 #define LITTLE_ENDIAN _LITTLE_ENDIAN

Indexing .pio/build/zeroUSB/lib2a2/libSPI.a
Archiving .pio/build/zeroUSB/lib11e/libWire.a
Indexing .pio/build/zeroUSB/lib11e/libWire.a
Archiving .pio/build/zeroUSB/libf71/libSparkFun LSM6DS3 Breakout.a
In file included from .pio/libdeps/zeroUSB/SD/src/SD.h:20:0,
                 from src/main.cpp:29:
.pio/libdeps/zeroUSB/SD/src/utility/SdFat.h:31:10: fatal error: Print.h: No such file or directory

***************************************************************
* Looking for Print.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:Print.h"
* Web  > https://platformio.org/lib/search?query=header:Print.h
*
***************************************************************

 #include <Print.h>
          ^~~~~~~~~
compilation terminated.
Indexing .pio/build/zeroUSB/libf71/libSparkFun LSM6DS3 Breakout.a
Archiving .pio/build/zeroUSB/lib824/libRTCZero.a
Indexing .pio/build/zeroUSB/lib824/libRTCZero.a
Archiving .pio/build/zeroUSB/lib133/libArduino Low Power.a
Indexing .pio/build/zeroUSB/lib133/libArduino Low Power.a
Archiving .pio/build/zeroUSB/libb88/libWDTZero.a
Indexing .pio/build/zeroUSB/libb88/libWDTZero.a
Archiving .pio/build/zeroUSB/lib051/libCRC32.a
Indexing .pio/build/zeroUSB/lib051/libCRC32.a
Archiving .pio/build/zeroUSB/lib87b/libTinyGPSPlus.a
Indexing .pio/build/zeroUSB/lib87b/libTinyGPSPlus.a
Compiling .pio/build/zeroUSB/lib6b9/SD/File.cpp.o
Compiling .pio/build/zeroUSB/lib6b9/SD/SD.cpp.o
Compiling .pio/build/zeroUSB/lib6b9/SD/utility/Sd2Card.cpp.o
In file included from /home/user/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd21/include/samd21.h:69:0,
                 from /home/user/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd.h:105,
                 from /home/user/.platformio/packages/framework-arduino-samd/cores/arduino/Arduino.h:34,
                 from .pio/libdeps/zeroUSB/SD/src/SD.h:18,
                 from .pio/libdeps/zeroUSB/SD/src/SD.cpp:53:
/home/user/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd21/include/samd21g18a.h:226:0: warning: "LITTLE_ENDIAN" redefined
 #define LITTLE_ENDIAN          1

In file included from /home/user/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/sys/types.h:67:0,
                 from /home/user/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/stdio.h:61,
                 from /home/user/.platformio/packages/framework-arduino-samd/cores/arduino/api/Print.h:22,
                 from /home/user/.platformio/packages/framework-arduino-samd/cores/arduino/api/ArduinoAPI.h:31,
                 from /home/user/.platformio/packages/framework-arduino-samd/cores/arduino/Arduino.h:23,
                 from .pio/libdeps/zeroUSB/SD/src/SD.h:18,
                 from .pio/libdeps/zeroUSB/SD/src/SD.cpp:53:
/home/user/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/machine/endian.h:17:0: note: this is the location of the previous definition
 #define LITTLE_ENDIAN _LITTLE_ENDIAN

In file included from /home/user/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd21/include/samd21.h:69:0,
                 from /home/user/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd.h:105,
                 from /home/user/.platformio/packages/framework-arduino-samd/cores/arduino/Arduino.h:34,
                 from .pio/libdeps/zeroUSB/SD/src/SD.h:18,
                 from .pio/libdeps/zeroUSB/SD/src/File.cpp:15:
/home/user/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd21/include/samd21g18a.h:226:0: warning: "LITTLE_ENDIAN" redefined
 #define LITTLE_ENDIAN          1

In file included from /home/user/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/sys/types.h:67:0,
                 from /home/user/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/stdio.h:61,
                 from /home/user/.platformio/packages/framework-arduino-samd/cores/arduino/api/Print.h:22,
                 from /home/user/.platformio/packages/framework-arduino-samd/cores/arduino/api/ArduinoAPI.h:31,
                 from /home/user/.platformio/packages/framework-arduino-samd/cores/arduino/Arduino.h:23,
                 from .pio/libdeps/zeroUSB/SD/src/SD.h:18,
                 from .pio/libdeps/zeroUSB/SD/src/File.cpp:15:
/home/user/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/machine/endian.h:17:0: note: this is the location of the previous definition
 #define LITTLE_ENDIAN _LITTLE_ENDIAN

In file included from /home/user/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd21/include/samd21.h:69:0,
                 from /home/user/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd.h:105,
                 from /home/user/.platformio/packages/framework-arduino-samd/cores/arduino/Arduino.h:34,
                 from .pio/libdeps/zeroUSB/SD/src/utility/Sd2Card.cpp:21:
/home/user/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd21/include/samd21g18a.h:226:0: warning: "LITTLE_ENDIAN" redefined
 #define LITTLE_ENDIAN          1

In file included from /home/user/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/sys/types.h:67:0,
                 from /home/user/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/stdio.h:61,
                 from /home/user/.platformio/packages/framework-arduino-samd/cores/arduino/api/Print.h:22,
                 from /home/user/.platformio/packages/framework-arduino-samd/cores/arduino/api/ArduinoAPI.h:31,
                 from /home/user/.platformio/packages/framework-arduino-samd/cores/arduino/Arduino.h:23,
                 from .pio/libdeps/zeroUSB/SD/src/utility/Sd2Card.cpp:21:
/home/user/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/machine/endian.h:17:0: note: this is the location of the previous definition
 #define LITTLE_ENDIAN _LITTLE_ENDIAN

In file included from .pio/libdeps/zeroUSB/SD/src/SD.h:20:0,
                 from .pio/libdeps/zeroUSB/SD/src/SD.cpp:53:
.pio/libdeps/zeroUSB/SD/src/utility/SdFat.h:31:10: fatal error: Print.h: No such file or directory

***************************************************************
* Looking for Print.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:Print.h"
* Web  > https://platformio.org/lib/search?query=header:Print.h
*
***************************************************************

 #include <Print.h>
          ^~~~~~~~~
compilation terminated.
In file included from .pio/libdeps/zeroUSB/SD/src/SD.h:20:0,
                 from .pio/libdeps/zeroUSB/SD/src/File.cpp:15:
.pio/libdeps/zeroUSB/SD/src/utility/SdFat.h:31:10: fatal error: Print.h: No such file or directory

***************************************************************
* Looking for Print.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:Print.h"
* Web  > https://platformio.org/lib/search?query=header:Print.h
*
***************************************************************

 #include <Print.h>
          ^~~~~~~~~
compilation terminated.
In file included from .pio/libdeps/zeroUSB/SD/src/utility/Sd2Card.cpp:31:0:
/home/user/.platformio/packages/framework-arduino-samd/libraries/SPI/SPI.h:31:0: warning: "SPI_HAS_TRANSACTION" redefined
 #define SPI_HAS_TRANSACTION 1

In file included from /home/user/.platformio/packages/framework-arduino-samd/libraries/SPI/SPI.h:24:0,
                 from .pio/libdeps/zeroUSB/SD/src/utility/Sd2Card.cpp:31:
/home/user/.platformio/packages/framework-arduino-samd/cores/arduino/api/HardwareSPI.h:25:0: note: this is the location of the previous definition
 #define SPI_HAS_TRANSACTION

*** [.pio/build/zeroUSB/src/main.cpp.o] Error 1
*** [.pio/build/zeroUSB/lib6b9/SD/File.cpp.o] Error 1
*** [.pio/build/zeroUSB/lib6b9/SD/SD.cpp.o] Error 1
================================================================================= [FAILED] Took 1.37 seconds =================================================================================
The terminal process "pio 'run'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.
valeros commented 3 years ago

Please run the pio update command, it should be resolved in the latest platform version.