Error building sqlcipher on macOS Monterey, C compiler cannot create executables

Trying to run ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto", got following error:

checking build system type... arm-apple-darwin21.6.0
checking host system type... arm-apple-darwin21.6.0
checking how to print strings... printf
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/Users/mohitsingh/Desktop/libnunchuk/contrib/sqlcipher':
configure: error: C compiler cannot cr

Config log is present in this gist

on building openssl according to this blog, I got libcrypto.a file and used ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="/path/to/libcrypto.a" to build statically but now I got different error saying Library crypto not found. Install openssl!".

Config log is present in this gist.

How can I build it?

Hi @mohit

From your config.log there is a warning:

ld: warning: ignoring file /Users/mohitsingh/Desktop/libnunchuk/contrib/openssl/libcrypto.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64

You will want to revisit the build of OpenSSL on your machine.

Hey @developernotes , Thanks for the quick reply.

I am actually building sqlcipher for building nunchuk. It includes both openssl and sqlcipher as subdirectories. On using libcrypto.a from this openssl, I’m getting the Library crypto not found error but on using openssl installed from homebrew, I’m getting the same error but a different config log. This log does not contain the warning you mentioned. On using --with-crypto-lib=none, configure is able to complete but make fails with 'openssl/rand.h' file not found.