Compile Error with Teensyduino 1.55

jimmie

Well-known member
I have a program which ran fine with Teensyduino 1.53. I was getting occasional EEPROM corruption so I upgraded to Teensyduino 1.55.

Now the same program does not compile and gives the error trace below:

------------------------------------------------------------------------------------------------------------------------------------------
WARNING: Category 'Utility' in library FlexIO_t4 is not valid. Setting to 'Uncategorized'
Multiple libraries were found for "SD.h"
Library can't use both 'src' and 'utility' folders. Double check C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD
Used: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD
Not used: C:\Program Files (x86)\Arduino\libraries\SD

Error compiling for board Teensy 4.1.
------------------------------------------------------------------------------------------------------------------------------------------

What is causing this error?


Update:

I commented out the code for using the SD library and now the program compiles. What does "can't use both 'src' and 'utility' folders" mean?

Then I used the same SD code as before but after deleting the utility subfolder in the Teensy SD library and also commenting out root.openroot

Code:
SdFile root;
//root.openRoot(volume);

and that seems to work as the program compiled fine.
 
Last edited:
What is causing this error?

Between Teensyduino 1.53 to 1.54, the ancient Arduino SD library was replaced by SdFat and a thin compatibility layer for programs using SD.h to actually use SdFat.

But the Teensyduino installer isn't smart enough about deleting the old files when you install "on top of" a prior version. Normally Arduino just ignores the old leftover files, but in this case it causes a problem. Perhaps future installers should check for this scenario....

Right now (before future smarter installers), to solve this problem you can do any of these 3 things:

1: Install a newer version of Arduino. When you run Arduino's installer, it will first delete the old version which has this SD library inside. Then run the Teensyduino installer on the freshly installed Arduino IDE. This is the cleanest solution, completely removing all old stuff.

2: Go to C:\Program Files (x86)\Arduino\hardware\ and delete the teensy folder, and everything inside it. Then run the Teensyduino installer again. This will purge all the libraries Teensyduino previous installed, then running the new installer gives you a fresh copy without any cruft library left over. But some non-library stuff will remain untouched.

3: Go to C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD and delete the utility folder, and all files within it. Arduino should be happy with this, even though it leaves a lot of other old files laying around.
 
Thank you Paul.

I used Option 3 above. One line in my code did not compile:

Code:
root.openRoot(volume);

What replaced the openRoot function or is it better to replace the SD with the SDFat library?
 
openRoot() was never part of the SD.h public API.

If your code is designed to access the very old SdFat functions from within the old SD library, you 2 choices are update your code, or copy the old SD library from an 1.53 install to your Documents/Arduino/libraries folder, so Arduino will use it instead of the SD library Teensyduino provides.
 
With the new version, you can access SdFat, but it is a newer version, so it may or may not be compatible with your code.

If you wish to go that route, click File > Examples > SD > SdFat_Usage to get started.
 
Library can't use both 'src' and 'utility' folders. Double check C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD

Today I put some work into reproducing this problem. At first I couldn't reproduce the error, even after installing 1.56-beta5 on top of 1.53.

Then I realized this only happens with the older versions of Arduino. 1.8.5 and 1.8.9 both give this error, if 1.53 or older was installed and then 1.54 or newer is installed on top of it.

But Arduino 1.8.12 and newer don't give this error.

Still not sure what I'm going to actually do about this, if anything. Just following up with more info, as I had saved this thread on my list of known problems to investigate.
 
I've added a check for the leftover SD/utility folder to the installer. Tested a 1.56-beta6 install on top of 1.53 using Arduino 1.8.9. SD library listfiles example compiles without error on Arduino 1.8.9 on both Linux and Windows.
 
Back
Top