我已经为 Linux 构建了 sqlcipher,但它依赖于 openssl。我想通过静态链接将 sqlcipher 配置为在没有外部 openssl 库的情况下工作。我用这个命令配置 sqlcipher
./configure --prefix=/home/admin/Downloads/qt-everywhere-opensource-src-4.8.0/src/plugins/sqldrivers/sqlcipher/ --disable-shared --enable-static --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="/usr/lib64/libcrypto.a"
make
之后我得到了下一个字符串:
/libtool --mode=link gcc -DSQLITE_HAS_CODEC -DSQLITE_OS_UNIX=1 -I. -I./src -I./ext/rtree -D_HAVE_SQLITE_CONFIG_H -DNDEBUG -I/usr/include -DSQLITE_THREADSAFE=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 /usr/lib64/libcrypto.a -DHAVE_READLINE=0 \
-o sqlite3 ./src/shell.c libsqlite3.la \
-lpthread -rpath "/home/admin/Downloads/qt-everywhere-opensource-src-4.8.0/src/plugins/sqldrivers/sqlcipher/lib"
libtool: link: gcc -DSQLITE_HAS_CODEC -DSQLITE_OS_UNIX=1 -I. -I./src -I./ext/rtree -D_HAVE_SQLITE_CONFIG_H -DNDEBUG -I/usr/include -DSQLITE_THREADSAFE=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DHAVE_READLINE=0 -o sqlite3 ./src/shell.c /usr/lib64/libcrypto.a ./.libs/libsqlite3.a -lpthread -Wl,-rpath -Wl,/home/admin/Downloads/qt-everywhere-opensource-src-4.8.0/src/plugins/sqldrivers/sqlcipher/lib
./.libs/libsqlite3.a(sqlite3.o): In function `sqlcipher_activate':
sqlite3.c:(.text+0xb66): undefined reference to `EVP_get_cipherbyname'
sqlite3.c:(.text+0xb70): undefined reference to `OPENSSL_add_all_algorithms_noconf'
./.libs/libsqlite3.a(sqlite3.o): In function `sqlcipher_random':
sqlite3.c:(.text+0xc0c): undefined reference to `RAND_bytes'
./.libs/libsqlite3.a(sqlite3.o): In function `sqlcipher_codec_ctx_set_cipher':
sqlite3.c:(.text+0x11a2): undefined reference to `EVP_get_cipherbyname'
sqlite3.c:(.text+0x11ba): undefined reference to `EVP_CIPHER_key_length'
sqlite3.c:(.text+0x11d4): undefined reference to `EVP_CIPHER_iv_length'
sqlite3.c:(.text+0x11ee): undefined reference to `EVP_CIPHER_block_size'
sqlite3.c:(.text+0x11fd): undefined reference to `EVP_sha1'
sqlite3.c:(.text+0x1205): undefined reference to `EVP_MD_size'
./.libs/libsqlite3.a(sqlite3.o): In function `sqlcipher_page_hmac':
sqlite3.c:(.text+0x1880): undefined reference to `HMAC_CTX_init'
sqlite3.c:(.text+0x1885): undefined reference to `EVP_sha1'
sqlite3.c:(.text+0x18b9): undefined reference to `HMAC_Init_ex'
sqlite3.c:(.text+0x18d9): undefined reference to `HMAC_Update'
sqlite3.c:(.text+0x18f8): undefined reference to `HMAC_Update'
sqlite3.c:(.text+0x1917): undefined reference to `HMAC_Final'
sqlite3.c:(.text+0x1929): undefined reference to `HMAC_CTX_cleanup'
./.libs/libsqlite3.a(sqlite3.o): In function `sqlcipher_page_cipher':
sqlite3.c:(.text+0x1b35): undefined reference to `EVP_CipherInit'
sqlite3.c:(.text+0x1b4a): undefined reference to `EVP_CIPHER_CTX_set_padding'
sqlite3.c:(.text+0x1b7a): undefined reference to `EVP_CipherInit'
sqlite3.c:(.text+0x1ba2): undefined reference to `EVP_CipherUpdate'
sqlite3.c:(.text+0x1bcc): undefined reference to `EVP_CipherFinal'
sqlite3.c:(.text+0x1be2): undefined reference to `EVP_CIPHER_CTX_cleanup'
./.libs/libsqlite3.a(sqlite3.o): In function `sqlcipher_cipher_ctx_key_derive':
sqlite3.c:(.text+0x1d3a): undefined reference to `PKCS5_PBKDF2_HMAC_SHA1'
sqlite3.c:(.text+0x1e08): undefined reference to `PKCS5_PBKDF2_HMAC_SHA1'
collect2: ld returned 1 exit status
make: *** [sqlite3] Error 1
我已经安装了 openssl 和 openssl-dev 软件包并且 /usr/lib64/libcrypto.a 存在。我做错了什么?