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

Release go client for more platforms #2938

Open leipert opened 8 years ago

leipert commented 8 years ago

Hey.

Yesterday I tried to install keybase on a Raspberry Pi (ARM). Installing go didn't work, as compiling it on the RPi failed after 17 hours. After a bit of research I was able to compile it on my Mac with:

mkdir ~/gopath
cd ~/gopath
export GOPATH="$HOME/gopath"

go get github.com/keybase/client/go/keybase
env GOOS=linux GOARCH=arm GOARM=5 GO15VENDOREXPERIMENT=1 \
go build -tags production github.com/keybase/client/go/keybase

And now keybase works beautifully on the Raspberry Pi.

Wouldn't it make sense that keybase cross-compiles and releases the client for more platforms? Especially considering, that keybase is all about 1

Keys for everyone!

and the Raspberry Pi designed to be easy access as well 2:

[...] put[ting] the power of digital making into the hands of people all over the world [...]

As an example of a go OSS project that does this, i found syncthing 3.

Is there anything we could do to help you with broader cross-compiling and releasing of more binaries?

cjb commented 8 years ago

Which distro are you using? I wonder if they could package it.

leipert commented 8 years ago

Raspbian. Do other big distros like debian or ubuntu package keybase?

juzam commented 8 years ago

@leipert if you are so inclined I've just put together a small dockerfile based upon your build instructions and managed to get a useable keybase binary, you can find the docker file here TODO same but for x86 arch (basically starting from golang:latest and changing ENV variables)

taruti commented 8 years ago

Supporting linux/arm we should probably have both GOARM=5 and GOARM=7 builds, so leaving this to distros could make sense.

Btw for cross-compiled things xgo is a very nice solution.

juzam commented 8 years ago

@taruti Ack on leaving this to distros, meanwhile mine was a quick and dirty solution (and an excercise in Docker)

PeterTGarner commented 8 years ago

I also have this problem. I'm running Arch on a Raspberry Pi3 and get:

==> ERROR: keybase-bin is not available for the 'armv7h' architecture uname -a = "Linux hostname 4.4.23-1-ARCH #1 SMP Fri Sep 30 19:06:51 MDT 2016 armv7l GNU/Linux"

cjb commented 8 years ago

@PeterTGarner Keybase isn't going to distribute ARM packages directly, but if you want to create tested patches to the keybase-bin AUR package that add ARM support, you're welcome to do so and send them to us:

https://github.com/keybase/client/tree/master/packaging/linux/arch

PeterTGarner commented 8 years ago

Thanks, I'll look into that! Looks a really interesting project and I don't want to miss out.

On Wednesday, 5 October 2016, Chris Ball notifications@github.com wrote:

@PeterTGarner https://github.com/PeterTGarner Keybase isn't going to distribute ARM packages directly, but if you want to create tested patches to the keybase-bin AUR package that add ARM support, you're welcome to do so and send them to us:

https://github.com/keybase/client/tree/master/packaging/linux/arch

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/keybase/client/issues/2938#issuecomment-251781853, or mute the thread https://github.com/notifications/unsubscribe-auth/ARu7pp65muHlPjyr8oezq3SIRTNXsLGyks5qxAFhgaJpZM4IrPkg .


Peter T Garner MBCS

oconnor663 commented 8 years ago

The keybase-bin script downloads .deb packages that we publish for Debian/Ubuntu and unpacks binaries from those, so you won't be able to add ARM support to that one from the outside, since we don't have ARM .deb's up for you to download.

The AUR package that builds Keybase from source is keybase-git. It's possible you could patch that one to build on ARM? Unfortunately it goes through a collection of bash scripts checked into our repo (stuff in this folder: https://github.com/keybase/client/tree/master/packaging/linux), and you'll probably need to update those too in the places where they currently know about architectures.

That said, both of those packages are for building the whole CLI+KBFS+GUI world. Our CLI is just one go binary, so if all you want for your Raspberry Pi is the CLI, it's probably easier to run go build directly and just use its output. @juzam linked to some good examples of that in his comment above. (Apologies if we end up breaking these approaches at some point. The internal scripts and directories in our repo aren't really intended as a stable public API.)

juzam commented 7 years ago

for those instereted in the Docker build approach, i've pushed a branch https://github.com/juzam/docker-keybase-build/tree/docker-compose that simplifies the build process especially on ARM (because of the golang version requirement and the lack of an official golang 1.7 arm docker image) Feedback appreciated, this will later be merged with master.

waynew commented 7 years ago

I'm running Raspbian Jessie and I had no problems just following the build instructions and using go get and go install with go 1.7.4

I'm running a Raspberry Pi 3.

But it would be nice if there were a PPA for it or something.

johnnyRose commented 7 years ago

@waynew @oconnor663 The build instructions almost worked for me, but I received the following errors running go1.7.4:

gopath/src/github.com/keybase/client/go/protocol/keybase1/extras.go:1451: undefined: sort.Slice
gopath/src/github.com/keybase/client/go/protocol/keybase1/extras.go:1452: undefined: sort.Slice
gopath/src/github.com/keybase/client/go/protocol/keybase1/extras.go:1461: undefined: sort.Slice
gopath/src/github.com/keybase/client/go/protocol/keybase1/extras.go:1468: undefined: sort.Slice

I updated to go1.9 with the following (source) and everything worked like a charm:

wget https://storage.googleapis.com/golang/go1.9.linux-armv6l.tar.gz
sudo tar -C /usr/local -xzf go1.9.linux-armv6l.tar.gz
export PATH=$PATH:/usr/local/go/bin # put into ~/.profile

I used a Raspberry Pi 2 Model B running Raspbian Stretch Lite 2017-09-07.

maxtaco commented 7 years ago

Yeah good point, you need 1.8+ to build keybase

On Sat, Oct 7, 2017 at 2:45 PM John Rosewicz notifications@github.com wrote:

@waynew https://github.com/waynew @oconnor663 https://github.com/oconnor663 The build instructions https://github.com/keybase/client/blob/master/go/README.md#building almost worked for me, but I received the following errors running go1.7.4:

gopath/src/github.com/keybase/client/go/protocol/keybase1/extras.go:1451: undefined: sort.Slice gopath/src/github.com/keybase/client/go/protocol/keybase1/extras.go:1452: undefined: sort.Slice gopath/src/github.com/keybase/client/go/protocol/keybase1/extras.go:1461: undefined: sort.Slice gopath/src/github.com/keybase/client/go/protocol/keybase1/extras.go:1468: undefined: sort.Slice

I updated to go1.9 with the following (source https://gist.github.com/simoncos/49463a8b781d63b5fb8a3b666e566bb5) and everything worked like a charm:

wget https://storage.googleapis.com/golang/go1.9.linux-armv6l.tar.gz sudo tar -C /usr/local -xzf go1.9.linux-armv6l.tar.gz export PATH=$PATH:/usr/local/go/bin # put into ~/.profile

I used a Raspberry Pi 2 Model B running Raspbian Stretch Lite 2017-09-07.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/keybase/client/issues/2938#issuecomment-334957574, or mute the thread https://github.com/notifications/unsubscribe-auth/AA05_ziiwegB5NpmXuriFcszP0wN7vq3ks5sp8a6gaJpZM4IrPkg .

oconnor663 commented 7 years ago

Woops, thanks for pointing that out @johnnyRose, I'll update the instructions now.

stefanb commented 6 years ago

I tried compiling it natively (not cross-compiling) on Raspberry Pi 2:

$ go get github.com/keybase/client/go/keybase
# github.com/keybase/client/go/keybase
/usr/local/go/pkg/tool/linux_arm/link: running gcc failed: fork/exec /usr/bin/gcc: cannot allocate memory

Same with building it explicitly:

$ go build -tags production github.com/keybase/client/go/keybase
# github.com/keybase/client/go/keybase
/usr/local/go/pkg/tool/linux_arm/link: running gcc failed: fork/exec /usr/bin/gcc: cannot allocate memory

There is 700MB of RAM available:

$ free -h
              total        used        free      shared  buff/cache   available
Mem:           976M         82M        700M         45M        193M        791M
Swap:           99M         15M         84M

And using the currently latest stable version of go:

$ go version
go version go1.10.3 linux/arm

Is there a way to build it natively?

EDIT: I increased the swap size

$ free -h
              total        used        free      shared  buff/cache   available
Mem:           976M         92M        619M         50M        264M        778M
Swap:          1.0G          0B        1.0G

Then it apparently failed with

$ go get github.com/keybase/client/go/keybase
$ go build -tags production github.com/keybase/client/go/keybase
go build github.com/keybase/client/go/keybase: build output "keybase" already exists and is a directory

but the 52MB keybase binary was created inside ~/go/bin/.

stanbar commented 5 years ago

I successfully build keybase executable using @stefanb workaround, but is it possible to run KBFS on RPI? What I did:

go get github.com/keybase/client/go/keybase

go build -tags production github.com/keybase/client/go/keybase; and sudo mv keybase /usr/bin/
go build -tags production github.com/keybase/client/go/kbfs/kbfsfuse; and sudo mv kbfsfuse /usr/bin/
go build -tags production github.com/keybase/client/go/kbfs/kbfsgit/git-remote-keybase; and sudo mv git-remote-keybase /usr/bin/
go build -tags production github.com/keybase/client/go/kbfs/redirector; and sudo mv redirector /usr/bin/keybase-redirector

sudo wget https://raw.githubusercontent.com/keybase/client/master/packaging/linux/systemd/keybase.service -P /usr/lib/systemd/user/
sudo wget https://raw.githubusercontent.com/keybase/client/master/packaging/linux/systemd/kbfs.service -P /usr/lib/systemd/user/
sudo wget https://raw.githubusercontent.com/keybase/client/master/packaging/linux/systemd/keybase-redirector.service -P /usr/lib/systemd/user/

sudo mkdir /opt/keybase
sudo wget https://raw.githubusercontent.com/keybase/client/master/packaging/linux/crypto_squirrel.txt -P /opt/keybase/
sudo wget https://raw.githubusercontent.com/keybase/client/master/packaging/linux/post_install.sh -P /opt/keybase/
chmod +x /opt/keybase/post_install.sh
/opt/keybase/post_install.sh
curl https://github.com/keybase/client/blob/master/packaging/linux/run_keybase > run_keybase
./run_keybase -g

And the result is

Unmounting /run/user/1000/keybase/kbfs...
Unmounting and shutting down kbfsfuse...
Shutting down keybase service...
Starting via systemd...
run_keybase: Success!
                                                  ▄▄▄▄█▀    
╭───────────────────────╮          ▄▄          ▄▄▄█▄▄▀      
│                       │         ███▄▄▄▄▄▄▄▄▄▄███▄██       
│  Encrypt everything!  │       ▄▄▄████▄▄▄███████████       
│                       ├────  ▄▄▄▄▄████▄█████████████      
╰───────────────────────╯      ███▄█▄█████████████████▄▄    
                                ▀▄███████▄▀ ███████████▄▄   
                                  ▄▄▄▄███    ███████████▄▄  
                                 ▄████████   ██████████████ 
                                ▄███▄█████▄▄  ▀▄████████████
                               ███████▄▄██▄█▄▄ █████████████
                              ▄▄█████████████▄▄ ████████████
                           ▄██▄▄████▄▄▄█▄▄█████ ████████████
                                ███▄▄▄▄▄███████▄▄█████████▄▀
                                ▄█████▄▄█████████████▄█████ 
                                █▄██████████▄▄▄▄▄▄▄███████  
                              ▄▄▄▄▄██▄▄█████▄████████████   
                            ▀▀▀▀▀▀▀▀▄▄▄▄██▄▀ ▀▀▄▄▄▄▄▄▀▀▀    
                                  ▀▀▀▀▀▀▀▀▀                 

I have no other idea how to make kbfs mount into /keybase

stefanb commented 5 years ago

Keybase is working fine for me on Raspberry pi, at least the git repository part that I needed.

I didn't set up the post_install and run_keybase scripts, so my service has to be started manually when needed, which is annoying.

Will give it another try, it is due for update anyway ;-)