siara-cc / esp32-idf-sqlite3

Sqlite library for esp-idf (esp32) framework
Apache License 2.0
147 stars 57 forks source link

esp-idf-v4.0 support #6

Closed Elegma closed 3 years ago

Elegma commented 4 years ago

Hello! How I can build and use this library for esp-idf-v4.0 ? I try to compile it and have some troubles.

Yardie- commented 3 years ago

Is there any interest here I too am having compile issues with v4.1

Yardie- commented 3 years ago

ok I got it working. I moved the library outside the core directory ( idf.py complains and fails continually on other projects). I updated the Makefile adding the appropriate relative path. then simply used make instead of idf.py so make menuconfig make flash monitor This works on the spiffs example out of the box

Yardie- commented 3 years ago

After some investigation I found that one difference here is that cmake is now the default

CMake-based build system, which is the default since ESP-IDF V4.0. ESP-IDF also supports a legacy build system based on GNU Make, which was the default before ESP-IDF V4.0.

so my guess is that when the source code sqlite3.c was created you used make and now you need to use cmake

siara-cc commented 3 years ago

@Yardie- @Elegma I just got it working on esp-idf 4.1.1 and pushed my changes. Thank you for the valuable inputs.

Yardie- commented 3 years ago

Wicked well done. You are a legend. I will try it soon. I will also try enabling 8_3 filenames and see if I can get it to work on a virtual fat.

On 14 February 2021 5:25:27 pm AWST, "Arun (Arundale Ramanathan)" notifications@github.com wrote:

@Yardie- @Elegma I just got it working on esp-idf 4.1.1 and pushed my changes. Thank you for the valuable inputs.

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/siara-cc/esp32-idf-sqlite3/issues/6#issuecomment-778751324

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.

Yardie- commented 3 years ago

Hi Arun What was your actual build process please. Ok I'm on 4.2 stable release There are some differences but I can't see how it changes the build. I've tried a couple of things and keep failing. It's so close I can feel it but I am new to this Cmake stuff and I can't nut it out.

attempt 1

follow instructions down load both git repositories fails attempt 2 download and unzip both to ~/esp

cd ~/esp
cp -r ~/esp/esp32-idf-sqlite3-examples-master/spiffs ~/esp
mkdir ~/esp/spiffs/components
cp -r ~/esp/esp32-idf-sqlite3-master ~/esp/spiffs/components
cd ~/esp/spiffs

added to CMakeLists.txt

set(EXTRA_COMPONENT_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/components)

Executing "ninja all"... [0/1] Re-running CMake... -- Project is not inside a git repository, or git repository has no commits; will not use 'git describe' to determine PROJECT_VER. -- Building ESP-IDF components for target esp32 CMake Error at /home/g/esp/esp-idf/tools/cmake/component.cmake:221 (message): CMake Error at /home/g/esp/spiffs/main/CMakeLists.txt:4 (idf_build_component):

Unknown CMake command "idf_build_component".

Call Stack (most recent call first):

/home/g/esp/esp-idf/tools/cmake/scripts/component_get_requirements.cmake:60 (include)
/home/g/esp/esp-idf/tools/cmake/scripts/component_get_requirements.cmake:76 (__component_get_requirements)

Thanks

siara-cc commented 3 years ago

@Yardie- I have been following this, assuming SDK is installed at ~/esp/esp-idf:

cd ~/esp/esp-idf/components
git clone https://github.com/siara-cc/esp32-idf-sqlite3
cd ../examples
git clone https://github.com/siara-cc/esp32-idf-sqlite3-examples
cd esp32-idf-sqlite3-examples/spiffs
idf.py build
make flash
make monitor

After this you should be able to see DBs created and records inserted in SPIFFS.

Yardie- commented 3 years ago

ok so it still needs to be built with make not cmake idf.py menuconfig fails but make menuconfig works idf.py flash fails but make flash works also set(EXTRA_COMPONENT_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/components) putting esp32-idf-sqlite3 in the projects own components directory works usng make just a change in the CMakeLists adding set(EXTRA_COMPONENT_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/components) then idf.py build make flash make monitor

that will do for now thanks heaps Arun