termeter icon indicating copy to clipboard operation
termeter copied to clipboard

Can't figure out how to build termeter

Open PenelopeFudd opened this issue 8 years ago • 2 comments

Hi;

I've never used go before, but termeter looks good enough that I'm making the effort.

Getting it running was hard; I had assumptions that were not true. Here's how to get termeter running, for beginners:

echo 'export GOPATH=$HOME/gocode' >> ~/.bashrc
echo 'export GOBIN=$HOME/bin' >> ~/.bashrc
source ~/.bashrc
go get github.com/atsaki/termeter/cmd/termeter
cd $GOPATH/src/github.com/atsaki/termeter/cmd/termeter/
go build
./termeter --help
go install
$GOBIN/termeter --help

Here are the things I figured out:

  1. Using 'cd /tmp; git clone https://github.com/atsaki/termeter.git; cd termeter; go build' won't work; the files have to be in the right directory.
  2. The $GOPATH and $GOBIN environment variables have to exist.
  3. The 'go build' command must be run in $GOPATH/src/github.com/atsaki/termeter/cmd/termeter/ , not $GOPATH/src/github.com/atsaki/termeter
  4. If you do 'go build' in that directory, termeter will be created in that directory. If you do 'go install', termeter will be moved to $GOBIN/termeter. However, if you do 'go install -a github.com/atsaki/termeter/cmd/termeter' from your home directory, you'll get 'go install runtime: open /usr/lib/golang/pkg/linux_amd64/runtime.a: permission denied'
  5. If you're in the same directory as the README.md file, 'go build' won't create 'termeter' and won't print any error messages; you have to be do 'cd ./cmd/termeter; go build'.

Ok, thanks for writing this!

PenelopeFudd avatar Nov 24 '17 18:11 PenelopeFudd

I followed the upper portion because... well, it said for beginners. That's me.

Trying to install on a pi zero w, and when I get to go build the response is

../../../../mattn/go-runewidth/runewidth.go:7:2: found packages uniseg (doc.go) and main (gen_breaktest.go) in /home/pi/gocode/src/github.com/rivo/uniseg

termeter --help returns -bash: termeter: command not found

Any advice would be appreciated.

lamachine avatar Feb 02 '23 20:02 lamachine

The thing with bash is, if you type a command, bash will then look in each of the directories in your $PATH environment variable for a file with that name, and if it finds it (and the permissions say it's an executable program), then it'll try to load it and run it, which is what you want. To see what your $PATH is right now, try echo $PATH. To set it, try PATH=/bin:/usr/bin:/usr/local/bin. If you mess it up, just log out and back in.

If the command isn't in your path, bash isn't going to find it. If you add . to your path then bash will look in the current directory too, but some say that it is a security feature to not do that.

If you still want to run a program but it's not in your path, you can specify the directory (full path or relative path), and then it'll run: /home/mattn/something/something/termeter

PenelopeFudd avatar Feb 14 '23 06:02 PenelopeFudd