Closed PrimeDominus closed 3 years ago
The problem can be resolved by replacing line 526 of crypto.c, which is
#if defined(__linux__) && defined(SYS_getrandom)
by
#if defined(__APPLE__) && defined(__MAC_10_12) && __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_12
if (getentropy(buf, n) == 0)
return n;
#elif defined(__linux__) && defined(SYS_getrandom)
gcc sqleet.c shell.c -o sqleet -lpthread -ldl In file included from sqleet.c:9: ./crypto.c:528:9: warning: implicit declaration of function 'getentropy' is invalid in C99 [-Wimplicit-function-declaration] if (getentropy(buf, n) == 0) ^ 1 warning generated.
Sorry, I forgot to mention that you need to include the header file defining function getentropy
, for example after line 523 in crypto.c:
#if defined(__APPLE__) && defined(__MAC_10_12)
#include <sys/random.h>
#endif
Thanks for your help.
In addition to the steps @utelle has provided, we needed to ensure the right version of Python was used prior to running the gcc command. Otherwise the usage example on the Readme doesn't work when running:
[sqleet]% ./sqleet 'file:hello.db?key=swordfish' 'SELECT * FROM hello'
For those interested, this is because https://bugs.python.org/issue28676
Unfortunately, we found that running gcc in a new terminal window reverts to using the system default Python version (which doesn't have the fix) instead of our updated brew installed version.
We followed the steps in https://opensource.com/article/19/5/python-3-default-mac to install the latest version of Python and set it as global, and then ran the gcc command.
However, we had to do all this within the same terminal session, otherwise a new session would again revert to using the unpatched system default Python version.