I am using Ubuntu 16.04 with Node 4.6.1 and NPM 2.15.9 to cross compile sqlite3(with sqlcipher support) for Colibri-iMX6. I have the same node version on Ubuntu and Embedded Linux (morty). I have sqlite3 installed in the Linux Image as well as SDK.
I started out with exporting the environment variables from SDK. First, I cross-compiled OpenSSL 1.0.2 followed by Sqlcipher. I got a static library from sqlcipher (libsqlcipher.a) whose path is exported to the LDFLAGS.
I am using the following command to cross compile:
npm install sqlite3 --target_arch=arm --enable-static=yes --build-from-source --sqlite_libname=sqlcipher -fPIC --sqlite=home/onkar/Library/sqlcipher-master/.libs --verbose
The error I get while cross compiling is as follows:
/home/onkar/linuximage/sdk/sysroots/x86_64-angstromsdk-linux/usr/libexec/arm-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/5.2.1/real-ld: error: /home/onkar/Library/sqlcipher-master/.libs/libsqlcipher.a(sqlite3.o): requires unsupported dynamic reloc R_ARM_THM_MOVW_ABS_NC; recompile with -fPIC
collect2: error: ld returned 1 exit status
node_sqlite3.target.mk:129: recipe for target 'Release/obj.target/node_sqlite3.node' failed
make: *** [Release/obj.target/node_sqlite3.node] Error 1
make: Leaving directory '/home/onkar/node_modules/sqlite3/build'
Can someone please help me resolve this error ?
Thanks,
Onkar