从 macOS 构建 sqlcipher3 时出现致命错误(未找到 'sqlcipher/sqlite3.h' 文件)

Fatal error when building sqlcipher3 from macOS ('sqlcipher/sqlite3.h' file not found)

我一直在尝试使用以下命令在 MacOS 上构建 sqlcipher3:

git clone https://github.com/coleifer/sqlcipher3 && cd sqlcipher3
python3 setup.py build

我收到以下错误:

$ python3 setup.py build
running build
running build_py
creating build
creating build/lib.macosx-10.14-x86_64-3.7
creating build/lib.macosx-10.14-x86_64-3.7/sqlcipher3
copying sqlcipher3/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/sqlcipher3
copying sqlcipher3/dbapi2.py -> build/lib.macosx-10.14-x86_64-3.7/sqlcipher3
running build_ext
Builds a C extension linking against libsqlcipher library
building 'sqlcipher3._sqlite3' extension
creating build/temp.macosx-10.14-x86_64-3.7
creating build/temp.macosx-10.14-x86_64-3.7/src
xcrun -sdk macosx clang -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Qunused-arguments -DMODULE_NAME="sqlcipher3.dbapi2" -I/usr/include -I/Users/gab/Downloads/testbuild/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/include/python3.7m -c src/module.c -o build/temp.macosx-10.14-x86_64-3.7/src/module.o
In file included from src/module.c:24:
src/connection.h:34:10: fatal error: 'sqlcipher/sqlite3.h' file not found
#include "sqlcipher/sqlite3.h"
         ^~~~~~~~~~~~~~~~~~~~~
1 error generated.
error: command 'xcrun' failed with exit status 1

但是 sqlcypher 正确安装了 brew:

$ brew install sqlcipher
Warning: sqlcipher 4.4.2 is already installed and up-to-date
To reinstall 4.4.2, run `brew reinstall sqlcipher`

并且在这个过程中添加了sqlite3.h

$ find /usr/local/Cellar -name sqlite3.h
/usr/local/Cellar/sqlite/3.33.0/include/sqlite3.h
/usr/local/Cellar/sqlite/3.34.0/include/sqlite3.h
/usr/local/Cellar/sqlcipher/4.4.2/include/sqlcipher/sqlite3.h

有什么我遗漏的吗?我应该在 运行 python3 setup.py build 时添加路径标志吗?

我不太确定问题的原因,
但是您是否考虑过 从 github 手动下载它并将其设置在使用它的代码 附近?

我知道这可能不是您正在寻找的解决方案,但它可能就是全部...

我认为您更有可能在 SQLCipher discussion board 上找到此问题的答案。

我愿意

C_INCLUDE_PATH=/usr/local/Cellar/sqlcipher/4.4.2/include LIBRARY_PATH=/usr/local/Cellar/sqlcipher/4.4.2/lib python3 setup.py build

试一试。