journeyapps / node-sqlcipher

SQLCipher bindings for Node
https://journeyapps.com
BSD 3-Clause "New" or "Revised" License
207 stars 66 forks source link

sqlcipher-amalgamation-3031000/sqlite3.c:24328:10: fatal error: 'openssl/rand.h' file not found #66

Closed rodent129 closed 3 years ago

rodent129 commented 3 years ago

i am using the below comman for jourenyapps/sqlcipher and build sqlite3 from source on Mac Apple M1 chip. Node is v12.18.3, electron 11.0.0.

npm install @journeyapps/sqlcipher --runtime=electron --target=11.0.0 --sqlite_libname=sqlcipher --disturl=https://atom.io/download/atom-shell --build-from-source -w sqlite3

Got the error as below:

node-pre-gyp WARN Using request for node-pre-gyp https download 
  ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlcipher-amalgamation-3031000/sqlite3.c
  TOUCH Release/obj.target/deps/action_before_build.stamp
  TOUCH Release/obj.target/deps/copy_dll.stamp
  CC(target) Release/obj.target/sqlite3/gen/sqlcipher-amalgamation-3031000/sqlite3.o
Release/obj/gen/sqlcipher-amalgamation-3031000/sqlite3.c:24328:10: fatal error: 'openssl/rand.h' file not found
#include <openssl/rand.h>
         ^~~~~~~~~~~~~~~~
1 error generated.
make: *** [Release/obj.target/sqlite3/gen/sqlcipher-amalgamation-3031000/sqlite3.o] Error 1

openssl did installed. I manually tested for build-from-source sqlite3 is ok without sqlicipher as below: npm rebuild --runtime=electron --target=11.0.0 --disturl=https://atom.io/download/atom-shell --build-from-source --sqlite_libname=sqlcipher -w sqlite3

It successfully installed sqlite3@4.2.0, but install with @journeyapps/sqlcipher@4.1.0 it failed as above. I would like to ask that the journeyapps/sqlicipher has support for Apple M1 chip? My old mac intel chip is working good with above script. But new M1 mac is not working.

rodent129 commented 3 years ago

i am using the below comman for jourenyapps/sqlcipher and build sqlite3 from source on Mac Apple M1 chip. Node is v12.18.3, electron 11.0.0.

npm install @journeyapps/sqlcipher --runtime=electron --target=11.0.0 --sqlite_libname=sqlcipher --disturl=https://atom.io/download/atom-shell --build-from-source -w sqlite3

Got the error as below:

node-pre-gyp WARN Using request for node-pre-gyp https download 
  ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlcipher-amalgamation-3031000/sqlite3.c
  TOUCH Release/obj.target/deps/action_before_build.stamp
  TOUCH Release/obj.target/deps/copy_dll.stamp
  CC(target) Release/obj.target/sqlite3/gen/sqlcipher-amalgamation-3031000/sqlite3.o
Release/obj/gen/sqlcipher-amalgamation-3031000/sqlite3.c:24328:10: fatal error: 'openssl/rand.h' file not found
#include <openssl/rand.h>
         ^~~~~~~~~~~~~~~~
1 error generated.
make: *** [Release/obj.target/sqlite3/gen/sqlcipher-amalgamation-3031000/sqlite3.o] Error 1

openssl did installed. I manually tested for build-from-source sqlite3 is ok without sqlicipher as below: npm rebuild --runtime=electron --target=11.0.0 --disturl=https://atom.io/download/atom-shell --build-from-source --sqlite_libname=sqlcipher -w sqlite3

It successfully installed sqlite3@4.2.0, but install with @journeyapps/sqlcipher@4.1.0 it failed as above. I would like to ask that the journeyapps/sqlicipher has support for Apple M1 chip? My old mac intel chip is working good with above script. But new M1 mac is not working.

I export the 2 cflags and ldflags for openssl@1.1/lib and openssl@1.1/include. Then the error is solved. Sorry for bothering.

ozzlopz commented 3 years ago

@rodent129 how did you export those flags?

rodent129 commented 3 years ago

@rodent129 how did you export those flags?

In ~/.zshrc

export PATH=/opt/homebrew/opt/openssl@1.1/bin:$PATH export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib" export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"