sjmudd / ps-top

ps-top - a top-like program for MySQL
BSD 2-Clause "Simplified" License
203 stars 31 forks source link

How to compile ps-top on Ubuntu bionic? #18

Closed akuzminsky closed 1 year ago

akuzminsky commented 1 year ago

On bionic it fails with an error:

$ go version go version go1.10.4 linux/amd64

$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.5 LTS Release: 18.04 Codename: bionic

$ go get -u github.com/sjmudd/ps-top package github.com/rivo/uniseg: found packages uniseg (doc.go) and main (gen_breaktest.go) in /home/akuzminsky/go/src/github.com/rivo/uniseg $ echo $? 1

cezmunsta commented 1 year ago

@akuzminsky you should definitely get a newer version of Go. That is old and unsupported:

Each major Go release is supported until there are two newer major releases.

The mod file states a minimum of Go 1.15, not sure if @sjmudd is using that version though. If your OS doesn't provide a newer version then you can download directly. Once you have a new enough version (can't remember which) then you can download with Go like this:

$ VER=1.19.3
$ go install golang.org/dl/go"${VER}"@latest
$ go"${VER}" download

It builds OK with 1.18.6 and also a direct install works too:

$ go install github.com/sjmudd/ps-top@latest
go: downloading github.com/sjmudd/ps-top v1.1.4
go: downloading golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3
go: downloading golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e

$ ~/go/bin/ps-top --version
ps-top version 1.1.4
sjmudd commented 1 year ago

Indeed as @cezmunsta says the version of go you're using is pretty old so usage has changed. You should be able to download a go tarball easily from their site and then use that. Once on that version the process that Ceri shared should work fine.

ericherman commented 1 year ago

Hrm. Yes. It looks like 1.15 was released just over 2 years ago: go1.15 (released 2020-08-11), thus is not likely to be in Ubuntu 20.04 LTS nor likely in other distributions which are still widely used.

It's always a matter of trade-offs. It's almost certainly not worth changing things to run with older golang versions now, but one could look to see how invasive of a change porting the back would be. Instead, I'd suggest that this is something to ask developers to be conscious of when considering the costs-vs-benefits of using newer language features.

Regardless, since sjmudd does almost all of the development work on ps-top, he must prioritize his own time first and foremost.

akuzminsky commented 1 year ago

Thank you all!

sjmudd commented 1 year ago

The go.mod setting probably does not need to be so new. I've just kept it up to date with the latest go (roughly). It may well be possible to edit the value and use an older version. The other option is to simply download the latest version of go as it tends to work on most linux versions so may well work on 20.04 LTS. I've not tried but it should be relatively easy to check on an emtpy docker container.