Hi @BitSeeker.
It looks like you have determined that this may not actually be needed in this case, but I think it is a generally interesting question, so I'll go ahead and answer anyway.
Background
Arduino IDE has a "library discovery" system. For each #include directive in the program being compiled, the IDE first checks to see if the file is present in the the compiler's "search path". If not, it then searches through the root source folder of each of the installed libraries to look for a file of that name.
Sometimes multiple libraries contain a file matching the #include directive. In this case, Arduino IDE must decide which of the libraries to use. It has a sophisticated algorithm for picking the best library so it usually makes the right decision, but not always.
In this case, Arduino IDE is discovering the library for the sketch's #include <BLEDevice.h> directive and found that two libraries contain a header file matching the name specified by the directive. The algorithm caused it to chose the library that is installed in your sketchbook folder, at this path:
/mnt/ntfs/Data/Data/Programming/Arduino/libraries/SdFat
over the alternative that is bundled with the "Teensy" boards platform, at this path:
/home/johnc/.arduino15/packages/teensy/hardware/avr/1.59.0/libraries/SdFat
Solution
As was already mentioned, the most simple solution would be to uninstall the "SdFat" library installation from the sketchbook folder. However, since you need that installation for other projects that is not an acceptable solution.
In this case the solution will be to influence the library discovery system to chose the library bundled with the "Teensy" platform over the one in the sketchbook folder.
As I mentioned before, files from the include search path are always given priority by the library discovery system. Once a library is "discovered", its path is added to the include search path. So if we can cause the platform bundled library to be discovered before Arduino IDE does discovery for the ambiguous SdFat.h file, then it will not discover the library in the sketchbook folder. This is accomplished by placing an #include directive for a file unique to the "Teensy" platform's bundled library above the ambiguous #include directive.
In some cases we are fortunate enough to find that the target library already contains a uniquely named header file suitable for this usage. Unfortunately there is no such file in the platform bundled library. So in this case it will be necessary for you to add such a file to the library. You might name it something like Teensy_SdFat.h
It would be sufficient to simply add an empty file to the library. However, it will be a good idea to add a comment to the file to help you to understand its obscure purpose in case you chance to be looking at some point point in the future when you no longer recall the exact reason for adding it. Something like this:
/*
This file allows the library to be given priority over the globally installed "SdFat" library by the Arduino library
discovery system:
https://forum.arduino.cc/t/how-to-select-a-specific-version-of-a-library/1383714
This file is intentionally left empty.
*/
For further convenience, you can add an #include directive to the new file for the library's header file so that this file can be used as a substitute for the primary header filename in the #include directive instead of only a supplement:
/*
This file allows the library to be given priority over the globally installed "SdFat" library by the Arduino library
discovery system:
https://forum.arduino.cc/t/how-to-select-a-specific-version-of-a-library/1383714
This file is intentionally left empty.
*/
#include "SdFat.h"
Place the file in the folder at this path on your hard drive:
/home/johnc/.arduino15/packages/teensy/hardware/avr/1.59.0/libraries/SdFat
Now in your code that depends on the "Teensy" platform's bundled "SdFat" library, add this #include directive:
#include <Teensy_SdFat.h>
(adjust the directive if you chose a different name for the file you added)
If you added an #include "SdFat.h" directive to the Teensy_SdFat.h file as I described above, you can replace the #include directive for SdFat.h with the one for Teensy_SdFat.h. If you did not add an #include directive to Teensy_SdFat.h, then you must place it on a line at some point before the #include directive for SdFat.h in your code.
Now when you compile the sketch you should see from the compilation output that the platform bundled library was used.
When all other factors are equal, the library discovery system is designed to give higher priority to the libraries that are installed in the sketchbook folder:
https://arduino.github.io/arduino-cli/latest/sketch-build-process/#location-priority
The reason for this is to allow the user to use modified versions of the platform bundled libraries.
The .s file extension (or more canonically .S) is used for files that contain code written in assembly language.