1)先下载Sqlite3:
https://www.sqlite.org/download.html
2)编译:
configure --prefix=/usr/local/sqlite
make -j 4 & make install
ref:https://www.pianshen.com/article/7260586724/
Compiling The Command-Line Interface- sqlite3.c: The SQLite amalgamation source file
- sqlite3.h: The header files that accompanies sqlite3.c and defines the C-language interfaces to SQLite.
- shell.c: The command-line interface program itself. This is the C source code file that contains the definition of the main() routine and the loop that prompts for user input and passes that input into the SQLite database engine for processing.
To build the CLI, simply put these three files in the same directory and compile them together. Using MSVC: cl shell.c sqlite3.c -Fesqlite3.exe On Unix systems (or on Windows using cygwin or mingw+msys) the command typically looks something like this: gcc shell.c sqlite3.c -lpthread -ldl -lm -o sqlite3 The pthreads library is needed to make SQLite threadsafe. But since the CLI is single threaded, we could instruct SQLite to build in a non-threadsafe mode and thereby omit the pthreads library: gcc -DSQLITE_THREADSAFE=0 shell.c sqlite3.c -ldl -lm -o sqlite3 gcc -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION shell.c sqlite3.c -o sqlite3 In order to see extra commentary in EXPLAIN listings, add the -DSQLITE_ENABLE_EXPLAIN_COMMENTS option. Add -DHAVE_READLINE and the -lreadline and -lncurses libraries to get command-line editing support. One might also want to specify some compiler optimization switches. (The precompiled CLI available for download from the SQLite website uses "-Os".) There are countless possible variations here. A command to compile a full-featured shell might look something like this: gcc -Os -I. -DSQLITE_THREADSAFE=0 -DSQLITE_ENABLE_FTS4 \ -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 \ -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_EXPLAIN_COMMENTS \ -DHAVE_READLINE \ shell.c sqlite3.c -ldl -lm -lreadline -lncurses -o sqlite3 The key point is this: Building the CLI consists of compiling together two C-language files. The shell.c file contains the definition of the entry point and the user input loop and the SQLite amalgamation sqlite3.c contains the complete implementation of the SQLite library. Building A Windows DLLTo build a DLL of SQLite for use in Windows, first acquire the appropriate amalgamated source code files, sqlite3.c and sqlite3.h. These can either be downloaded from the SQLite website or custom generated from sources as shown above. With source code files in the working directory, a DLL can be generated using MSVC with the following command: cl sqlite3.c -link -dll -out:sqlite3.dll The above command should be run from the MSVC Native Tools Command Prompt. If you have MSVC installed on your machine, you probably have multiple versions of this Command Prompt, for native builds for x86 and x64, and possibly also for cross-compiling to ARM. Use the appropriate Command Prompt depending on the desired DLL. If using the MinGW compiler, the command-line is this: gcc -shared sqlite3.c -o sqlite3.dll (sqlite3.so) 注意可以直接从16G上拷贝原文件: 到以下: 除了16G原有的目录复制,还要拷 /usr/lib/python3.6/lib-dynload/_sqlite3_.....36m.....arm-......so 有这个文件基本就行了,具体这个文件在哪自己到原盘去找。 还有/usr/local/lib/python3.6/lib-dynload/_sqlite3_......36m.......arm-......so 这个位置这个文件也要有即/usr/lib 和/usr/local/lib都要有,否则找不到报错。 再一个就是看报错,把.so文件拷到报错文件找得着的地方。
sqlite-amalgamation-3420000.zip
(2.52 MB, 下载次数: 152)
|