Compiling SQLCipher in Windows 7 - 64 bit

I am trying to compile SQLCipher in Winddows 7 - 64 bit OS. I followed the steps similar to the link provided:

http://www.jerryrw.com/howtocompile.php

Configure command:

./configure --disable-tcl --with-crypto-lib=none CFLAGS="-DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -Ic:/OpenSSLbuild32/include" LDFLAGS=“c:/sqlcipher/libeay32.lib”

Whild doing make sqlite3.c, I got the following error:

IC007573@AAEINBR137011L /c/sqlcipher
$ make sqlite3.c
gcc -DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -Ic:/OpenSSLbuild32/include -
o mkkeywordhash.exe /c/sqlcipher/tool/mkkeywordhash.c
./mkkeywordhash.exe >keywordhash.h
gcc -DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -Ic:/OpenSSLbuild32/include -
o lemon.exe /c/sqlcipher/tool/lemon.c
cp /c/sqlcipher/src/lempar.c .
cp /c/sqlcipher/src/parse.y .
rm -f parse.h
./lemon.exe parse.y
mv parse.h parse.h.temp
gawk -f /c/sqlcipher/addopcodes.awk parse.h.temp >parse.h
cat parse.h /c/sqlcipher/src/vdbe.c | gawk -f /c/sqlcipher/mkopcodeh.awk >opcode
s.h
gawk -f /c/sqlcipher/mkopcodec.awk opcodes.h >opcodes.c
tclsh /c/sqlcipher/tool/mksqlite3h.tcl /c/sqlcipher >sqlite3.h
/bin/sh: tclsh: command not found
make: *** [sqlite3.h] Error 127

Can you please help me to resolve this issue to proceed further?

Regards
dpmkarthik

Hello @RamanK

Can you try installing Tcl 8.5 on your machine, making sure it binaries are on your path and then continuing with your SQLCipher build.

Hi,

Thanks for your reply. I was able to proceed to the next steps after downloading Tcl 8.5.
I did
make clean --> success
make sqlite3.c --> success
make --> failed

$ make
./libtool --mode=compile --tag=CC gcc -DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPEN
SSL -Ic:/OpenSSLbuild32/include -DSQLITE_OS_WIN=1 -I. -I/c/sqlcipher/src -I/c/sq
lcipher/ext/rtree -I/c/sqlcipher/ext/fts3 -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite
-DNDEBUG -DSQLITE_THREADSAFE=1 -DSQLITE_TEMP_STORE=1 -c sqlite3.c
libtool: compile: gcc -DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -Ic:/OpenSS
Lbuild32/include -DSQLITE_OS_WIN=1 -I. -I/c/sqlcipher/src -I/c/sqlcipher/ext/rtr
ee -I/c/sqlcipher/ext/fts3 -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -DSQL
ITE_THREADSAFE=1 -DSQLITE_TEMP_STORE=1 -c sqlite3.c -DDLL_EXPORT -DPIC -o .libs
/sqlite3.o
libtool: compile: gcc -DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -Ic:/OpenSS
Lbuild32/include -DSQLITE_OS_WIN=1 -I. -I/c/sqlcipher/src -I/c/sqlcipher/ext/rtr
ee -I/c/sqlcipher/ext/fts3 -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -DSQL
ITE_THREADSAFE=1 -DSQLITE_TEMP_STORE=1 -c sqlite3.c -o sqlite3.o >/dev/null 2>&1

./libtool --mode=link gcc -DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -Ic:/Ope
nSSLbuild32/include -DSQLITE_OS_WIN=1 -I. -I/c/sqlcipher/src -I/c/sqlcipher/ext/
rtree -I/c/sqlcipher/ext/fts3 -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -
DSQLITE_THREADSAFE=1 c:/sqlcipher/libeay32.lib -o libsqlcipher.la sqlite3.lo

