Can it be cross-compiled from x86 to Apple silicon (arm64)?
Hi there @plananderson with regards to the above question the answer is yes (use compiler Apple clang version 12.0.0 (clang-1200.0.32.29)).
You can try it yourself, by following the " Build and Run it yourself" section of docs here, or just do as follows:
git clone --recursive https://github.com/RedisTimeSeries/RedisTimeSeries.git
cd RedisTimeSeries
make
redis-server --loadmodule ./bin/macos-x64-release/redistimeseries.so
Sample output:
fco@fcos-Air RedisTimeSeries % redis-server --loadmodule ./bin/macos-x64-release/redistimeseries.so
13847:C 28 Jul 2021 19:02:35.684 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
13847:C 28 Jul 2021 19:02:35.684 # Redis version=6.2.1, bits=64, commit=92bde124, modified=0, pid=13847, just started
13847:C 28 Jul 2021 19:02:35.684 # Configuration loaded
13847:M 28 Jul 2021 19:02:35.684 * Increased maximum number of open files to 10032 (it was originally set to 2560).
13847:M 28 Jul 2021 19:02:35.684 * monotonic clock: POSIX clock_gettime
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 6.2.1 (92bde124/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 13847
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
13847:M 28 Jul 2021 19:02:35.687 # Server initialized
13847:M 28 Jul 2021 19:02:36.245 * <timeseries> RedisTimeSeries version 999999, git_sha=d3a96b5dd78e1f02f71af2cce0b62bc50b560303
13847:M 28 Jul 2021 19:02:36.245 * <timeseries> Redis version found by RedisTimeSeries : 6.2.1 - oss
13847:M 28 Jul 2021 19:02:36.245 # <timeseries> could not initialize RedisGears_GetCompiledOs
13847:M 28 Jul 2021 19:02:36.245 # <timeseries> Failed initialize RedisGears API
13847:M 28 Jul 2021 19:02:36.245 * Module 'timeseries' loaded from ./bin/macos-x64-release/redistimeseries.so
13847:M 28 Jul 2021 19:02:36.246 * Ready to accept connections
Closing the issue give I believe the above info should be enough to get you up and running. Feel free to reopen if required
@filipecosta90 Thank you for quick reply, but I am not sure about this.
Some insights here:
When I am building redis I am using CFLAGS="-target arm64-apple-macos11" LDFLAGS="-target arm64-apple-macos11" make
after that I can confirm that I have arm64 using lipo -info src/redis-server
Non-fat file: src/redis-server is architecture: arm64
If I am doing the same for RedisTimeSeries I get:
building with CFLAGS="-target arm64-apple-macos11" LDFLAGS="-target arm64-apple-macos11" make build
getting this after lipo -info bin/macos-x64-release/redistimeseries.so
Non-fat file: bin/macos-x64-release/redistimeseries.so is architecture: x86_64
@plananderson using your exact command:
RedisTimeSeries % CFLAGS="-target arm64-apple-macos11" LDFLAGS="-target arm64-apple-macos11" make build
(...)
(base) fco@fcos-Air RedisTimeSeries % lipo -info ./bin/macos-x64-release/redistimeseries.so
Non-fat file: ./bin/macos-x64-release/redistimeseries.so is architecture: arm64
my M1 system:
uname -a
Darwin fcos-Air.Home 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:06:51 PST 2021; root:xnu-7195.81.3~1/RELEASE_ARM64_T8101 arm64
cc --version
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: arm64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Are you cross-compiling from an Intel-based Mac computer? If so I suggest we re-open the issue and ping @chayim to give his opinion why your not able to produce an arm64 binary from your x86 machine and how to fix it.
PS: CFLAGS are not taking effect on the build, so if you're indeed building from an x86 machine the build will not work. @chayim please acknowledge :)
@plananderson I'll rephrase the issue name if you don't mind to "Can it be cross-compiled to Apple silicon (M1) "
Thanks, that's my case. I am trying to cross-compile it, on x86_64.
CC: @rafie
Any news on this case ?
@rafie @chayim whats the status here?
Is there any news on this?
@doppleware you can try an arm docker.
docker pull redisfab/redistimeseries:1.6.9-arm64v8-bionic
docker pull redisfab/redistimeseries:1.6.9-arm64v8-focal