One thing to note about compiling is; that the developers, on Marlin 2.0 have moved away from Arduino IDE, and over to platform.io
Platform.IO seems to me, to do a different (better? easier?) job of compiling, than is possible in Arduino IDE.
See this for more details about how to install Platform.IO [marlinfw.org]
And possibly see this video: [www.youtube.com]
I have been designing a new RAMPS 1.7 board, to be able to be used with both Arduino Mega and DUE.
As I have moved some pins (compared to RAMPS 1.4), and made it possible to use Hardware SPI on Due, I have had to compile Marlin 2.0 many times, in the past few weeks. And depending on what options I enable in configuration.h, some versions of Arduino IDE stops being able to compile. I am testing 1.8.5, 1.8.6 and 1.9-beta.
But when testing and compiling using Platform.IO, the compilation goes much more smoothly. So this could be one issue you are actually fighting, besides the configuration settings in Marlin. That you are not using the same toolchain (compile environment) as the developers of Marlin actually uses these days. ( Yes, this discovery is also rather new to me :-) )
I do not know if Platform.IO is only used to compile Marlin 2.0
Perhaps they are also only (or mainly, or first) test if Marlin 1.x versions will compile under Platform.IO
Further more, I have discovered that all dependencies (libraries needed in order to compile) sometimes gives some trouble when using Arduino IDE. And this has not yet happened to me under Platform.IO.
Supposedly, all libraries needed in order to compile Marlin (2.0 at least) are included within Marlin source code, when using Platform.IO - or perhaps there are definitions in the Marlin tree of folders that tell the compiler which liberaies (and which versions) are good to (auyomatically) pull in from github-like locations on the web.
But my (recent testing , like today testing) has shown me that this is not the case when using Arduino IDE. In Arduino IDE, it s possible for the user, to update libraries, but I do not think it is (yet) possible for configuration files, to automatically pull the right versions of any given external library.
Either way: Try to compile with Platform.IO and see if that makes a difference for your particular issue.
I use VScode as the editor environment, and VSCode automatically pulls in Platform.IO, when I open the Marlin top folder with VSCode.
Platform.IO seems to me, to do a different (better? easier?) job of compiling, than is possible in Arduino IDE.
See this for more details about how to install Platform.IO [marlinfw.org]
And possibly see this video: [www.youtube.com]
I have been designing a new RAMPS 1.7 board, to be able to be used with both Arduino Mega and DUE.
As I have moved some pins (compared to RAMPS 1.4), and made it possible to use Hardware SPI on Due, I have had to compile Marlin 2.0 many times, in the past few weeks. And depending on what options I enable in configuration.h, some versions of Arduino IDE stops being able to compile. I am testing 1.8.5, 1.8.6 and 1.9-beta.
But when testing and compiling using Platform.IO, the compilation goes much more smoothly. So this could be one issue you are actually fighting, besides the configuration settings in Marlin. That you are not using the same toolchain (compile environment) as the developers of Marlin actually uses these days. ( Yes, this discovery is also rather new to me :-) )
I do not know if Platform.IO is only used to compile Marlin 2.0
Perhaps they are also only (or mainly, or first) test if Marlin 1.x versions will compile under Platform.IO
Further more, I have discovered that all dependencies (libraries needed in order to compile) sometimes gives some trouble when using Arduino IDE. And this has not yet happened to me under Platform.IO.
Supposedly, all libraries needed in order to compile Marlin (2.0 at least) are included within Marlin source code, when using Platform.IO - or perhaps there are definitions in the Marlin tree of folders that tell the compiler which liberaies (and which versions) are good to (auyomatically) pull in from github-like locations on the web.
But my (recent testing , like today testing) has shown me that this is not the case when using Arduino IDE. In Arduino IDE, it s possible for the user, to update libraries, but I do not think it is (yet) possible for configuration files, to automatically pull the right versions of any given external library.
Either way: Try to compile with Platform.IO and see if that makes a difference for your particular issue.
I use VScode as the editor environment, and VSCode automatically pulls in Platform.IO, when I open the Marlin top folder with VSCode.