Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we update the $arch for aarch64 to have capability to choose arm64? #71

Open
homma opened this issue Nov 23, 2018 · 0 comments · May be fixed by #75
Open

Can we update the $arch for aarch64 to have capability to choose arm64? #71

homma opened this issue Nov 23, 2018 · 0 comments · May be fixed by #75

Comments

@homma
Copy link

homma commented Nov 23, 2018

Currently, $arch for aarch64 is set as "armv7l".

https://github.com/hokaccha/nodebrew/blob/master/nodebrew

    } elsif ($machine =~ m/aarch64/) {
        $arch = 'armv7l';

Since "armv7l" is 32-bit, can we change it to be able to select "arm64" (64-bit) as well?


The armv7l binaries provided by Node.js are 32-bit binary while aarch64 is a 64-bit archtecture.

$ file node-v11.2.0-linux-armv7l/bin/node 
node-v11.2.0-linux-armv7l/bin/node: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.16.42, not stripped

This is because the original pull-request is made for Chrome OS where the OS is 64-bit but the userland is 32-bit for some efficiency.

Below is the original pull-request to add an aarch64 configuration to the Nodebrew.

PR : #69
Merge : 5117ab1

And it seems that the request came from the following issue of Chromebrew for your reference.

chromebrew/chromebrew#2405

Since aarch64 is a 64-bit architecture, it would be nice if we can choose "arm64" along with "armv7l" as well.
Node.js offers arm64 64-bit binaries which are native to aarch64.

$ file node-v11.2.0-linux-arm64/bin/node 
node-v11.2.0-linux-arm64/bin/node: ELF 64-bit LSB executable, ARM aarch64, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=327b8840de15505d13a9dc1ca8cfa3662ca6eb5b, not stripped

I need this to use Nodebrew on aarch64 systems where the userland is also 64-bit such as Debian 9 on Gemini PDA.
It may be the case for Raspberry Pi 64-bit OS as well.

Here's a patch to resolve it.

It uses ptrsize to check the bitness of the userland binary by picking up the perl itself as a sample.

I have tested it on a Debian 9 aarch64 system.
It downloads and installs the 64-bit binary with no problem.

I have not tested it for Chrome OS since I do not have one.
I hope it works well on the Chrome OS.

diff --git a/nodebrew b/nodebrew
index 9f6da59..0273107 100755
--- a/nodebrew
+++ b/nodebrew
@@ -733,7 +733,12 @@ sub system_info {
     } elsif ($machine =~ m/armv7l/) {
         $arch = 'armv7l';
     } elsif ($machine =~ m/aarch64/) {
-        $arch = 'armv7l';
+        use Config;
+        if($Config{ptrsize} == 8) {
+          $arch = 'arm64';
+        } else {
+          $arch = 'armv7l';
+        }
     } elsif ($sysname =~ m/sunos/i) {
         # SunOS $machine => 'i86pc'. but use 64bit kernel.
         # Solaris 11 not support 32bit kernel.
uberhacker added a commit to uberhacker/nodebrew that referenced this issue May 3, 2020
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 a pull request may close this issue.

1 participant