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

**URL:** <https://discuss.zetetic.net/t/error-building-sqlcipher-on-macos-monterey-c-compiler-cannot-create-executables/5521>\
**Category:** Uncategorized\
**Created:** [August 23, 2022, 3:28pm UTC](https://discuss.zetetic.net/t/error-building-sqlcipher-on-macos-monterey-c-compiler-cannot-create-executables/5521 "2022-08-23T15:28:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohit](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/mohit/32/1856_2.png) [@mohit](https://discuss.zetetic.net/u/mohit)\
**Post date:** [August 23, 2022, 3:28pm UTC](https://discuss.zetetic.net/t/error-building-sqlcipher-on-macos-monterey-c-compiler-cannot-create-executables/5521/1 "2022-08-23T15:28:46Z")

</div>

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

```auto
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](https://gist.github.com/slice-mohit/35b8527542e2c275df8eabf1ab29e780)

on building openssl according to [this blog](https://vinceyuan.github.io/build-sqlcipher-on-mac-os-x/), 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](https://gist.github.com/slice-mohit/4ac01e08d916ab857f11a5a1b4a0b89e).

How can I build it?

---

<div class="post-metadata">

**Author:** ![developernotes](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/developernotes/32/1309_2.png) [@developernotes](https://discuss.zetetic.net/u/developernotes)\
**Post date:** [August 23, 2022, 4:10pm UTC](https://discuss.zetetic.net/t/error-building-sqlcipher-on-macos-monterey-c-compiler-cannot-create-executables/5521/2 "2022-08-23T16:10:12Z")

</div>

Hi @mohit

From your [`config.log`](https://gist.github.com/slice-mohit/4ac01e08d916ab857f11a5a1b4a0b89e#file-config-log-L92) there is a warning:

```auto
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.

---

<div class="post-metadata">

**Author:** ![mohit](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/mohit/32/1856_2.png) [@mohit](https://discuss.zetetic.net/u/mohit)\
**Post date:** [August 24, 2022, 3:42am UTC](https://discuss.zetetic.net/t/error-building-sqlcipher-on-macos-monterey-c-compiler-cannot-create-executables/5521/3 "2022-08-24T03:42:29Z")

</div>

Hey @developernotes , Thanks for the quick reply.

I am actually building sqlcipher for building [nunchuk](https://github.com/nunchuk-io/libnunchuk). 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](https://gist.github.com/slice-mohit/2a2e7793fd124a3c3acd8f9ee47eeb86). 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`.