-rpath “/usr/local/lib” -version-info "8:6:8"
libtool: link: warning: undefined symbols not allowed in i686-pc-mingw32 shared
libraries
libtool: link: ar cru .libs/libsqlcipher.a sqlite3.o
libtool: link: ranlib .libs/libsqlcipher.a
libtool: link: ( cd “.libs” && rm -f “libsqlcipher.la” && cp -pR “…/libsqlciphe
r.la” “libsqlcipher.la” )
./libtool --mode=link gcc -DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -Ic:/Ope
nSSLbuild32/include -DSQLITE_OS_WIN=1 -I. -I/c/sqlcipher/src -I/c/sqlcipher/ext/
rtree -I/c/sqlcipher/ext/fts3 -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -
DSQLITE_THREADSAFE=1 c:/sqlcipher/libeay32.lib -DHAVE_READLINE=0
-o sqlcipher.exe /c/sqlcipher/src/shell.c libsqlcipher.la
-rpath "/usr/local/lib"
libtool: link: gcc -DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -Ic:/OpenSSLbui
ld32/include -DSQLITE_OS_WIN=1 -I. -I/c/sqlcipher/src -I/c/sqlcipher/ext/rtree -
I/c/sqlcipher/ext/fts3 -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -DSQLITE_
THREADSAFE=1 c:/sqlcipher/libeay32.lib -DHAVE_READLINE=0 -o .libs/sqlcipher.exe
/c/sqlcipher/src/shell.c ./.libs/libsqlcipher.a -L/usr/local/lib
./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x3dc8): undefined reference
to RAND_add' ./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x3e0b): undefined reference toEVP_get_cipherbyname’
./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x3e30): undefined reference
to OPENSSL_add_all_algorithms_noconf' ./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x3eb0): undefined reference toEVP_cleanup’
./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x3f18): undefined reference
to RAND_bytes' ./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x3f4b): undefined reference toHMAC_CTX_init’
./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x3f50): undefined reference
to EVP_sha1' ./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x3f78): undefined reference toHMAC_Init_ex’
./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x3f94): undefined reference
to HMAC_Update' ./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x3fb0): undefined reference toHMAC_Update’
./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x3fcf): undefined reference
to HMAC_Final' ./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x3fdd): undefined reference toHMAC_CTX_cleanup’
./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x401f): undefined reference
to PKCS5_PBKDF2_HMAC_SHA1' ./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x405d): undefined reference toEVP_CipherInit’
./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x4073): undefined reference
to EVP_CIPHER_CTX_set_padding' ./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x409e): undefined reference toEVP_CipherInit’
./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x40cb): undefined reference
to EVP_CipherUpdate' ./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x40fc): undefined reference toEVP_CipherFinal’
./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x4113): undefined reference
to EVP_CIPHER_CTX_cleanup' ./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x4131): undefined reference toEVP_get_cipherbyname’
./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x4161): undefined reference
to EVP_CIPHER_nid' ./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x4169): undefined reference toOBJ_nid2sn’
./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x417e): undefined reference
to EVP_CIPHER_key_length' ./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x4193): undefined reference toEVP_CIPHER_iv_length’
./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x41a8): undefined reference
to EVP_CIPHER_block_size' ./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x41b5): undefined reference toEVP_sha1’
./.libs/libsqlcipher.a(sqlite3.o):sqlite3.c:(.text+0x41bd): undefined reference
to `EVP_MD_size’
collect2.exe: error: ld returned 1 exit status
make: *** [sqlcipher.exe] Error 1

Could you help me what is going wrong and how to fix this?

Regards
dpmkarthik

Hello @RamanK

Can you check your path to the OpenSSL header search path? Does c:/Ope nSSLbuild32/include exist?

@RamanK it looks like you are not successfully linking with OpenSSL. I’d suggest you start looking there. Perhaps create a small standalone program and verify that you can successfully link whatever OpenSSL library you are using.

I am using openssl binaries successfully with my web server. Do you have any specific suggestion what has gone wrong. Why make is complaining these linker error. 1 point related to openssl, I have switched off DES cipher suite. I also reverted not to switch off. Same results.
Regards
RamanK

Have you worked it out? Maybe, it’s because the openssl you built is 64bit, but the sqlcipher you are building is 32bit.

How to specify compiling as 64bit under windows?

Finally I end up with 32bit