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

Can't figure out how to build termeter #7

Open
PenelopeFudd opened this issue Nov 24, 2017 · 2 comments
Open

Can't figure out how to build termeter #7

PenelopeFudd opened this issue Nov 24, 2017 · 2 comments

Comments

@PenelopeFudd
Copy link

PenelopeFudd commented Nov 24, 2017

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!

@lamachine
Copy link

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.

@PenelopeFudd
Copy link
Author

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

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

2 participants