rethinkdb_rebirth icon indicating copy to clipboard operation
rethinkdb_rebirth copied to clipboard

Support for ARM64

Open lag-linaro opened this issue 7 years ago • 13 comments

We are seeing some interest in running Rebirth (Rethink) on ARM64 based platforms.

Would it be possible for you guys to provide pre-built binaries as you do for X86 please?

lag-linaro avatar Aug 17 '18 10:08 lag-linaro

Hi @lag-linaro, we can't make any promises at the moment, but we are looking into it. We'll update this issue with the progress and direction.

floydkots avatar Aug 17 '18 10:08 floydkots

Sounds promising. Let me know if I can be of any assistance.

FYI, if you're looking for infrastructure:

http://docs.shippable.com/platform/tutorial/workflow/run-ci-builds-on-arm/

CodeFresh Arm Beta signup: https://goo.gl/forms/aDhlk56jZcblYokj1

If you need raw infrastructure for some reason the WorksOnArm project will supply full servers if you want to deal with metal: https://github.com/worksonarm/cluster/

lag-linaro avatar Aug 17 '18 10:08 lag-linaro

Thank you! Totally appreciate the links.

About assistance; if you haven't already, would you please join our community on spectrum? Most of the communication and planning goes on there.

floydkots avatar Aug 17 '18 11:08 floydkots

If you ever need a machine to build, I have been lent one to do it... and my repositories are already linked to aarch64 building machines at shippable.

gounthar avatar Oct 16 '18 09:10 gounthar

I have tried to build on a machine I have been lent, and got only one file issuing an error. Way cool!

 make
    [1/2] CC build/release/obj/arch/runtime/context_switching.o
src/arch/runtime/context_switching.cc:694:2: error: #error "Unsupported architecture."
 #error "Unsupported architecture."
  ^
src/arch/runtime/context_switching.cc: In constructor ‘artificial_stack_t::artificial_stack_t(void (*)(), size_t)’:
src/arch/runtime/context_switching.cc:272:28: error: ‘min_frame’ was not declared in this scope
     for (size_t i = 0; i < min_frame; i++) {
                            ^
src/arch/runtime/context_switching.cc: At global scope:
src/arch/runtime/context_switching.cc:696:1: error: expected string-literal before ‘)’ token
 );
 ^
src/build.mk:374: recipe for target 'build/release/obj/arch/runtime/context_switching.o' failed
make[1]: *** [build/release/obj/arch/runtime/context_switching.o] Error 1
Makefile:81: recipe for target 'make' failed
make: *** [make] Error 2

Here is what configure tells me:

 ./configure --allow-fetch
* Detecting system configuration
Bash:                           4.3.48(1)-release
Use ccache:                     no
C++ Compiler:                   GCC 5.4.0 (/usr/bin/c++)
Host System:                    aarch64-linux-gnu
Build System:                   Linux 4.15.0-34-generic aarch64
Cross-compiling:                no
Host Operating System:          Linux
Build Architecture:             aarch64
C++11:                          ok
Protobuf compiler:              /usr/bin/protoc
python:                         python 2.7.12
Google Test:                    external/gtest_1.7.0
termcap:                        no
boost_system:                   external/boost_1.60.0
protobuf:                       -lprotobuf
RE2:                            external/re2_2015-11-01
z:                              -lz
crypto:                         -lcrypto
ssl:                            -lssl
curl:                           -lcurl
malloc:                         jemalloc
jemalloc (static):              external/jemalloc_4.5.0
Test protobuf:                  ok
Test boost:                     ok
* Warning: ARM support is still experimental
Installation prefix:            /usr/local
Configuration prefix:           /usr/local/etc
Runtime data prefix:            /usr/local/var
* Wrote configuration to config.mk

gounthar avatar Oct 23 '18 09:10 gounthar

I have tried to build on a machine I have been lent, and got only one file issuing an error. Way cool!

That is cool. :smiley:

