How to cross compile redis for ARM32bit on Ubuntu x86_64 ?

329 views
Skip to first unread message

Eli Ko

unread,
Nov 15, 2019, 4:12:47 AM11/15/19
to Redis DB
I have tried to install arm-linux-gnueabi-gcc and add CC=arm-linux-gnueabi-gcc in Makefile before compiling but it didn't work. There is no ./configure in redis path so I don't know how to regenerate Makefile

Rafi Einstein

unread,
Nov 17, 2019, 9:40:33 AM11/17/19
to Redis DB
Cross-building Redis is not trivial.
You'd much rather invoke the following (after installing Docker on your x64 machine):

mkdir /tmp/redis-5.0.5-arm32v7
cid=$(docker create arm32v7/redis:5.0.5)
docker cp $cid/:/usr/local/bin/redis-server /tmp/redis-5.0.5-arm32v7
docker cp $cid/:/usr/local/bin/redis-cli /tmp/redis-5.0.5-arm32v7

Further instructions can be provided if you require Ubuntu-specific build.

Eli Ko

unread,
Nov 18, 2019, 9:36:20 PM11/18/19
to Redis DB
Thank you so much. I've copied redis-server and redis-cli, but there are some errors when I trying to run redis.

/tmp/usr/src/a/redis-5.0.5-arm32v7 # ./redis-server 
-sh: ./redis-server: not found
/tmp/usr/src/a/redis-5.0.5-arm32v7 # ./redis-cli 
-sh: ./redis-cli: not found

I think there are something wrong with my shard library.

$ sudo arm-nuvoton-linux-uclibceabi-readelf -d redis-5.0.5-arm32v7/redis-server
Dynamic section at offset 0x104ee8 contains 31 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
 0x00000001 (NEEDED)                     Shared library: [libdl.so.2]
 0x00000001 (NEEDED)                     Shared library: [librt.so.1]
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]

$ sudo ldd redis-5.0.5-arm32v7/redis-server
checking sub-depends for 'not found'
checking sub-depends for 'not found'
checking sub-depends for 'not found'
checking sub-depends for 'not found'
checking sub-depends for '/usr/lib/libpthread.so.0'
checking sub-depends for 'not found'
checking sub-depends for '/usr/lib/libdl.so.0'
checking sub-depends for '/usr/lib/libc.so.0'
libm.so.6 => not found (0x00000000)
libdl.so.2 => not found (0x00000000)
librt.so.1 => not found (0x00000000)
libgcc_s.so.1 => not found (0x00000000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00000000)
libc.so.6 => not found (0x00000000)
libdl.so.0 => /usr/lib/libdl.so.0 (0x00000000)
libc.so.0 => /usr/lib/libc.so.0 (0x00000000)
/lib/ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x00000000)

My libraries in /lib mostly are in version 0.9.33.2, and there is no libm.so.6 etc.

20191119103442.png






在 2019年11月17日星期日 UTC+8下午10:40:33,Rafi Einstein写道:

Rafi Einstein

unread,
Nov 19, 2019, 2:33:48 AM11/19/19
to Redis DB
As you're using a uclibc-based system, you'd probably would like to try replacing:
    cid=$(docker create arm32v7/redis:5.0.5)
with
    cid=$(docker create arm32v7/redis:5.0.6-alpine)
to get an Alpine-based Redis build.

However, note that this is a crude solution. One needs to match the uclibc version on your system to the one that is used to build Redis (exact maching is not required, just make sure the versions are compatible).
Reply all
Reply to author
Forward
0 new messages