Sqlite3 在 Linux 上的安装

Sqlite3 在 Linux 上的安装,第1张

概述//听说通常装在local下 [root@localhost sqlite-3.6.16]# cd /usr/local/ //拷贝 [root@localhost local]# cp /home/db/Download/sqlite-amalgamation-3.6.16.tar.gz /usr/local/ //解压.gz [root@localhost local]# gunzip sql

//听说通常装在local下

[root@localhost sqlite-3.6.16]# cd /usr/local/
//拷贝
[root@localhost local]# cp /home/db/Download/sqlite-amalgamation-3.6.16.tar.gz /usr/local/

//解压.gz

[root@localhost local]# gunzip sqlite-amalgamation-3.6.16.tar.gz

//解压.tar

[root@localhost local]# tar -xf sqlite-amalgamation-3.6.16.tar
//改目录名,方便点,其实证实不在此目录下创建lib,bin,include....
[root@localhost local]# mv sqlite-3.6.16 sqlite3
[root@localhost local]# cd sqlite3

//.configure
[root@localhost sqlite3]# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
...........
configure: creating ./config.status
config.status: creating Makefile
config.status: creating sqlite3.pc
config.status: executing depfiles commands

//make

[root@localhost sqlite3]# make
if /bin/sh ./libtool --tag=CC --mode=compile gcc -DPACKAGE_name=/"sqlite/" -DPACKAGE_TARname=/"sqlite/"

................


//make install

[root@localhost sqlite3]# make install
make[1]: Entering directory `/usr/local/sqlite3'
test -z "/usr/local/lib" || mkdir -p -- "/usr/local/lib"
...................
librarIEs have been installed in:
/usr/local/lib

If you ever happen to want to link against installed librarIEs
in a given directory,liBDIR,you must either use libtool,and
specify the full pathname of the library,or use the `-LliBDIR'

flag during linking and do at least one of the following:
- add liBDIR to the `LD_liBRARY_PATH' environment variable
during execution
- add liBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,liBDIR' linker flag
- have your system administrator add liBDIR to `/etc/ld.so.conf'
............................

//make doc 失败了,不知道是做什么用的。
[root@localhost sqlite3]# make doc
make: *** No rule to make target `doc'. Stop.
[root@localhost sqlite3]# cd /usr/local/sqlite3

//测试一下,创建test.db
[root@localhost sqlite3]# ./sqlite3 test.db
sqlite version 3.6.16
Enter ".help" for instructions
Enter sql statements terminated with a ";"

//不错,退出

sqlite> .exit

//编了个C程序调用sqlITE的功能,说是找不到liB库文件。

[root@localhost wisconsin]# gcc -o b b.c
/tmp/ccOs5aBm.o: In function `main':
b.c:(.text+0x2e): undefined reference to `sqlite3_open'
b.c:(.text+0x42): undefined reference to `sqlite3_errmsg'
b.c:(.text+0x67): undefined reference to `sqlite3_close'
b.c:(.text+0x80): undefined reference to `sqlite3_close'


//找个好久解决方法,但是发现MAKE时系统给出说明了,在上面的红色部分就是。简单说就是要用-L来指定库文件所在目录:

//下面代码可以编译通过了

[root@localhost sqlite3]# [root@localhost wisconsin]# gcc b.c -o b -L/usr/local/lib/ -lsqlite3

总结

以上是内存溢出为你收集整理的Sqlite3 在 Linux 上的安装全部内容,希望文章能够帮你解决Sqlite3 在 Linux 上的安装所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/1178245.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-02
下一篇 2022-06-02

发表评论

登录后才能评论

评论列表(0条)

保存