I just took a look at the Teensy platform configuration and I confirm what KurtE already stated. The platform configuration completely ignores the setting of the "Compiler warnings" preference. The -Wall compiler flag is always used. It is hardcoded into this line of the platform's boards.txt file:
teensy41.build.flags.common=-g -Wall -ffunction-sections -fdata-sections -nostdlib
Ah, yes. That will definitely change your libraries.
Nice!
If you have a working setup on your RPi, it will be easy to determine the dependency versions used on the working system. I would normally get the verbose compilation output from the user and then provide a line by line interpretation, but I know you are not willing to provide that. So I'll give you some general instructions for how you can interpret the verbose compilation output yourself:
At the top of the output, you will see something of this form:
Using board 'teensy41' from platform in folder: C:\Users\per\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.57.2
Using core 'teensy4' from platform in folder: C:\Users\per\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.57.2
The important part here is the name of the version folder. This tells me I am using version 1.57.2 of the Teensy boards platform dependency of my sketch.
At the bottom of the output, you will see something of this form:
Using library FastLED at version 3.5.0 in folder: C:\Users\per\Documents\Arduino\libraries\FastLED
Using library SPI at version 1.0 in folder: C:\Users\per\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.57.2\libraries\SPI
This tells me I am using version 3.5.0 of the "FastLED" library dependency of my sketch.
It also tells me that I am using version 1.0 of the "SPI" library dependency of my sketch. However, note the path of the library is inside the Teensy platform. So this means that installing the Teensy platform 1.57.2 also installs the SPI library version 1.0. So I don't need to directly manage the "SPI" library dependency in this case. I only need to manage the Teensy boards platform dependency and that also ensures I will have the specific versions of all the libraries bundled with that platform.
Once you have gathered this information from your working system. Simply use the Arduino IDE Boards Manager to install that same platform dependency version on the non-working system, then do the same using Library Manager for the library dependencies. After that, you should get the same results from compiling your sketch.
I think it will be a good idea for you to document the specific dependency versions the project is intended to be used with.
This is just a fact of life in software development of any type.
If you want a reproducible build, you must carefully manage your dependencies. The developers of the dependencies make changes over time. Those changes can have impacts on the dependent projects
PJRC. The Arduino boards platform framework gives the platform developer complete control over the effect of the "Compiler warnings" preference, including choosing to make it not have any effect.
You can modify the platform if you like. I pointed out the specific line above. The simple fix would be to change the -Wall flag in that line to -w to suppress the warnings:
teensy41.build.flags.common=-g -w -ffunction-sections -fdata-sections -nostdlib
Or if you want to do it right, you can change it to a reference of the compiler.warning_flags platform property:
teensy41.build.flags.common=-g {compiler.warning_flags} -ffunction-sections -fdata-sections -nostdlib
Then add this to the platform.txt file to set the value of the compiler.warning_flags property for each setting of the "Compiler warnings" preference:
compiler.warning_flags.none=-w
compiler.warning_flags.default=
compiler.warning_flags.more=-Wall
compiler.warning_flags.all=-Wall -Wextra
You can choose any specific flags you like here. The snippet above is only a common configuration.
The compiler warning flags are documented here: