Skip to content

Conversation

@robertjpayne
Copy link
Contributor

Description

This adds the necessary assembly to support ARM64 and AARCH64. I need help getting tests setup on other platforms as I've primarily tested this assembly on an iPhone 6s.

This resolves #5265

@robertjpayne
Copy link
Contributor Author

Also a massive shout out to @raedwulf for his help with the assembly!

@AtnNn
Copy link
Member

AtnNn commented Jul 14, 2017

Wonderful!

What is the difference between __arm64__ and __aarch64__?

Your changes sometimes check only for one of those, sometimes for both.

@AtnNn AtnNn added this to the 2.5 milestone Jul 14, 2017
@robertjpayne
Copy link
Contributor Author

@AtnNn sorry I had missed one, as far as I know for the general assembly the instructions and ABI is the same -- the main difference between ARM64 and AARCH64 is on the fringe instructions.

Apple uses ARM64 on iOS and I'm unsure if other providers do or not while most 64-bit ARM linux servers use AARCH64

@al-sabr
Copy link

al-sabr commented Jul 16, 2017

This is what happens when I try to compile from your repo:

Based on tutorial at : https://rethinkdb.com/docs/build/

 ./configure --allow-fetch
* Detecting system configuration
Bash:                           4.3.30(1)-release
Use ccache:                     no
C++ Compiler:                   GCC 6.4.0 (/usr/bin/c++)
Host System:                    aarch64-linux-gnu
Build System:                   Linux 4.12.0-gx-117136-g44bd33f aarch64
Cross-compiling:                no
Host Operating System:          Linux
* Error: unsupported architecture: aarch64-linux-gnu

* Aborting configure

@robertjpayne
Copy link
Contributor Author

@gdeverlant I didn't update any of the build scripts so that may be what's causing the issue…

@al-sabr
Copy link

al-sabr commented Jul 16, 2017

After changing the line 105 from configure to this it compiles :

https://github.com/robertjpayne/rethinkdb/blob/feature/arm64/configure#L105

    case "${MACHINE%%-*}" in
        x86_64|i?86)
            true ;;
        arm*|aarch*)
            var_append LDFLAGS -ldl
            final_warning="ARM support is still experimental" ;;

@al-sabr
Copy link

al-sabr commented Jul 16, 2017

$ make -j4
    [1/473] FETCH node_6.11.0
    [2/473] INSTALL-INCLUDE gtest_1.7.0
    [3/473] FETCH protobuf_2.5.0
    [4/473] FETCH re2_2015-11-01
    [5/473] FETCH v8_3.30.33.16-patched
    [6/473] FETCH boost_1.60.0
    [7/473] FETCH zlib_1.2.11
    [8/473] FETCH curl_7.54.1
    [9/473] FETCH openssl_1.0.2l
    [10/473] FETCH jemalloc_4.5.0
    [11/473] FETCH libidn_1.28
    [12/473] BUILD openssl_1.0.2l
    [13/473] CP build/release/rethinkdb-gdb.py
    [14/473] CONVERT_PROTOFILE build/drivers/ruby/lib/ql2.pb.rb
    [15/473] CONVERT_PROTOFILE drivers/ruby/lib/ql2.pb.rb
    [16/473] CP ./build/drivers/python/rethinkdb/
    [17/473] CONVERT_PROTOFILE build/drivers/python/rethinkdb/ql2_pb2.py
    [18/473] CONVERT_PROTOFILE drivers/python/rethinkdb/ql2_pb2.py
    [19/473] BUILD node_6.11.0
    [20/473] CONVERT_PROTOFILE build/drivers/javascript/proto-def.js
    [21/473] INSTALL-INCLUDE protobuf_2.5.0
    [22/473] INSTALL-INCLUDE re2_2015-11-01
    [23/473] INSTALL-INCLUDE v8_3.30.33.16-patched
    [24/473] INSTALL-INCLUDE zlib_1.2.11
    [25/473] INSTALL-INCLUDE curl_7.54.1
    [26/473] INSTALL-INCLUDE jemalloc_4.5.0
    [27/473] BUILD v8_3.30.33.16-patched
+ [[ /usr/bin/c++ = CLANG ]]
+ [[ /usr/bin/c++ = CLANG ]]
+ [[ Linux = Darwin ]]
+ arch_gypflags=
+ raspberry_pi_gypflags='-Darm_version=6 -Darm_fpu=vfpv2'
++ /usr/bin/c++ -dumpmachine
+ host=aarch64-linux-gnu
+ case ${host%%-*} in
+ arch=native
+ mode=release
+ [[ native = \s\3\9\0\x ]]
+ pkg_make native.release CXX=/usr/bin/c++ LINK=/usr/bin/c++ LINK.target=/usr/bin/c++ 'GYPFLAGS=-Dwerror= ' V=1
+ in_dir /mnt/virtual/compile/rethinkdb-arm64/build/external/v8_3.30.33.16-patched/build make native.release CXX=/usr/bin/c++ LINK=/usr/bin/c++ LINK.target=/usr/bin/c++ 'GYPFLAGS=-Dwerror= ' V=1
+ local dir=/mnt/virtual/compile/rethinkdb-arm64/build/external/v8_3.30.33.16-patched/build
+ shift
+ cd /mnt/virtual/compile/rethinkdb-arm64/build/external/v8_3.30.33.16-patched/build
+ make native.release CXX=/usr/bin/c++ LINK=/usr/bin/c++ LINK.target=/usr/bin/c++ 'GYPFLAGS=-Dwerror= ' V=1
make[2]: Entering directory '/mnt/virtual/compile/rethinkdb-arm64/build/external/v8_3.30.33.16-patched/build'
make[2]: *** No rule to make target 'native.release'.  Stop.
make[2]: Leaving directory '/mnt/virtual/compile/rethinkdb-arm64/build/external/v8_3.30.33.16-patched/build'

Full error log: ./build/external/v8_3.30.33.16-patched_install.log
mk/support/build.mk:148: recipe for target 'build/external/v8_3.30.33.16-patched/lib/libv8.a' failed
make[1]: *** [build/external/v8_3.30.33.16-patched/lib/libv8.a] Error 1
make[1]: *** Waiting for unfinished jobs....

Content of Full error log: ./build/external/v8_3.30.33.16-patched_install.log

+ pkg_depends_env
++ pkg_depends
++ true
+ pkg_install
+ pkg_copy_src_to_build
+ mkdir -p /mnt/virtual/compile/rethinkdb-arm64/build/external/v8_3.30.33.16-patched/build
+ cp -af /mnt/virtual/compile/rethinkdb-arm64/external/v8_3.30.33.16-patched/. /mnt/virtual/compile/rethinkdb-arm64/build/external/v8_3.30.33.16-patched/build
+ mkdir -p /mnt/virtual/compile/rethinkdb-arm64/build/external/v8_3.30.33.16-patched/lib
+ [[ /usr/bin/c++ = CLANG ]]
+ [[ /usr/bin/c++ = CLANG ]]
+ [[ Linux = Darwin ]]
+ arch_gypflags=
+ raspberry_pi_gypflags='-Darm_version=6 -Darm_fpu=vfpv2'
++ /usr/bin/c++ -dumpmachine
+ host=aarch64-linux-gnu
+ case ${host%%-*} in
+ arch=native
+ mode=release
+ [[ native = \s\3\9\0\x ]]
+ pkg_make native.release CXX=/usr/bin/c++ LINK=/usr/bin/c++ LINK.target=/usr/bin/c++ 'GYPFLAGS=-Dwerror= ' V=1
+ in_dir /mnt/virtual/compile/rethinkdb-arm64/build/external/v8_3.30.33.16-patched/build make native.release CXX=/usr/bin/c++ LINK=/usr/bin/c++ LINK.target=/usr/bin/c++ 'GYPFLAGS=-Dwerror= ' V=1
+ local dir=/mnt/virtual/compile/rethinkdb-arm64/build/external/v8_3.30.33.16-patched/build
+ shift
+ cd /mnt/virtual/compile/rethinkdb-arm64/build/external/v8_3.30.33.16-patched/build
+ make native.release CXX=/usr/bin/c++ LINK=/usr/bin/c++ LINK.target=/usr/bin/c++ 'GYPFLAGS=-Dwerror= ' V=1
make[2]: Entering directory '/mnt/virtual/compile/rethinkdb-arm64/build/external/v8_3.30.33.16-patched/build'
make[2]: *** No rule to make target 'native.release'.  Stop.
make[2]: Leaving directory '/mnt/virtual/compile/rethinkdb-arm64/build/external/v8_3.30.33.16-patched/build'

@robertjpayne
Copy link
Contributor Author

@gdeverlant yea looks like more build script tweaks necessary… I have a totally separate build system in place at the moment for my iOS support (which is why I ported to ARM64 to begin with) that doesn't include v8…

@al-sabr
Copy link

al-sabr commented Jul 16, 2017

Have a look at the last comment with the log.

Let me know ASAP I will test your changes to validate on my aarch64 board.

I found in this Dockerfile that something is different when compiling arm32 with make:
https://github.com/modul8com/rethinkdb-armv7-rpi2/blob/master/dockerfile#L19

./configure --with-system-malloc --allow-fetch

Do we need that also for arm64 or aarch64?

@robertjpayne
Copy link
Contributor Author

@gdeverlant try latest commits, I'm just toying at this point I have no idea if this is what is necessary…

@al-sabr
Copy link

al-sabr commented Jul 16, 2017

Retrying again let's see if this goes well !

@robertjpayne
Copy link
Contributor Author

@gdeverlant you in the slack channel might be easier to fix/do this over DM...

@al-sabr
Copy link

al-sabr commented Jul 16, 2017

Ok I'm coming

@al-sabr
Copy link

al-sabr commented Jul 16, 2017

I think we need to find the equivalent for 'GYPFLAGS=-Dwerror= -Darm_version=6 -Darm_fpu=vfpv2' for aarch64 and arm64.

arm_gypflags='-Darm_version=6 -Darm_fpu=vfpv2'

are only good for armv6,armv7 and armv5 I think

for arm64 or aarch64 the following should be :

-Darm_version=8

-Darm_fpu=we need to find the value of this. We need to find the Floating Point Unit which are available.

I found this https://github.com/imyller/meta-nodejs/pull/17/files maybe this can be an example.

I also found this https://groups.google.com/a/chromium.org/forum/#!topic/chromium-os-reviews/l0AyewBmRPI

+# Distributed under the terms of the GNU General Public License v2 
+ 
+CHROMEOS_KERNEL_SPLITCONFIG="chromiumos-arm64" 
+CHROMEOS_KERNEL_ARCH="arm64" 
+ 
+ARM_FPU=neon 
+ 
+# Proper toolchain config flags 
+ARM_FPU=crypto-neon-fp-armv8 
+MARCH_TUNE="-march=armv8-a+crc -mtune=cortex-a57.cortex-a53   
-mfpu=${ARM_FPU} -mfloat-abi=hard" 
+# Add the linker option to fix hardware errata to get the same build   
options 
+# as real hardware. 

@robertjpayne
Copy link
Contributor Author

I think it's going to be an issue with v8 more than anything?

@AtnNn
Copy link
Member

AtnNn commented Jul 22, 2017

Perhaps base your changes off of #6401

@srh
Copy link
Contributor

srh commented Dec 30, 2017

Hey @robertjpayne, can I merge this? (Should I?)

My guess is, if it's not working everywhere, it's still harmless and works some places, right?

@robertjpayne
Copy link
Contributor Author

The main issue was v8 working on arm64, I don't really have any time left to try and tidy this up but it should be mergable into #6401 easily? And yea it's all #if wraps so should be pretty harmless.

@srh
Copy link
Contributor

srh commented Dec 30, 2017

I guess I could disable JS and merge.

@srh srh self-assigned this Dec 30, 2017
@srh
Copy link
Contributor

srh commented Dec 30, 2017

Alright, I just merged and pushed. In next as of 433cbe7.

Thanks!

@srh srh closed this Dec 30, 2017
@srh
Copy link
Contributor

srh commented Apr 1, 2018

The change is now cherry-picked to the v2.4.x branch, too. fc0ca2e

@AtnNn AtnNn modified the milestones: 2.5, 2.4 Apr 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support 64 bit ARM architecture

4 participants