Fatal error in building SQLCipher ('openssl/rand.h' file not found)
Asked Answered
T

4

6

I am trying to build SQLCipher on my mac and getting fatal error after running make.

System : OS X El Capitan I installed openssl after following this instruction.

Before running make I statically linked libcrypto.a with command

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

Error I got

sqlite3.c:18280:10: fatal error: 'openssl/rand.h' file not found
#include <openssl/rand.h>
         ^
1 error generated.
make: *** [sqlite3.lo] Error 1
Typebar answered 11/4, 2016 at 17:48 Comment(0)
Z
1

Make sure that brew has linked to openssl libraries correctly. Run this command

 brew link openssl --force

Then try again.

Zuniga answered 11/4, 2016 at 17:58 Comment(1)
Thats. I just had to add --overwrite optionTypebar
P
3

I encountered this specifically for a golang library I was trying to install. I was getting the following error when I tried to run go get github.com/xeodou/go-sqlcipher:

# github.com/xeodou/go-sqlcipher
project/src/github.com/xeodou/go-sqlcipher/sqlite3-binding.c:18280:10: fatal error: 'openssl/rand.h' file not found

I fixed this by adding the following to my bash profile:

export CGO_LDFLAGS="-L/usr/local/opt/openssl/lib"
export CGO_CPPFLAGS="-I/usr/local/opt/openssl/include"

Hopefully this helps.

Photomicroscope answered 18/7, 2017 at 15:53 Comment(0)
Z
1

Make sure that brew has linked to openssl libraries correctly. Run this command

 brew link openssl --force

Then try again.

Zuniga answered 11/4, 2016 at 17:58 Comment(1)
Thats. I just had to add --overwrite optionTypebar
M
1

I didn't have brew on my machine, but I fixed this error a different way. In Xcode, I went to Preferences->locations->"source trees"-> Click +, set OPENSSL_SRC to "full-path-to-openssl-source"

Misshape answered 25/4, 2016 at 22:42 Comment(0)
A
0

I did all that, but the thing that worked for me is : brew reinstall openssl, of course you should be the owner of /usr/local, to make sure of that : sudo chown -R username /usr/local.

Hopefully this will help anyone in need.

Additament answered 26/7, 2018 at 14:45 Comment(1)
Latest macos versions won't let you change the ownership of /usr/local. But you can still change the owner of the subfolders, therefore you should use instead sudo chown -R username /usr/local/*Hawsepipe

© 2022 - 2024 — McMap. All rights reserved.