Compiling on Mac OSX


#1

Hello,

I’m trying to compile SQL Cipher on Mac OSX but am encountering compilation errors.
My objective is to link the resulting SQLCipher static library in a Qt project, using Qt Creator (not doing anything with XCode).

I cloned the git repository.
I installed libcrypto via home brew (brew install openssl) and verified that worked ok.
I ran configure, which appears to have completed successfully.

sqlcipher > ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="/usr/local/opt/openssl/lib/libcrypto.a" CFLAGS="-I/usr/local/opt/openssl/include/"   

During the make process, I there are compilation errors. Maybe I have to build OpenSSL by hand. This is where the error output starts, I can upload the whole output if needed.

libtool: compile:  gcc -I/usr/local/opt/openssl/include/ -DSQLCIPHER_CRYPTO_OPENSSL -DSQLITE_OS_UNIX=1 -I. -I/Users/khamilton/Documents/sqlcipher/src -I/Users/khamilton/Documents/sqlcipher/ext/rtree -I/Users/khamilton/Documents/sqlcipher/ext/icu -I/Users/khamilton/Documents/sqlcipher/ext/fts3 -I/Users/khamilton/Documents/sqlcipher/ext/async -I/Users/khamilton/Documents/sqlcipher/ext/session -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -I/System/Library/Frameworks/Tcl.framework/Versions/8.5/Headers -DSQLITE_THREADSAFE=1 -DSQLITE_TEMP_STORE=2 -c sqlite3.c  -fno-common -DPIC -o .libs/sqlite3.o
sqlite3.c:33607:42: error: use of undeclared identifier 'mmap'
  { "mmap",         (sqlite3_syscall_ptr)mmap,            0 },
                                         ^
sqlite3.c:33614:42: error: use of undeclared identifier 'munmap'
  { "munmap",       (sqlite3_syscall_ptr)munmap,          0 },
                                         ^
sqlite3.c:33684:22: error: invalid application of 'sizeof' to an incomplete type 'struct unix_syscall []'
    for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){

#2

Well, this may have been a case of the first CFLAGS argument getting overwritten by the second in the configure call. I changed it to one CFLAGS, and making appears to work.

sqlcipher > ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -I/usr/local/opt/openssl/include/" LDFLAGS="/usr/local/opt/openssl/lib/libcrypto.a"

#3

Hi @rem45acp

Yes, you will only want to declare one CFLAGS variable to be passed to ./configure. We are glad to hear everything is working well for you now. Take care!