OverviewNative C APINode.js API

Complex Build: Redis for LTPS

Redis is an open-source (BSD-licensed), in-memory data structure store used as a database, cache and message broker.

LTPS has many software packages in its repository, but this package is not included. Case releases happen very often, and you may want to have the latest version of ReDis.

  • Create a build directory and download the latest source code:
[dv@localhost work]$ mkdir redis
[dv@localhost work]$ cd redis/
[dv@localhost redis]$ wget http://download.redis.io/redis-stable.tar.gz
--2016-10-05 14:24:31--  http://download.redis.io/redis-stable.tar.gz
Resolving download.redis.io (download.redis.io)...
Connecting to download.redis.io (download.redis.io)||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1571247 (1.5M) [application/x-gzip]
Saving to: 'redis-stable.tar.gz'

100%[======================================>] 1,571,247   3.00MB/s   in 0.5s

2016-10-05 14:24:32 (3.00 MB/s) - 'redis-stable.tar.gz' saved [1571247/1571247]

[dv@localhost redis]$ tar -xzf ./redis-stable.tar.gz
[dv@localhost redis]$ ls -l
total 1540
drwxr-xr-x 6 dv dv    4096 Sep 26 10:10 redis-stable/
-rw-r--r-- 1 dv dv 1571247 Sep 26 10:12 redis-stable.tar.gz
[dv@localhost redis]$ cd redis-stable/
[dv@localhost redis-stable]$

Set the LTPS SDK environment (if you've previously skipped this step):

[dv@localhost redis-3.2.4]$ . ~/tpssdk/environment-setup-cortexa8hf-neon-tps-linux-gnueabi

Redis.io README.md says:

"Just unpack and run "make"

Well, if you just run the Make utility it won't be built successfully because Redis makefiles are poorly written (buggy GCC flags manipulations).

  • Run build:
[dv@localhost redis-stable]$ make ARCH= MALLOC=libc FINAL_LDFLAGS+="-ldl"

Here is the list of required options:

  • MARCH= case when it wrongly detects target CPU
  • MALLOC=libc case when it can't build Jmalloc replacement correctly in the cross-compiler environment
  • FINAL_LDFLAGS+="-ldl" to add libdl during the link process (or Redis-server will not be linked)
  • Install the compiled Redis into the temporary folder in your home directory:
[dv@localhost redis-stable]$ make ARCH= MALLOC=libc FINAL_LDFLAGS+="-ldl" PREFIX=~/redis/ install
  • Copy into the /opt directory on the LTPS:
[dv@localhost redis-stable]$ scp -r ~/redis root@192.168.x.y:/opt/
  • Login to the LTPP3 board from the SSH client and run Redis.


OverviewNative C APINode.js API