Building SQLCipher on OS X
brew options sqlcipher brew install sqlcipher --with-fts which sqlcipher
If you needed to change options manually you could edit
export LDFLAGS="-L`brew --prefix`/opt/sqlcipher/lib" export CPPFLAGS="-I`brew --prefix`/opt/sqlcipher/include" npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=`brew --prefix`
Still pretty straightforward.
# clone the repo git clone https://github.com/sqlcipher/sqlcipher.git pushd sqlcipher # check if there are any interesting options ./configure --help # CFLAGS will turn on encryption, default temp_store to memory, # (file usage optional), enable full-text search, link to libcrypto ./configure CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=2 -DSQLITE_ENABLE_FTS3 -lcrypto" # just to be sure everything is in the initial state make clean # use as many CPUs as exist # (you could also use 'sysctl -n hw.physicalcpu', which would not include 'logical' cores) time make -j $(sysctl -n hw.ncpu)
It's a pretty quick compile
real 0m6.988s user 0m5.786s sys 0m1.537s
And finish up
sudo make install which sqlcipher
You'll probably need to use io.js. I definitely wouldn't expect this to work with node <= 0.12.
export LDFLAGS="-L/usr/local/lib" export CPPFLAGS="-I/usr/local/include -I/usr/local/include/sqlcipher" export CXXFLAGS="-I/usr/local/include -I/usr/local/include/sqlcipher" npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=/usr/local --verbose
For instructions on RPi or Linux, see Building SQLCipher for RPi 2.
There are test files at Building SQLCipher for node.js for both standalone sqlcipher and the node sqlcipher.
By AJ ONeal
Was this useful to you? Share it!give me a tip or hire me.