siara-cc / esp32_arduino_sqlite3_lib

Sqlite3 Arduino library for ESP32
Apache License 2.0
370 stars 66 forks source link

Fix for compilation errors with esp32-arduino 3.x.x #77

Closed tobozo closed 11 months ago

tobozo commented 11 months ago

C/C++: ordered comparison between pointers and zero

~/Arduino/libraries/Sqlite3Esp32/src/esp32.cpp: In function 'int ESP32Open(sqlite3_vfs*, const char*, sqlite3_file*, int, int*)':
~/Arduino/libraries/Sqlite3Esp32/src/esp32.cpp:457:12: error: ordered comparison of pointer with integer zero ('FILE*' and 'int')
  457 |   if( p->fp<=0){
      |       ~~~~~^~~
~/Arduino/libraries/Sqlite3Esp32/src/esp32.cpp: In function 'int ESP32Delete(sqlite3_vfs*, const char*, int)':
~/Arduino/libraries/Sqlite3Esp32/src/esp32.cpp:499:12: error: ordered comparison of pointer with integer zero ('FILE*' and 'int')
  499 |     if( dfd<=0 ){
      |         ~~~^~~

multiple definitions

xtensa-esp32s3-elf/bin/ld: /tmp/arduino/sketches/187BF6CB77363D60470B1CC6568AB0AA/libraries/Sqlite3Esp32/objs.a(unishox1.c.o):~/Arduino/libraries/Sqlite3Esp32/src/unishox1.c:60: multiple definition of `c_95'; /tmp/arduino/sketches/187BF6CB77363D60470B1CC6568AB0AA/libraries/Sqlite3Esp32/objs.a(shox96_0_2.cpp.o):~/Arduino/libraries/Sqlite3Esp32/src/shox96_0_2.cpp:36: first defined here
xtensa-esp32s3-elf/bin/ld: /tmp/arduino/sketches/187BF6CB77363D60470B1CC6568AB0AA/libraries/Sqlite3Esp32/objs.a(unishox1.c.o):~/Arduino/libraries/Sqlite3Esp32/src/unishox1.c:61: multiple definition of `l_95'; /tmp/arduino/sketches/187BF6CB77363D60470B1CC6568AB0AA/libraries/Sqlite3Esp32/objs.a(shox96_0_2.cpp.o):~/Arduino/libraries/Sqlite3Esp32/src/shox96_0_2.cpp:37: first defined here
collect2: error: ld returned 1 exit status
siara-cc commented 11 months ago

Thanks @tobozo Making c_95 and l_95 static is quick way to fix it

tobozo commented 11 months ago

yup, quick and dirty as I don't know why they're redundant with the other C file and not willing to break things ^^