SD.h include error; library not found

Hi, we are having big troubles with platformio and the SD.h library.

I am not able to reproduce the error reliable. Sometimes I get the error too but most of the time it works. But other people encounter the problem and it seems to be not easily fixable.

This is the code:

And the platformio.ini

The current error:

Working heavily on the code I had a similar error in the past. The error back then looked like platform.io tried to load the SD library for the host system (linux) instead of the ESP32.

Any advice that guides us in the correct direction is welcome.

The code compiles fine for me.

Wow, your code depends on 3.0.0, which was released more than 3 years ago.

Remove SPI, SPIFFS, ArduinoOTA, EEPROM, ESPmDNS and FS from your lib_deps. These are builtin libraries.

You lib_deps section should look like this:

lib_deps  = 
    bodmer/TFT_eSPI@2.5.30

Remove

and

[common_env_data]
lib_deps_builtin = 
	ArduinoOTA
	EEPROM
	ESPmDNS
	FS
	Preferences
	SD(esp32) @ 1.0.5
	SPI
	SPIFFS

Thanks. Most of the time it compiles. But for those who encounter the error there seems to be no easy fix.

It seems to be a problem with side by side installations of different framework versions.

Using a fully isolated installation seems to fix it too but this would be too hard to do for most users.

PS: 3.0.0 just works. The newer versions have some issues with I2S and maybe interrupt priorities that I would have to look deeper into to get it running.

I also suggest running Full Clean to remove some build artifacts and leftovers for those users who have tried platform=espressif32 - this will use the currently installed version or install the latest available version.

The code does not compile for me with 6.5.0:

lib/Grbl_Esp32/src/Serial.cpp: In function 'void clientCheckTask(void*)':
lib/Grbl_Esp32/src/Serial.cpp:118:21: error: 'vTaskEnterCritical' was not declared in this scope
                     vTaskEnterCritical(&myMutex);
                     ^~~~~~~~~~~~~~~~~~
lib/Grbl_Esp32/src/Serial.cpp:118:21: note: suggested alternative: 'vPortEnterCritical'
                     vTaskEnterCritical(&myMutex);
                     ^~~~~~~~~~~~~~~~~~
                     vPortEnterCritical
lib/Grbl_Esp32/src/Serial.cpp:120:21: error: 'vTaskExitCritical' was not declared in this scope
                     vTaskExitCritical(&myMutex);
                     ^~~~~~~~~~~~~~~~~
lib/Grbl_Esp32/src/Serial.cpp:120:21: note: suggested alternative: 'vPortExitCritical'
                     vTaskExitCritical(&myMutex);
                     ^~~~~~~~~~~~~~~~~
                     vPortExitCritical
lib/Grbl_Esp32/src/Serial.cpp: In function 'int client_read(uint8_t)':
lib/Grbl_Esp32/src/Serial.cpp:143:5: error: 'vTaskEnterCritical' was not declared in this scope
     vTaskEnterCritical(&myMutex);
     ^~~~~~~~~~~~~~~~~~
lib/Grbl_Esp32/src/Serial.cpp:143:5: note: suggested alternative: 'vPortEnterCritical'
     vTaskEnterCritical(&myMutex);
     ^~~~~~~~~~~~~~~~~~
     vPortEnterCritical
lib/Grbl_Esp32/src/Serial.cpp:145:5: error: 'vTaskExitCritical' was not declared in this scope
     vTaskExitCritical(&myMutex);
     ^~~~~~~~~~~~~~~~~
lib/Grbl_Esp32/src/Serial.cpp:145:5: note: suggested alternative: 'vPortExitCritical'
     vTaskExitCritical(&myMutex);
     ^~~~~~~~~~~~~~~~~
     vPortExitCritical
*** [.pio\build\esp32dev\libace\Grbl_Esp32\Serial.cpp.o] Error 1

I’m not very familar with platformio and/or vstudio… Is Full Clean a custom command? A build flag? Where to put it?