And in case you haven't solved it yet, here is the patch to make it compile cleanly:

diff --git a/src/arch/runtime/context_switching.cc b/src/arch/runtime/context_switching.cc
index 0e5b7f7c00..9e254a7957 100644
--- a/src/arch/runtime/context_switching.cc
+++ b/src/arch/runtime/context_switching.cc
@@ -260,7 +260,7 @@ artificial_stack_t::artificial_stack_t(void (*initial_fun)(void), size_t _stack_
 #elif defined(__arm__)
     // This slot is used to store r12.
     const size_t min_frame = 1;
-#elif defined(__arm64__)
+#elif defined(__arm64__) || defined(__aarch64__)
     // The ARM64 ABI requires the stack pointer to always be 16-byte-aligned at
     // all registers.
     const size_t min_frame = 1;
@@ -457,7 +457,7 @@ void context_switch(artificial_stack_context_ref_t *current_context_out, artific
 }
 
 asm(
-#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined (__s390x__) || defined (__powerpc64__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__arm64__) || defined(__aarch64__) || defined (__s390x__) || defined (__powerpc64__)
 // We keep architecture-specific code interleaved in order to enforce commonality.
 #if defined(__x86_64__)
 #if defined(__LP64__) || defined(__LLP64__)

lag-linaro avatar Oct 26 '18 12:10 lag-linaro

Thanks a lot. I applied your patch and managed to go 'til the end:

 rebirthdb
Recursively removing directory /root/rethinkdb/rebirthdb_data/tmp
Initializing directory /root/rethinkdb/rebirthdb_data
Running rebirthdb 2.3.2-windows-beta-579-g11ad11-dirty (GCC 5.4.0)...
Running on Linux 4.15.0-34-generic aarch64
Loading data from directory /root/rethinkdb/rebirthdb_data
Listening for intracluster connections on port 29015
Listening for client driver connections on port 28015
Listening for administrative HTTP connections on port 8080
Listening on cluster addresses: 127.0.0.1, ::1
Listening on driver addresses: 127.0.0.1, ::1
Listening on http addresses: 127.0.0.1, ::1
To fully expose RebirthDB on the network, bind to all addresses by running rebirthdb with the `--bind all` command line option.
Server ready, "rethinkdb_docker_image_temp_xx2" 378468ed-a39f-4dd5-9a34-ab94bc758920
A newer version of the RebirthDB server is available: 2.3.6. You can read the changelog at <https://github.com/rethinkdb/rethinkdb/releases>.

I don't know why I get this 2.3.2-windows-beta though...

gounthar avatar Oct 26 '18 13:10 gounthar

Which branch are you on?

lag-linaro avatar Oct 26 '18 14:10 lag-linaro

On branch next.

gounthar avatar Oct 26 '18 15:10 gounthar

Looks like it's hard coded into src/gxen/web_assets.cc.

Probably take with a pinch of salt.

lag-linaro avatar Oct 26 '18 15:10 lag-linaro

Thanks. If you ever want to have a try at it, have a look at https://github.com/gounthar/rethinkdb/releases/download/aarch64/rebirthdb_2.3.2+windows+beta+579+g11ad11+dirty.0_arm64.deb.gz .

gounthar avatar Oct 26 '18 16:10 gounthar

That's okay, I've built my own.

So now that we know this works, we should lobby for support.

Someone is meant to be working on this.

They were busy during the v2.4 release, but it is on the roadmap for v2.5

https://spectrum.chat/?t=f288604b-8db8-43be-b7f0-2f3a7b343e1c

lag-linaro avatar Oct 26 '18 16:10 lag-linaro

Road-map for v2.5 has been postponed indefinitely due to a lack of developers.

Not sure where that leaves AArch64 support. I have followed up on the Spectrum chat.

https://spectrum.chat/?t=f288604b-8db8-43be-b7f0-2f3a7b343e1c

lag-linaro avatar Nov 27 '18 09:11 lag-linaro