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

Raspbian still on go 1.11 ... maybe put a disclaimer somewhere? #30

Open
xanoni opened this issue Jul 7, 2021 · 9 comments
Open

Raspbian still on go 1.11 ... maybe put a disclaimer somewhere? #30

xanoni opened this issue Jul 7, 2021 · 9 comments

Comments

@xanoni
Copy link

xanoni commented Jul 7, 2021

I assume a good chunk of the lntop users is on Raspbian (Raspberry Pi .... e.g., Raspibolt), and by default Rasbian still ships with go 1.11, which fails to build lntop. Maybe you could put a more prominent explanation somewhere to save people a bit of time.

If it helps someone, I used the below to get a more recent go installed ... don't forget to update your path to include /usr/local/go/bin, and remove your old go (sudo apt remove golang && sudo apt autoremove).

The below downloads binaries, but does not verify signatures by itself!

#! /usr/bin/env -S bash -ex

GO_VERSION="${1}"

if [ -z "${GO_VERSION}" ]; then
    GO_VERSION="1.16.5"
fi

echo -en "\n\nINSTALLING GO ${GO_VERSION} ...\n\n"

# WARNING: DOES NOT VERIFY SIGNATURES!
cd /tmp/
axel --no-clobber "https://golang.org/dl/go${GO_VERSION}.linux-armv6l.tar.gz" || true
sudo rm -rf /usr/local/go || true
umask 022
sudo mkdir -p /usr/local/go
sudo tar -xvf "go${GO_VERSION}.linux-armv6l.tar.gz" -C /usr/local/go --strip-components=1
rm "/tmp/go${GO_VERSION}.linux-armv6l.tar.gz"
@rkfg
Copy link
Contributor

rkfg commented Jul 13, 2021

You can compile it on desktop, no matter what your OS is, you only need to install the Go SDK. GOARCH=arm GOOS=linux go build -o lntop cmd/lntop/main.go should do the trick!

@xanoni
Copy link
Author

xanoni commented Jul 13, 2021

That's another way, sure.

@markshep
Copy link

markshep commented Sep 3, 2021

Raspbian 11.0 (Bullseye) is out now which includes version 1.15 of go.

@xanoni
Copy link
Author

xanoni commented Sep 3, 2021

Raspbian 11.0 (Bullseye) is out now which includes version 1.15 of go.

that's just the 64-bit version though and not the standard 32-bit RaspberryPi OS that the hardware vendor recommends, or did I miss something?

EDIT: just checked with a 64-bit and with a 32-bit Raspberry ... 32-bit is 1.11.x and 64-bit is 1.15.9

@markshep
Copy link

markshep commented Sep 3, 2021

I upgraded my Raspberry Pi 4B recently and it's running the 32-bit version of Raspbian:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye
$ getconf LONG_BIT
32
$ arch
armv7l
$ dpkg --print-architecture
armhf
$ apt show golang
Package: golang
Version: 2:1.15~1
Priority: optional
Section: devel
Source: golang-defaults
Maintainer: Go Compiler Team <team+go-compiler@tracker.debian.org>
Installed-Size: 11.3 kB
Depends: golang-1.15, golang-doc (>= 2:1.15~1), golang-go (>= 2:1.15~1), golang-src (>= 2:1.15~1)
Homepage: https://golang.org
Download-Size: 4,844 B
APT-Sources: http://raspbian.raspberrypi.org/raspbian bullseye/main armhf Packages
Description: Go programming language compiler - metapackage
 The Go programming language is an open source project to make
 programmers more productive. Go is expressive, concise, clean, and
 efficient. Its concurrency mechanisms make it easy to write programs
 that get the most out of multicore and networked machines, while its
 novel type system enables flexible and modular program construction.
 Go compiles quickly to machine code yet has the convenience of
 garbage collection and the power of run-time reflection. It's a
 fast, statically typed, compiled language that feels like a
 dynamically typed, interpreted language.
 .
 This package is a metapackage that, when installed, guarantees
 that (most of) a full Go development environment is installed.

@xanoni
Copy link
Author

xanoni commented Sep 3, 2021

Interesting, I checked the RaspberryPi site earlier today and the latest release it was showing was still the one from May... (https://www.raspberrypi.org/software/operating-systems/#raspberry-pi-os-32-bit)

Did you manually update your apt sources, or did it install bullseye by itself?

(Personally, I'm planning to move my only remaining 32-bit Pi to 64-bit Bullseye.... it has just shown to be faster across several metrics)

@hicotton02
Copy link

hicotton02 commented Nov 1, 2021

for RPi 4 (running Umbrel too) adjust the above code that the OP shared to this:

#! /usr/bin/env -S bash -ex

GO_VERSION="${1}"

if [ -z "${GO_VERSION}" ]; then
    GO_VERSION="1.16.5"
fi

echo -en "\n\nINSTALLING GO ${GO_VERSION} ...\n\n"

# WARNING: DOES NOT VERIFY SIGNATURES!
cd /tmp/
axel --no-clobber "https://golang.org/dl/go${GO_VERSION}.linux-arm64.tar.gz" || true
sudo rm -rf /usr/local/go || true
umask 022
sudo mkdir -p /usr/local/go
sudo tar -xvf "go${GO_VERSION}.linux-arm64.tar.gz" -C /usr/local/go --strip-components=1
rm "/tmp/go${GO_VERSION}.linux-arm64.tar.gz"

@dawiepoolman
Copy link

On Rasberry Pi3 B+ (32 bit, go version go1.16.6 linux/arm)
When I run this I get error
lntop --version
-bash: /usr/local/bin/lntop: cannot execute binary file: Exec format error

@rkfg
Copy link
Contributor

rkfg commented Apr 23, 2022

Run file /usr/local/bin/lntop and see if it's compiled for 32 bit arch.

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

5 participants