Compiling SQLCipher CLI for m1 Mac

Sorry if this is covered elsewhere, but I didn’t manage to find it.

I am trying to compile CLI on m1 Mac.

If I run configure && make it compiles ok, and CLI works with SQLite databases, but when I am trying to migrate it to encrypted database it errors:

Parse error: no such function: sqlcipher_export
  SELECT sqlcipher_export('encrypted');
         ^--- error here

If I run:

../configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"

or

../configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="/usr/local/lib/libcrypto.a"

as readme suggested it compiles to a larger sqlcipher file (~4.5mb vs 1.5mb) but it fails to run with:

zsh: killed     sqlcipher

I also tried to migrate in DB Browser for SQLite, but it failed on ATTACH:

Result: unable to open database: ...

I am clearly missing something, please help!