keybase / client

Keybase Go Library, Client, Service, OS X, iOS, Android, Electron
BSD 3-Clause "New" or "Revised" License
8.91k stars 1.23k forks source link

Enabling building for other architectures #8889

Open steev opened 7 years ago

steev commented 7 years ago

Hey keybase devs, and any others who are interested.

I would like to start working towards enabling armhf and arm64 builds of the keybase client.

I'm not entirely sure of all the steps that will be required but so far the only thing that seems to be absolutely required will be to add some bits to

client/packaging/linux/build_binaries.sh

but in doing so, will need to modify it just a bit.

Currently it has

if [ -z "${KEYBASE_SKIP_64_BIT:-}" ] ; then
  export GOARCH=amd64
  export debian_arch=amd64
  export electron_arch=x64
  build_one_architecture
else
  echo SKIPPING 64-bit build
fi

if [ -z "${KEYBASE_SKIP_32_BIT:-}" ] ; then
  export GOARCH=386
  export debian_arch=i386
  export electron_arch=ia32
  build_one_architecture
else
  echo SKIPPING 32-bit build
fi

The KEYBASESKIP*_BIT would probably need to be renamed - and I was thinking of doing it something like

if [ -z "${KEYBASE_SKIP_AMD64:-}" ] ; then
  export GOARCH=amd64
  export debian_arch=amd64
  export electron_arch=x64
  build_one_architecture
else
  echo SKIPPING amd64 build
fi

if [ -z "${KEYBASE_SKIP_X86:-}" ] ; then
  export GOARCH=386
  export debian_arch=i386
  export electron_arch=ia32
  build_one_architecture
else
  echo SKIPPING x86 build
fi
if [ -z "${KEYBASE_SKIP_ARMHF:-}" ] ; then
  export GOARCH=arm
  # Specify GOARM to enable hardfloat support
  # Not strictly needed since GOARCH=arm without GOARM defaults to enabling hardfloat 
  export GOARM=7
  export debian_arch=armhf
  export electron_arch=armv7l
  build_one_architecture
else
  echo SKIPPING armhf build
fi

if [ -z "${KEYBASE_SKIP_ARMEL:-}" ] ; then
  export GOARCH=arm
  # Specify GOARM to disable hardfloat support
  export GOARM=5
  export debian_arch=armel
  export electron_arch=arm
  build_one_architecture
else
  echo SKIPPING armel build
fi

if [ -z "${KEYBASE_SKIP_ARM64:-}" ] ; then
  export GOARCH=arm64
  export debian_arch=arm64
  export electron_arch=arm64
  build_one_architecture
else
  echo SKIPPING arm64 build
fi

Does that seem reasonable?

steev commented 7 years ago

@oconnor663 sorry to ping you but since you helped with my PR, i figured maybe you had some input, or knew who best to get to look at this to get the discussion going.

oconnor663 commented 7 years ago

Did you mean getting aarch64 builds into our public release pipeline, or just enabling them for you locally?

steev commented 7 years ago

Eventually the former (hopefully) - but not just aarch64, also armel and armhf (debian) for devices like the Raspberry Pi or various other ARM boards that people use as desktop systems - but I'd like to build and test it locally to make sure it even works - as of right now, Electron only supports aarch64 on the 1.8+ releases but I can test armhf builds because electron supports those in 1.7.

oconnor663 commented 7 years ago

It's unlikely we'll want to add any other architectures to the official builds. As it stands, we're this close to axing our 32-bit builds, and going 64-bit only the way that Chrome has.

That said, it should be pretty easy to arrange things to respect a set of KEYBASE_ARCH{_GO,_DEB,_RPM,_ELECTRON} flags or something set in the environment, for people who want to build their own binaries or packages.

steev commented 7 years ago

That makes sense - although, Chrome really hasn't gone 64bit only - as long as they are releasing 32bit chromebooks they will have to support 32bit, at least for a few years.

As long as we can create our own debs/binaries that would be great, I'm just not sure of the best way to go about doing so.

Akuukis commented 6 years ago

@steev I successfully installed keybase cli on headless arm64 Debian by following instructions here (thanks @schollz) and then copying keybase and git-remote-keybase into /usr/local/bin. Also the git part of it works.

I think it would be useful for others to post these instructions more visible, probably adding to gos README under section "Building".

grenade commented 5 years ago

I would like to install keybase on my arm64 windows 10 Lenovo Yoga. Any pointers? I will attempt to build a client locally and see how I get on...

digitallyelite commented 5 years ago

Electron won't work for WoARM64 yet, due to dependencies it has not supporting it yet. You may be able to use the command line only building it (go may not have windows arm64 support yet either?), or you should be able to install the Windows 32bit binary as the translation layer should kick in and work.

heronhaye commented 5 years ago

On Linux, we added support for ARM64 to the build script: https://github.com/keybase/client/blob/master/packaging/linux/build_binaries.sh#L170. In general you can cross-compile Go to any platform it supports. Building the GUI is supported on fewer platforms (check Electron docs) but should work just by changing those env vars.

bjmgeek commented 5 years ago

I'd be happy with just a standalone kbfs (especially if it included encrypted git repo) on armhf.

heronhaye commented 5 years ago

@bjmgeek Should be supported. You'll need to compile the keybase binary as well, it's a dependency of kbfs. Are you having any trouble compiling that for armhf on Linux?

bjmgeek commented 5 years ago

I'll try building it tonight and see if it works.