PlatformIO Community

Errors compiling sqlite3Esp32 library examples

Hi. I can’t compile sqlite3.c. When I compile the result are multiple warnings and errors. I’m using heltec wifi kit 32. I’m trying to compile the examples without results.
My platformio.ini:

platform = espressif32
board = heltec_wifi_kit_32
framework = arduino
lib_deps = Sqlite3Esp32

and the result:

Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: Espressif 32 1.12.4 > Heltec WiFi Kit 32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
 - framework-arduinoespressif32 3.10004.200129 (1.0.4)
 - tool-esptoolpy 1.20600.0 (2.6.0)
 - toolchain-xtensa32 2.50200.80 (5.2.0)
LDF: Library Dependency Finder ->
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 40 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Sqlite3Esp32> 2.2
|   |-- <Time> 1.5    
|-- <SD(esp32)> 1.0.5 
|   |-- <FS> 1.0      
|   |-- <SPI> 1.0     
|-- <SD_MMC> 1.0      
|   |-- <FS> 1.0      
|-- <SPIFFS> 1.0
|   |-- <FS> 1.0
|-- <FS> 1.0
|-- <SPI> 1.0
|-- <Time> 1.5
Building in release mode
Compiling .pio\build\heltec_wifi_kit_32\src\main.cpp.o
Generating partitions .pio\build\heltec_wifi_kit_32\partitions.bin
Compiling .pio\build\heltec_wifi_kit_32\lib695\Time\DateStrings.cpp.o
Compiling .pio\build\heltec_wifi_kit_32\lib695\Time\Time.cpp.o
Compiling .pio\build\heltec_wifi_kit_32\libf11\Sqlite3Esp32\esp32.cpp.o
Compiling .pio\build\heltec_wifi_kit_32\libf11\Sqlite3Esp32\shox96_0_2.cpp.o
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\shox96_0_2.cpp: In function 'int shox96_0_2_compress(const char*, int, char*, lnk_lst*)':
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\shox96_0_2.cpp:274:44: warning: array subscript has type 'char' [-Wchar-subscripts]
         ol = append_bits(out, ol, c_95[c_in], l_95[c_in], state);
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\shox96_0_2.cpp:274:56: warning: array subscript has type 'char' [-Wchar-subscripts]
         ol = append_bits(out, ol, c_95[c_in], l_95[c_in], state);
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\shox96_0_2.cpp: In function 'int shox96_0_2_decompress(const char*, int, char*, lnk_lst*)':
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\shox96_0_2.cpp:446:16: warning: 'c' may be used uninitialized in this function [-Wmaybe-uninitialized]
         c -= 32;
Compiling .pio\build\heltec_wifi_kit_32\libf11\Sqlite3Esp32\sqlite3.c.o
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\sqlite3.c:22047:42: warning: 'struct tm' declared inside parameter list
 static int osLocaltime(time_t *t, struct tm *pTm){
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\sqlite3.c:22047:42: warning: its scope is only this definition or declaration, which is probably not what you want
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\sqlite3.c: In function 'osLocaltime':
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\sqlite3.c:22055:8: warning: implicit declaration of function 'localtime' [-Wimplicit-function-declaration]
   pX = localtime(t);
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\sqlite3.c:22055:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
   pX = localtime(t);
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\sqlite3.c:22059:11: error: dereferencing pointer to incomplete type 'struct tm'
  if( pX ) *pTm = *pX;
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\sqlite3.c: In function 'localtimeOffset':
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\sqlite3.c:22093:13: error: storage size of 'sLocal' isn't known
   struct tm sLocal;
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\sqlite3.c:22093:13: warning: unused variable 'sLocal' [-Wunused-variable]
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\esp32.cpp: In function 'int ESP32Read(sqlite3_file*, void*, int, sqlite_int64)':
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\esp32.cpp:164:9: warning: variable 'ofst' set but not used [-Wunused-but-set-variable]
   off_t ofst;                     /* Return value from lseek() */
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\esp32.cpp: In function 'int ESP32FileSize(sqlite3_file*, sqlite_int64*)':
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\esp32.cpp:289:15: warning: unused variable 'sStat' [-Wunused-variable]
   struct stat sStat;              /* Output of fstat() call */
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\esp32.cpp: In function 'int ESP32Open(sqlite3_vfs*, const char*, sqlite3_file*, int, int*)':
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\esp32.cpp:413:7: warning: unused variable 'oflags' [-Wunused-variable]
   int oflags = 0;                 /* flags to pass to open() call */
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\esp32.cpp: In function 'int ESP32CurrentTime(sqlite3_vfs*, double*)':
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\esp32.cpp:595:20: error: 'time' was not declared in this scope
   time_t t = time(0);
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\esp32.cpp: In function 'void shox96_0_2d(sqlite3_context*, int, sqlite3_value**)':
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\esp32.cpp:650:27: warning: unused variable 'rc' [-Wunused-variable]
   unsigned int nIn, nOut, rc;
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\esp32.cpp: In function 'void unishox1d(sqlite3_context*, int, sqlite3_value**)':
C:\Users\Papa\.platformio\lib\Sqlite3Esp32\src\esp32.cpp:700:27: warning: unused variable 'rc' [-Wunused-variable]
   unsigned int nIn, nOut, rc;
*** [.pio\build\heltec_wifi_kit_32\libf11\Sqlite3Esp32\esp32.cpp.o] Error 1
*** [.pio\build\heltec_wifi_kit_32\libf11\Sqlite3Esp32\sqlite3.c.o] Error 1

Thanks and regards

Yeah the infamous Arduino “Time” library with Time.h which collidies with the C-standard time.h header has been the topic of many post here. Do things look better when you write lib_ignore = Time in the platformio.ini?

1 Like

OK thanks. That is the solution. Now the examples compile without errors, although some warnings.
I’m newbie in this community and have not yet seen this problem. From now on I will consider it.
Thanks maxgerhardt for your help. :ok_hand: