Out of memory error due to missing /dev/random

I cross compiled for QNX6.6 ARM platform and kept getting “Error: out of memory” response after trying to create a table on an encrypted db. I found it was due to a missing /dev/random and after starting the random utility it works as expected.

For example:

# ./sqlcipher encrypt_arm.db
SQLCipher version 3.8.10.2 2015-05-20 18:17:19
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> PRAGMA KEY = 'testphrase';
sqlite> CREATE TABLE test(id INTEGER PRIMARY KEY AUTOINCREMENT,data INTEGER);
Error: out of memory
sqlite> 

As a sidenote, the CODEC_TRACE (enabled by -DCODEC_DEBUG) was very useful for isolating the “memory error”, however that generated several issue when the database name was not set and it attempted to printf the name, such as within the case PragTyp_KEY where zDB is not checked whether it is valid.

This was my build setup for QNX6.6 cross-compile, without TCL support. Interestingly it was not able to auto-recognize the build machine:

CC="qcc -V4.7.3,gcc_ntoarmv7le" CFLAGS="-DSQLITE_HAS_CODEC" \
LD=arm-unknown-nto-qnx6.6.0eabi-ld LDFLAGS="-lcrypto" \
./configure --enable-tempstore=yes --host=arm-unknown-nto-qnx6.6.0eabi \
--build=x86_64-unknown-linux-gnu --prefix=$HOME/sqlcipher_arm
CC="qcc -V4.7.3,gcc_ntox86" CFLAGS="-DSQLITE_HAS_CODEC" \
LD=i486-pc-nto-qnx6.6.0-ld LDFLAGS="-lcrypto" \
./configure --enable-tempstore=yes --host=i486-pc-nto-qnx6.6.0 \
--build=x86_64-unknown-linux-gnu --prefix=$HOME/sqlcipher_x86

Hi @aarong

Thanks for sharing your experience building SQLCipher on QNX. Is this for a commercial application, or a personal project?