Teensy4.1 built-in SDCard multiple definitions

I am trying to use the buil-in SD-Card of the teensy 4.1 in a CNC program in platformio and teensyduino 1.8 19 on a MacBookPro M1 (Monterey)
I have the following includes:

#include "Arduino.h"
#include <stdint.h>
#include <SPI.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h> 
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

I can also include the SD.h lib,

But when I initialize the SD object as mentioned in the example datalogger

if (!SD.begin(chipSelect)) {
    Serial.println("initialization failed!");

I get dozends of errors in the sence of

ExFatPartition.cpp:(.text._ZN14ExFatPartition10rootLengthEv+0x0): multiple definition of `ExFatPartition::rootLength()'
.pio/build/teensy41/lib96d/libSdFs.a(ExFatPartition.cpp.o):ExFatPartition.cpp:(.text._ZN14ExFatPartition10rootLengthEv+0x0): first defined here
.pio/build/teensy41/lib760/libSdFat.a(FatPartition.cpp.o): In function `FatPartition::fatGet(unsigned long, unsigned long*)':
FatPartition.cpp:(.text._ZN12FatPartition6fatGetEmPm+0x0): multiple definition of `FatPartition::fatGet(unsigned long, unsigned long*)'
.pio/build/teensy41/lib96d/libSdFs.a(FatPartition.cpp.o):FatPartition.cpp:(.text._ZN12FatPartition6fatGetEmPm+0x0): first defined here
.pio/build/teensy41/lib760/libSdFat.a(FatPartition.cpp.o): In function `FatPartition::allocateCluster(unsigned long, unsigned long*)':

Running the Datalogger example in Teensyduino gives multiple errors in the sense of

/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy4/FS.h:127:2: note: no known conversion for argument 1 from ‘SDFile*’ to ‘const File&’
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy4/FS.h:117:2: note: candidate: File::File(FileImpl*)
File(FileImpl *file) {

How can I get this to work?

It looks like the SdFs and SdFat library are horribly conflicting with each other and shouldn’t be in the same build.

What’s your platformio.ini for reproduction?

Thanks for your saturday response.
Uff: deleting the greiman/SdFs-lini in the ini seems to solve the problem. I can’t remember where I got this advice.


lib_deps =
thingpulse/ESP8266 and ESP32 OLED driver for SSD1306 displays@^4.3.0
adafruit/Adafruit SSD1306@^2.5.7
adafruit/Adafruit GFX Library@^1.11.5
platform = teensy
board = teensy41
framework = arduino
build_flags = -D USB_RAWHID