Here is an very basic broken project. For some reason Wire1 is being included when it shouldn't be.
machinehum@Walkers-MBP test % pio run
Processing ATmega1284P (platform: atmelavr; board: ATmega1284P; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/ATmega1284P.html
PLATFORM: Atmel AVR (5.0.0) > ATmega1284P
HARDWARE: ATMEGA1284P 16MHz, 16KB RAM, 128KB Flash
DEBUG: Current (simavr) External (simavr)
PACKAGES:
- framework-arduino-avr-mightycore @ 3.0.0
- toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 12 compatible libraries
Scanning dependencies...
Dependency Graph
|-- U8g2 @ 2.35.9
|-- Wire @ 1.1
Building in release mode
Archiving .pio/build/ATmega1284P/lib2e6/libSPI.a
Archiving .pio/build/ATmega1284P/lib458/libWire.a
Compiling .pio/build/ATmega1284P/lib89b/Wire1/Wire1.cpp.o
Compiling .pio/build/ATmega1284P/lib89b/Wire1/utility/twi1.c.o
Compiling .pio/build/ATmega1284P/lib1c5/U8g2/clib/u8g2_box.c.o
Indexing .pio/build/ATmega1284P/lib2e6/libSPI.a
Indexing .pio/build/ATmega1284P/lib458/libWire.a
Compiling .pio/build/ATmega1284P/lib1c5/U8g2/clib/u8g2_buffer.c.o
Compiling .pio/build/ATmega1284P/lib1c5/U8g2/clib/u8g2_button.c.o
Compiling .pio/build/ATmega1284P/lib1c5/U8g2/clib/u8g2_circle.c.o
Compiling .pio/build/ATmega1284P/lib1c5/U8g2/clib/u8g2_cleardisplay.c.o
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/Wire1.cpp: In lambda function:
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/Wire1.cpp:24:56: error: 'static void TwoWire::onReceiveService(uint8_t*, int)' is private within this context
[](uint8_t* v, int len){ Wire1.onReceiveService(v, len); },
^~~~~~~~~~~~~~~~
In file included from /Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/Wire1.h:4:0,
from /Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/Wire1.cpp:5:
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire/src/Wire.h:52:17: note: declared private here
static void onReceiveService(uint8_t*, int);
^~~~~~~~~~~~~~~~
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/Wire1.cpp:24:79: error: 'static void TwoWire::onReceiveService(uint8_t*, int)' is private within this context
[](uint8_t* v, int len){ Wire1.onReceiveService(v, len); },
^
In file included from /Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/Wire1.h:4:0,
from /Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/Wire1.cpp:5:
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire/src/Wire.h:52:17: note: declared private here
static void onReceiveService(uint8_t*, int);
^~~~~~~~~~~~~~~~
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/Wire1.cpp: In lambda function:
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/Wire1.cpp:26:37: error: 'static void TwoWire::onRequestService()' is private within this context
[](){ Wire1.onRequestService(); });
^~~~~~~~~~~~~~~~
In file included from /Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/Wire1.h:4:0,
Compiling .pio/build/ATmega1284P/lib1c5/U8g2/clib/u8g2_d_memory.c.o
from /Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/Wire1.cpp:5:
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire/src/Wire.h:51:17: note: declared private here
static void onRequestService(void);
^~~~~~~~~~~~~~~~
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/Wire1.cpp:26:54: error: 'static void TwoWire::onRequestService()' is private within this context
[](){ Wire1.onRequestService(); });
^
In file included from /Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/Wire1.h:4:0,
from /Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/Wire1.cpp:5:
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire/src/Wire.h:51:17: note: declared private here
static void onRequestService(void);
^~~~~~~~~~~~~~~~
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/Wire1.cpp: At global scope:
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/Wire1.cpp:26:58: error: no matching function for call to 'TwoWire::TwoWire(int, void (&)(), void (&)(), void (&)(uint8_t), void (&)(uint32_t), uint8_t (&)(uint8_t, uint8_t*, uint8_t, uint8_t), uint8_t (&)(uint8_t, uint8_t*, uint8_t, uint8_t, uint8_t), uint8_t (&)(const uint8_t*, uint8_t), void (&)(uint8_t), void (&)(), void (&)(), void (&)(void (*)(uint8_t*, int)), <lambda(uint8_t*, int)>, void (&)(void (*)()), <lambda()>)'
[](){ Wire1.onRequestService(); });
^
In file included from /Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/Wire1.h:4:0,
from /Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/Wire1.cpp:5:
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire/src/Wire.h:54:5: note: candidate: TwoWire::TwoWire()
TwoWire();
^~~~~~~
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire/src/Wire.h:54:5: note: candidate expects 0 arguments, 15 provided
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire/src/Wire.h:36:7: note: candidate: constexpr TwoWire::TwoWire(const TwoWire&)
class TwoWire : public Stream
^~~~~~~
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire/src/Wire.h:36:7: note: candidate expects 1 argument, 15 provided
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire/src/Wire.h:36:7: note: candidate: constexpr TwoWire::TwoWire(TwoWire&&)
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire/src/Wire.h:36:7: note: candidate expects 1 argument, 15 provided
Compiling .pio/build/ATmega1284P/lib1c5/U8g2/clib/u8g2_d_setup.c.o
*** [.pio/build/ATmega1284P/lib89b/Wire1/Wire1.cpp.o] Error 1
Compiling .pio/build/ATmega1284P/lib1c5/U8g2/clib/u8g2_font.c.o
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c: In function 'twi_init1':
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:89:16: error: 'SDA1' undeclared (first use in this function); did you mean 'SDA'?
digitalWrite(SDA1, 1);
^~~~
SDA
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:89:16: note: each undeclared identifier is reported only once for each function it appears in
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:90:16: error: 'SCL1' undeclared (first use in this function); did you mean 'SCL'?
digitalWrite(SCL1, 1);
^~~~
SCL
In file included from /Users/machinehum/.platformio/packages/toolchain-atmelavr/avr/include/avr/io.h:99:0,
from /Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:26:
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:93:7: error: 'TWSR1' undeclared (first use in this function); did you mean 'TWSR'?
cbi(TWSR1, TWPS0);
^
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:93:3: note: in expansion of macro 'cbi'
cbi(TWSR1, TWPS0);
^~~
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:95:9: error: lvalue required as left operand of assignment
TWBR1 = ((F_CPU / TWI_FREQ) - 16) / 2;
^
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:103:3: error: 'TWCR1' undeclared (first use in this function); did you mean 'TWSR1'?
TWCR1 = _BV(TWEN) | _BV(TWIE) | _BV(TWEA);
^~~~~
TWSR1
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c: In function 'twi_disable1':
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:115:3: error: 'TWCR1' undeclared (first use in this function); did you mean 'TWCR'?
TWCR1 &= ~(_BV(TWEN) | _BV(TWIE) | _BV(TWEA));
^~~~~
TWCR
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:118:16: error: 'SDA1' undeclared (first use in this function); did you mean 'SDA'?
digitalWrite(SDA1, 0);
^~~~
SDA
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:119:16: error: 'SCL1' undeclared (first use in this function); did you mean 'SCL'?
digitalWrite(SCL1, 0);
^~~~
SCL
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c: In function 'twi_setAddress1':
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:131:3: error: 'TWAR1' undeclared (first use in this function); did you mean 'TWA1'?
TWAR1 = address << 1;
^~~~~
TWA1
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c: In function 'twi_setFrequency1':
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:142:9: error: lvalue required as left operand of assignment
TWBR1 = ((F_CPU / frequency) - 16) / 2;
^
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c: In function 'twi_readFrom1':
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:219:9: error: 'TWDR1' undeclared (first use in this function); did you mean 'TWD1'?
TWDR1 = twi_slarw;
^~~~~
TWD1
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:220:15: error: 'TWCR1' undeclared (first use in this function); did you mean 'TWDR1'?
} while(TWCR1 & _BV(TWWC));
^~~~~
TWDR1
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c: In function 'twi_writeTo1':
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:322:9: error: 'TWDR1' undeclared (first use in this function); did you mean 'TWD1'?
TWDR1 = twi_slarw;
^~~~~
TWD1
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:323:15: error: 'TWCR1' undeclared (first use in this function); did you mean 'TWDR1'?
} while(TWCR1 & _BV(TWWC));
^~~~~
TWDR1
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c: In function 'twi_reply1':
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:421:5: error: 'TWCR1' undeclared (first use in this function); did you mean 'TWCR'?
TWCR1 = _BV(TWEN) | _BV(TWIE) | _BV(TWINT) | _BV(TWEA);
^~~~~
TWCR
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c: In function 'twi_stop1':
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:436:3: error: 'TWCR1' undeclared (first use in this function); did you mean 'TWCR'?
TWCR1 = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT) | _BV(TWSTO);
^~~~~
TWCR
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c: In function 'twi_releaseBus1':
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:474:3: error: 'TWCR1' undeclared (first use in this function); did you mean 'TWCR'?
TWCR1 = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT);
^~~~~
TWCR
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c: In function 'twi_handleTimeout1':
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:506:29: error: 'TWAR1' undeclared (first use in this function); did you mean 'TWA1'?
uint8_t previous_TWAR = TWAR1;
^~~~~
TWA1
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:514:11: error: lvalue required as left operand of assignment
TWBR1 = previous_TWBR;
^
In file included from /Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:27:0:
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c: In function 'TWI1_vect':
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:533:5: warning: 'TWI1_vect' appears to be a misspelled 'signal' handler, missing '__vector' prefix [-Wmisspelled-isr]
ISR(TWI1_vect)
^
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:536:10: error: 'TWSR1' undeclared (first use in this function); did you mean 'TWSR'?
switch(TWSR1 & TW_STATUS_MASK){
^~~~~
TWSR
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:541:7: error: 'TWDR1' undeclared (first use in this function); did you mean 'TWSR1'?
TWDR1 = twi_slarw;
^~~~~
TWSR1
/Users/machinehum/.platformio/packages/framework-arduino-avr-mightycore/libraries/Wire1/src/utility/twi1.c:561:5: error: 'TWCR1' undeclared (first use in this function); did you mean 'TWDR1'?
TWCR1 = _BV(TWINT) | _BV(TWSTA)| _BV(TWEN) ;
^~~~~
TWDR1
*** [.pio/build/ATmega1284P/lib89b/Wire1/utility/twi1.c.o] Error 1
===================================================================== [FAILED] Took 0.83 seconds =====================================================================
machinehum@Walkers-MBP test %
Here is an very basic broken project. For some reason Wire1 is being included when it shouldn't be.