Closed didik78 closed 3 years ago
Hi @didik78, can you run it with v -show_c_cmd run sqlite.v
? and have you installed the sqlite3
library?
@dhonx I did as readme.md required: # to use module
sqlite, install
sqlite-develfirst.
D:\v\examples>v install sqlite-devel Skipping module "sqlite-devel", since it is missing name or url information.
It seems no sqlite-devel
module for windows.
@nedpals Can you troubleshooting this ??
@didik78 @shawnye You'll need to download the zip file in the SQLite download page (the first link), create a new folder named sqlite
inside the thirdparty
folder where the V compiler lives, extract the contents of the zip into that folder, and edit the following on the sqlite.v
:
module sqlite
#flag -lsqlite3
#flag freebsd -I/usr/local/include
#flag freebsd -Wl -L/usr/local/lib -lsqlite3
+ #flag windows -I @VROOT/thirdparty/sqlite
+ #flag windows -L @VROOT/thirdparty/sqlite
I can't test it right now since I'm encountering unicode redefinition errors but it should work as expected.
windows2008 server 64bit V 0.1.25 7165327
@nedpals I downloaded the latest sqlite3 source code ,and put down into thirdparty
,changed the sqlite.v
file as you suggested, but it failed me :(
Administrator@DD1815W1 MINGW64 /d/yexy6/v/examples (master) $ ll ../thirdparty/sqlite total 9068 -rw-r--r-- 1 Administrator 197121 591565 一月 28 03:25 shell.c -rw-r--r-- 1 Administrator 197121 8074669 一月 28 03:25 sqlite3.c -rw-r--r-- 1 Administrator 197121 576161 一月 28 03:25 sqlite3.h -rw-r--r-- 1 Administrator 197121 34802 一月 28 03:25 sqlite3ext.h Administrator@DD1815W1 MINGW64 /d/yexy6/v/examples (master) $ head ../vlib/sqlite/sqlite.v module sqlite #flag -lsqlite3 #flag freebsd -I/usr/local/include #flag freebsd -Wl -L/usr/local/lib -lsqlite3 #flag windows -I @VROOT/thirdparty/sqlite #flag windows -L @VROOT/thirdparty/sqlite #include "sqlite3.h" Administrator@DD1815W1 MINGW64 /d/yexy6/v/examples (master) $ v -cg sqlite.v C compiler=gcc C:\Users\ADMINI~1\AppData\Local\Temp\2\v\sqlite.tmp.c:145: warning: "UNICODE" redefined #define UNICODE: note: this is the location of the previous definition C:\Users\ADMINI~1\AppData\Local\Temp\2\v\sqlite.tmp.c: In function 'print': C:\Users\ADMINI~1\AppData\Local\Temp\2\v\sqlite.tmp.c:1160:58: warning: passing argument 4 of 'Wri teConsoleW' from incompatible pointer type [-Wincompatible-pointer-types] WriteConsole ( output_handle , wide_str , wide_len , & bytes_written , 0 ) ; ^~~~~~~~~~~~~~~ In file included from D:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64- w64-mingw32/include/windows.h:74, from C:\Users\ADMINI~1\AppData\Local\Temp\2\v\sqlite.tmp.c:146: D:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32/include/wi ncon.h:260:122: note: expected 'LPDWORD' {aka 'long unsigned int *'} but argument is of type 'int *' WINBASEAPI WINBOOL WINAPI WriteConsoleW(HANDLE hConsoleOutput,CONST VOID *lpBuffer,DWORD nNumbe rOfCharsToWrite,LPDWORD lpNumberOfCharsWritten,LPVOID lpReserved); ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ C:\Users\ADMINI~1\AppData\Local\Temp\2\v\sqlite.tmp.c:1163:58: warning: passing argument 4 of 'Wri teFile' from incompatible pointer type [-Wincompatible-pointer-types] WriteFile ( output_handle , (char*) s .str , s .len , & bytes_written , 0 ) ; ^~~~~~~~~~~~~~~ In file included from D:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64- w64-mingw32/include/winbase.h:18, from D:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64- w64-mingw32/include/windows.h:70, from C:\Users\ADMINI~1\AppData\Local\Temp\2\v\sqlite.tmp.c:146: D:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32/include/fi leapi.h:175:109: note: expected 'LPDWORD' {aka 'long unsigned int *'} but argument is of type 'int *' WINBASEAPI WINBOOL WINAPI WriteFile (HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrit e, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped); ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ C:\Users\ADMINI~1\AppData\Local\Temp\2\v\sqlite.tmp.c: In function 'u64_hex': C:\Users\ADMINI~1\AppData\Local\Temp\2\v\sqlite.tmp.c:1543:15: warning: comparison of unsigned exp ression >= 0 is always true [-Wtype-limits] int len= (( n >= ((u64)( 0 ) ) ) ? ( u64_str ( n ) .len + 3 ) : ( 19 )) ; ^~ C:\Users\ADMINI~1\AppData\Local\Temp\2\v\sqlite.tmp.c: In function 'sqlite__DB_q_string': C:\Users\ADMINI~1\AppData\Local\Temp\2\v\sqlite.tmp.c:4315:25: warning: passing argument 1 of 'tos _clone' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] string res= tos_clone ( sqlite3_column_text ( stmt , 0 ) ) ; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C:\Users\ADMINI~1\AppData\Local\Temp\2\v\sqlite.tmp.c:2098:26: note: expected 'byte *' {aka 'unsig ned char *'} but argument is of type 'const unsigned char *' string tos_clone (byte* s) { ~~~~~~^ C:\Users\ADMINI~1\AppData\Local\Temp\2\v\sqlite.tmp.c: In function 'sqlite__DB_exec': C:\Users\ADMINI~1\AppData\Local\Temp\2\v\sqlite.tmp.c:4340:25: warning: passing argument 1 of 'tos _clone' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] string val= tos_clone ( sqlite3_column_text ( stmt , i ) ) ; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C:\Users\ADMINI~1\AppData\Local\Temp\2\v\sqlite.tmp.c:2098:26: note: expected 'byte *' {aka 'unsig ned char *'} but argument is of type 'const unsigned char *' string tos_clone (byte* s) { ~~~~~~^ D:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-min gw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lsqlite3 collect2.exe: error: ld returned 1 exit status V error: C error. This should never happen. Please create a GitHub issue: https://github.com/vlang/v/issues/new/choose
Full error is truncated :)
@shawnye Like I said, It definitely points out to the redefinition of UNICODE
thats why I was not able to test sqlite3 on Windows properly (using MingW GCC)
No, the most important error is last error which is truncated, not warnings
I have the same issue & followed the same suggestion (put amalgamation source into thirdparty sqlite folder). Here's the result https://pastebin.com/RFJPp9NC
V searches for libsqlite3.(lib|a) to link with, make sure amalgamation source build produces that file, or remove "-l sqlite3" flag from module flags
@vitalyster thanks for the tip. I could eventually get it to work. Not sure if it's the ideal solution. Basically
any other/better suggestions welcome.
@didik78 @shawnye You'll need to download the zip file in the SQLite download page (the first link), create a new folder named
sqlite
inside thethirdparty
folder where the V compiler lives, extract the contents of the zip into that folder, and edit the following on thesqlite.v
:module sqlite #flag -lsqlite3 #flag freebsd -I/usr/local/include #flag freebsd -Wl -L/usr/local/lib -lsqlite3 + #flag windows -I @VROOT/thirdparty/sqlite + #flag windows -L @VROOT/thirdparty/sqlite
I can't test it right now since I'm encountering unicode redefinition errors but it should work as expected.
Thanks, it worked,
Fixed.
V version: 0.1.25 2fbfbf4 OS: Windows 10
What did you do?
What did you expect to see? running sqlite.v is success
What did you see instead?