The new version of the code compiles with 6.5.0 but has issues with I2S so I decided to keep 3.0.0 for now.

vTaskEnterCritical should be changed to portENTERcritical etc. Also some GPIO settings need to be changed.

But as said even if it does compile, there where changes made to I2S that produce slower readings. And also some problems with task/interrupt priorities occur with newer versions. Pretty messed up to fix it all while having so much to do…

Click on the Alien (or Ant) head / Project Tasks / General / Full Clean:

1 Like

Sadly it didn’t help.

Try removing the .pio folder

Already tried it.

Could it be related with mixed slashes somehow?

mixedslashes

No, that should not be the cause.

You said that several / different users are affected.
What are the differences? Different operating systems etc?

What else you could try (to get rid of old ballast) would be

  • Exit VSCode
  • Delete the folders %homedir%/.platformio/platforms/espressif....
  • Possibly even delete the corresponding subfolders in the folder %homedir%/.platformio/packages/....

The necessary files are automatically reinstalled when VS-Code is restarted. Everything should then be clean.

Everything tried. Deleting .platformio, .pio and .vscode does not help.

The error is the same for those who encounter it. Error seems to affect windows users.

At least those I know from use Windows.

Verbose:

-DARDUINO=10805 ?? Where does this come from?

Please show me your current platformio.ini after the changes you have made.

It is not my build but this is the platformio.ini file used:

[env:esp32dev]
lib_ldf_mode = deep+
platform  = espressif32@3.0.0
;platform = espressif32@6.5.0 ; not working.. i2S and interrupt problems
board     = esp32dev
framework = arduino ;framework-arduinoespressif32 @ 3.10006.210326 (1.0.6) 
monitor_speed = 115200
lib_deps  = 
    bodmer/TFT_eSPI@2.5.33
    ;SPI
    ;EEPROM
    ;FS
    ;SD(esp32) @ 1.0.5
    ;SD(esp32) @ 2.0.0
    ;SPIFFS

board_build.f_cpu = 240000000L
board_build.f_flash = 80000000L
board_build.flash_mode = qio
board_build.partitions = min_spiffs.csv
build_src_filter = 
    +<.h> +<.s> +<.S> +<.cpp> +<*.c> +<src/>
    -<.git/> -<data/> -<test/> -<tests/>


build_flags = 
    -DUSE_FULL_LL_DRIVER
    -DCORE_DEBUG_LEVEL=0
    -Wno-unused-variable
    -Wno-unused-function
    ;###############################################################
    ; TFT_eSPI library settings (no need to edit the library files):
    ;###############################################################
    -D TFT_MISO=19
    -D TFT_MOSI=23
    -D TFT_SCLK=18
    -D TFT_CS=2
    -D TFT_DC=15
    -D TFT_RST=4 
    -D TOUCH_CS=21
    -D USER_SETUP_LOADED=1 
    -D ILI9341_DRIVER=1 
    ;-D TFT_WIDTH=240 
    ;-D TFT_HEIGHT=320
    -D LOAD_GLCD=1 
    -D LOAD_FONT2=1
    -D LOAD_FONT4=1
    -D SMOOTH_FONT=1
    -D SPI_FREQUENCY=64000000
    -D SPI_READ_FREQUENCY=20000000
    ;-D SPI_TOUCH_FREQUENCY=2500000
    -D SPI_TOUCH_FREQUENCY=6000000
    -D SUPPORT_TRANSACTIONS=1
    -Isrc

Please remove -Isrc from build_flags.
Clean and try again.

Still nothing.

Please post the full log as preformatted text instead of screen shot snippets. I suppose the cause is in there but not visible in the screen shots.

Sry for the fragmented images. That is just the way I get the errors. Requested the full log now. Now It looks like I have reached the maximum number of posts possible on the first day.

Full error log:

Can’t create new posts for the next 21 hours.

Deine Hilfe in Ehren aber das Repo kann so leider nicht bleiben.