Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some errors is reported when the sqlite database is compiled #2336

Open
laoniaokkk opened this issue Mar 22, 2024 · 5 comments
Open

Some errors is reported when the sqlite database is compiled #2336

laoniaokkk opened this issue Mar 22, 2024 · 5 comments

Comments

@laoniaokkk
Copy link

Hello,when I get the latest code(apps and nuttx) from the repository and then add sqlite after selecting the sim/nsh configuration, it will produce a lot of errors during compilation, such as assert, unknown type name 'off64_t', etc.
My computer is ubuntu20.04.I hope to get help to solve these problems

@acassis
Copy link
Contributor

acassis commented May 6, 2024

@laoniaokkk please share your .config

@laoniaokkk
Copy link
Author

laoniaokkk commented May 7, 2024

config.txt

@acassis Hello,this is my .config, I just use 'sim/nsh' and select database as:
[ * ] SQLITE library
(3.45.1) SQLITE version
[ * ] SQLite cmd line tool
(8192) SQLite3 cmd line tool stack size

@acassis
Copy link
Contributor

acassis commented May 7, 2024

Thank you @laoniaokkk ! Using your config I got the same issue. Seems like HOST_ARM64 is not supported yet.

Then I decided to change it to HOST_X86_64 and got some errors and fixed them.

However the SQLite didn't work when I run "nsh> sqlite3". Please find the files I modified to get it compiling.

@yinshengkai @xiaoxiang781216 I appreciate if you guys could include an example using the SIM or better yet some real board.

config_sim_sqlite.txt
Makefile.txt
sqlite3.c.txt

@xiaoxiang781216
Copy link
Contributor

@Gary-Hobson will provide patch soon.

@Gary-Hobson
Copy link
Contributor

Compilation error problems can be solved by adding this patch: apache/nuttx#12303

The following patch adds an example of sqlite in sim: apache/nuttx#12305

Since hostfs does not support FIOC_FILEPATH, it cannot currently be used in hostfs

Steps for usage:

./tools/configure.sh sim:sqlite
make -j 
./nuttx

nsh> cd tmp
nsh> ls
/tmp:

nsh> sqlite3 test.db
SQLite version 3.45.1 2024-01-30 16:01:20
Enter ".help" for usage hints.
sqlite> 

 CREATE TABLE COMPANY(
   ID INT PRIMARY KEY     sqlite> (x1...> NOT NULL,
   NAME           TEXT    NOT NULL,
   AGE            (x1...> (x1...> INT     NOT NULL,
   ADDRESS        CHAR(50),
   SALARY         (x1...> (x1...> REAL
);(x1...> 

sqlite> .schema COMPANY
CREATE TABLE COMPANY(
   ID INT PRIMARY KEY     NOT NULL,
   NAME           TEXT    NOT NULL,
   AGE            INT     NOT NULL,
   ADDRESS        CHAR(50),
   SALARY         REAL
);
sqlite> .quit
sqlite> 
nsh> 
nsh> ls -l
/tmp:
 -rwxrwxrwx       12288 test.db

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants