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

Release go client for more platforms #2938

Open
leipert opened this issue Jun 1, 2016 · 17 comments
Open

Release go client for more platforms #2938

leipert opened this issue Jun 1, 2016 · 17 comments

Comments

@leipert
Copy link

leipert commented Jun 1, 2016

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
Copy link
Contributor

cjb commented Jun 1, 2016

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

@leipert
Copy link
Author

leipert commented Jun 3, 2016

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

@juzam
Copy link

juzam commented Sep 4, 2016

@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
Copy link
Contributor

taruti commented Sep 5, 2016

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
Copy link

juzam commented Sep 5, 2016

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

@PeterTGarner
Copy link

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
Copy link
Contributor

cjb commented Oct 5, 2016

@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
Copy link

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
#2938 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ARu7pp65muHlPjyr8oezq3SIRTNXsLGyks5qxAFhgaJpZM4IrPkg
.


Peter T Garner MBCS

@oconnor663
Copy link
Contributor

oconnor663 commented Oct 5, 2016

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
Copy link

juzam commented Jan 5, 2017

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
Copy link

waynew commented Jan 10, 2017

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
Copy link

@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
Copy link
Contributor

maxtaco commented Oct 7, 2017 via email

@oconnor663
Copy link
Contributor

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

@stefanb
Copy link

stefanb commented Jul 25, 2018

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
Copy link

stanbar commented Mar 13, 2019

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
Copy link

stefanb commented Mar 14, 2019

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 ;-)

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

No branches or pull requests