Homebrew on Pinebook Pro: can't install Portable Ruby

Hi folks, I recently acquired a Pinebook Pro, which has an ARM 64-Bit CPU, and ships with Debian 9 with MATE desktop installed.

I tried running the regular install script, but it doesn’t seem to be able to install Ruby:

nelson@Debian-Desktop:/home$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
==> Installing Ruby to /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 8159k  100 8159k    0     0  4775k      0  0:00:01  0:00:01 --:--:-- 22.6M
==> Installing successful
==> /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/current/bin/ruby
sh: 31: eval: ruby: not found

Since “no binary packages (bottles) are available” for ARM, it seems worrying about binary packages is unnecessary, so what if I use the “Alternative Installation” process? Initially it seems to go better, but it seems to have a similar sticking point: Portable Ruby won’t install.

nelson@Debian-Desktop:~$ brew doctor
==> Downloading https://linuxbrew.bintray.com/bottles-portable-ruby/portable-ruby-2.6.3.aarch64_linux.bottle.tar.gz
Already downloaded: /home/nelson/.cache/Homebrew/portable-ruby-2.6.3.aarch64_linux.bottle.tar.gz
==> Pouring portable-ruby-2.6.3.aarch64_linux.bottle.tar.gz
Error: Failed to vendor ruby 2.6.3.
Error: Failed to install vendor Ruby.

I don’t quite understand why it failed to install. I appear to have satisfied all of the listed requirements, including reasonable versions of GCC, Glibc, and the Linux kernel. It appears to be a bottle for the correct architecture.

nelson@Debian-Desktop:~$ gcc --version
gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

nelson@Debian-Desktop:~$ uname -r
nelson@Debian-Desktop:~$ ldd --version
ldd (Debian GLIBC 2.24-11+deb9u4) 2.24
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
Written by Roland McGrath and Ulrich Drepper.

I’m able to install an older version of Ruby through apt, but it appears to be too old for homebrew.

Does anyone have any ideas as to what is going wrong, or what I should try next? Do I need to compile Portable Ruby myself?

EDIT: I also posted to the Pinebook Pro forums, in case it is something specific to their hardware or default OS: https://forum.pine64.org/showthread.php?tid=8821

UPDATE: I had this exchange on the Pinebook IRC channel:

<skyfaller> hi folks, I'm trying to get Homebrew installed on my Pinebook Pro, and I'm unable to install Portable Ruby. Does anyone have any tips? I posted about it here: https://discourse.brew.sh/t/homebrew-on-pinebook-pro-cant-install-portable-ruby/6685
<Nadia> Keep in mind the default image has 32bit userland
<Nadia> So trying to run 64bit Ruby will probably fail
<Nadia> Install 32bit arch in a chroot I guess
<skyfaller> Nadia: oh interesting, I did not understand the 32 bit userland thing. Is there a good place to read about that?
<Nadia> The default image is a 32bit (armhf) OS running on top of a 64bit kernel
<Nadia> I can see it's trying to fetch aarch64 Ruby, which isn't going to work in an armhf system
<skyfaller> Nadia: well, thank you for the information, now it makes sense why the Ruby install would fail
<Nadia> So either install 32bit Ruby or switch to a 64bit OS

So I guess I was wrong when I said “It appears to be a bottle for the correct architecture.” It seems I need to figure out how to install 32 bit Ruby, and then… will Homebrew compile 32 bit binaries, or incorrectly produce 64 bit software? I’m pretty lost. Maybe switching to a 64 bit OS would be simpler, to keep things consistent.

There is a portable-ruby bottle for 32-bit ARM:
at https://github.com/Homebrew/homebrew-portable-ruby/releases

If you’re comfortable hacking Ruby, could you fix the code that determines which architecture you’re on and hack it to return armv6 rather than aarch64.

Installing a 64-bit OS is a viable alternative.

You could also try these alternative installation instructions, and see if you get any further: