如何将sqlite扩展库添加到cmake以使用spellfix1
How to add sqlite extension Library to cmake in order to use spellfix1
我下载并编译了以下sqlite扩展库:SQLITE为了使用spellfix1。
编译安装
$ ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" \
LDFLAGS="-lcrypto"
$ sudo make
$ sudo make install
输出
Libraries have been installed in:
/usr/share/tcltk/tcl8.6/sqlite3
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'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
rm -f /usr/share/tcltk/tcl8.6/sqlite3/libtclsqlite3.la /usr/share/tcltk/tcl8.6/sqlite3/libtclsqlite3.a
/usr/bin/install -c -m 0644 pkgIndex.tcl /usr/share/tcltk/tcl8.6/sqlite3
/usr/bin/install -c -d /usr/local/bin
./libtool --mode=install /usr/bin/install -c sqlcipher /usr/local/bin
libtool: install: /usr/bin/install -c .libs/sqlcipher /usr/local/bin/sqlcipher
/usr/bin/install -c -d /usr/local/include/sqlcipher
/usr/bin/install -c -m 0644 sqlite3.h /usr/local/include/sqlcipher
/usr/bin/install -c -m 0644 /home/hani/Documents/articles/Architecture/Modules/sqlcipher/src/sqlite3ext.h /usr/local/include/sqlcipher
/usr/bin/install -c -d /usr/local/lib/pkgconfig
/usr/bin/install -c -m 0644 sqlcipher.pc /usr/local/lib/pkgconfig"
问题
我想将此库添加到我的项目中以便使用 spellfix1
。
为此,我使用 CMake
。
我遵循的步骤正确吗?
首先我导出了环境变量:
$export SQLITE_EXT=/usr/local/include
$export SQLITE_LIB=/usr/share/tcltk/tcl8.6
其次,我将以下行添加到我的 CMakelist 文件中。
link_directories($ENV{SQLITE_LIB}/sqlite3)
include_directories($ENV{SQLITE_EXT}/sqlcipher)
target_link_libraries(MyProgram tclsqlite3)
编译错误
我收录了#include<sqlite3ext.h>
sqlite_modern_cpp.h
是 sqlite3 的额外层。
错误:
/MyProgram/3rdparty/sqlite_modern_cpp.h:160:8: error: ‘sqlite3_api’ was not declared in this scope
更新 1
我没有CMake错误。
我根据答案中提供的内容添加了 SQLITE_EXTENSION_INIT1
。没有编译错误。现在我有一个运行时错误,我要解决它。
#include <sqlite3ext.h>
SQLITE_EXTENSION_INIT1
在官方网站上,有一个示例扩展:half. Recently, I used it with a success. Please check it out first to find out how the extension works. And if in trouble, check out this。
我下载并编译了以下sqlite扩展库:SQLITE为了使用spellfix1。
编译安装
$ ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" \
LDFLAGS="-lcrypto"
$ sudo make
$ sudo make install
输出
Libraries have been installed in:
/usr/share/tcltk/tcl8.6/sqlite3
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'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
rm -f /usr/share/tcltk/tcl8.6/sqlite3/libtclsqlite3.la /usr/share/tcltk/tcl8.6/sqlite3/libtclsqlite3.a
/usr/bin/install -c -m 0644 pkgIndex.tcl /usr/share/tcltk/tcl8.6/sqlite3
/usr/bin/install -c -d /usr/local/bin
./libtool --mode=install /usr/bin/install -c sqlcipher /usr/local/bin
libtool: install: /usr/bin/install -c .libs/sqlcipher /usr/local/bin/sqlcipher
/usr/bin/install -c -d /usr/local/include/sqlcipher
/usr/bin/install -c -m 0644 sqlite3.h /usr/local/include/sqlcipher
/usr/bin/install -c -m 0644 /home/hani/Documents/articles/Architecture/Modules/sqlcipher/src/sqlite3ext.h /usr/local/include/sqlcipher
/usr/bin/install -c -d /usr/local/lib/pkgconfig
/usr/bin/install -c -m 0644 sqlcipher.pc /usr/local/lib/pkgconfig"
问题
我想将此库添加到我的项目中以便使用 spellfix1
。
为此,我使用 CMake
。
我遵循的步骤正确吗?
首先我导出了环境变量:
$export SQLITE_EXT=/usr/local/include
$export SQLITE_LIB=/usr/share/tcltk/tcl8.6
其次,我将以下行添加到我的 CMakelist 文件中。
link_directories($ENV{SQLITE_LIB}/sqlite3)
include_directories($ENV{SQLITE_EXT}/sqlcipher)
target_link_libraries(MyProgram tclsqlite3)
编译错误
我收录了#include<sqlite3ext.h>
sqlite_modern_cpp.h
是 sqlite3 的额外层。
错误:
/MyProgram/3rdparty/sqlite_modern_cpp.h:160:8: error: ‘sqlite3_api’ was not declared in this scope
更新 1
我没有CMake错误。
我根据答案中提供的内容添加了 SQLITE_EXTENSION_INIT1
。没有编译错误。现在我有一个运行时错误,我要解决它。
#include <sqlite3ext.h>
SQLITE_EXTENSION_INIT1
在官方网站上,有一个示例扩展:half. Recently, I used it with a success. Please check it out first to find out how the extension works. And if in trouble, check out this。