Closed zeroxia closed 2 years ago
Hi, I want to compile sqlite3mc's amalgamation source on qnx-700, with different build configurations include
aarch64
,armv7a
.
I don't have access to QNX. It can well be that adjustments to SQLite3MC's code are necessary to support QNX.
The toolchain of qnx-700 runs on a x86_64 Linux host.
If I run it with the provided C compiler:
sqlite3mc_amalgamation.c:250248:20: fatal error: endian.h: No such file or directory #include <endian.h>
Maybe this is a QNX version issue. According to the QNX 7.1 documentation the header file endian.h
exists in QNX 7.1.
Although there is:
/opt/qnx700/target/qnx7/usr/include/io-pkt/machine/endian.h
, I'm not sure whether it's the needed one. In the end I just commented this#include <endian.h>
line.
No idea, whether the mentioned header file is the right one. If the header file is not available in QNX in the default search path of the compiler, but the code compiles without it, we should probably simply add
#ifndef __QNX__
#include <endian.h>
#endif
Then there is error about platform-specific
entropy
function.The cross-compiler defines feature macro
__QNX__
, if I run it with command "/opt/qnx700/host/linux/x86_64/usr/bin/qcc", it has also__unix__
defined. If I run it with the command/opt/qnx700/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.0.0-gcc-5.4.0
, no__unix__
is defined.
Could you please try the following: Replace the line
#elif defined(__linux__) || defined(__unix__) || defined(__APPLE__)
by
#elif defined(__linux__) || defined(__unix__) || defined(__APPLE__) || defined(__QNX__)
I'm pretty sure that that should work.
My question is:
is this
entropy()
function the only platform specific stuff to deal with?
Yes.
If I don't care about the encryption strength, can I just call C standard
rand()
and fill the data in the buffer forentropy
?
In principle, you could do that. However, you could also use the SQLite function
void sqlite3_randomness(int N, void *P);
At least on Unix-like platforms this function uses the same method as SQLite3MC uses as a fallback method.
Commit 11a74620ba298f9ad4ad0791803e33a12c54851b applies the modifications I proposed. This should fix the issue.
Closing ... reopen if necessary.
Hi, I want to compile sqlite3mc's amalgamation source on qnx-700, with different build configurations include
aarch64
,armv7a
.The toolchain of qnx-700 runs on a x86_64 Linux host.
If I run it with the provided C compiler:
Although there is:
/opt/qnx700/target/qnx7/usr/include/io-pkt/machine/endian.h
, I'm not sure whether it's the needed one. In the end I just commented this#include <endian.h>
line.Then there is error about platform-specific
entropy
function.The cross-compiler defines feature macro
__QNX__
, if I run it with command "/opt/qnx700/host/linux/x86_64/usr/bin/qcc", it has also__unix__
defined. If I run it with the command/opt/qnx700/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.0.0-gcc-5.4.0
, no__unix__
is defined.So I copied the following two functions from
__unix__
section:static size_t read_urandom(void* buf, size_t n)
static size_t entropy(void* buf, size_t n)
And put them to a new
__QNX__
conditional compiling section, the compilation and linking of a simplisticmain()
function seemed OK, and the output program could be run on target board and callsqlite3_libversion()
, version string is printed.My question is:
is this
entropy()
function the only platform specific stuff to deal with?If I don't care about the encryption strength, can I just call C standard
rand()
and fill the data in the buffer forentropy
?Some doc on the qnx-700: https://www.qnx.com/developers/docs/7.0.0/#com.qnx.doc.neutrino.lib_ref/topic/manifests.html
Though the toolchain seems not freely available.