sqlcipheron MacOS HighSierra构建错误

时间:2018-08-27 10:24:52

标签: macos sqlcipher

我从MacOS上的github存储库构建sqlcipher:

9429:sqlcipher administrator$ ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_ENABLE_UNLOCK_NOTIFY"
checking build system type... i386-apple-darwin17.4.0

...

config.status: creating config.h
config.status: config.h is unchanged
config.status: executing libtool commands
9429:sqlcipher administrator$ make
./libtool --mode=link gcc -DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -DSQLITE_OS_UNIX=1 -I. -I/Users/administrator/pjx/sqlcipher/src -I/Users/administrator/pjx/sqlcipher/ext/rtree -I/Users/administrator/pjx/sqlcipher/ext/icu -I/Users/administrator/pjx/sqlcipher/ext/fts3 -I/Users/administrator/pjx/sqlcipher/ext/async -I/Users/administrator/pjx/sqlcipher/ext/session -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG  -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY     -no-undefined -o libsqlcipher.la sqlite3.lo -lcrypto   \
         -rpath "/usr/local/lib" -version-info "8:6:8"
libtool: link: gcc -dynamiclib  -o .libs/libsqlcipher.0.dylib  .libs/sqlite3.o   -lcrypto    -install_name  /usr/local/lib/libsqlcipher.0.dylib -compatibility_version 9 -current_version 9.6 -Wl,-single_module
Undefined symbols for architecture x86_64:
  "_HMAC_CTX_free", referenced from:
      _sqlcipher_openssl_hmac in sqlite3.o
  "_HMAC_CTX_new", referenced from:
      _sqlcipher_openssl_hmac in sqlite3.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libsqlcipher.la] Error 1

我怎么了?

什么是“ _HMAC_CTX_free”错误?

1 个答案:

答案 0 :(得分:0)

我有同样的问题。解决方案是静态地使用OpenSSL进行编译。 您需要在./configure命令中提供静态库!

./configure --enable-tempstore=yes \
CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_ENABLE_UNLOCK_NOTIFY"\
LDFLAGS="/usr/local/lib/libcrypto.a"

make

不要忘记链接正确的库 libcrypto.a

相关问题