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

Permission issues when building from source #380

Open
mattroseman opened this issue Mar 30, 2018 · 0 comments
Open

Permission issues when building from source #380

mattroseman opened this issue Mar 30, 2018 · 0 comments

Comments

@mattroseman
Copy link
Contributor

Steps to reproduce

  1. Reinstall Go, making the GOROOT /usr/local/go directory
  2. Clone the torus-cli repo into the normal place in $GOPATH/src/github.com/manifoldco/torus-cli
  3. Run make bootstrap
  4. Run make binary

This is the output I get after step 4.

CGO_ENABLED=0 go build -i -v -o torus -ldflags='-X github.com/manifoldco/torus-cli/config.Version=0.30.1' github.com/manifoldco/torus-cli
go build net: open /usr/local/go/pkg/linux_amd64/net.a: permission denied
make: *** [Makefile:77: binary] Error 1

Now if I play around with the command the make file is running
CGO_ENABLED=0 go build -i -v -o torus -ldflags='-X github.com/manifoldco/torus-cli/config.Version=0.30.1' github.com/manifoldco/torus-cli
The error isn't thrown if CGO_ENABLED is set to 1, or if -i is removed.
Not sure if that is useful information, or not.

Also, since this is a permission issue, I tried running sudo make binary. I get this

CGO_ENABLED=0 go build -i -v -o torus -ldflags='-X github.com/manifoldco/torus-cli/config.Version=0.30.1' github.com/manifoldco/torus-cli
can't load package: package github.com/manifoldco/torus-cli: cannot find package "github.com/manifoldco/torus-cli" in any of:
	/usr/local/go/src/github.com/manifoldco/torus-cli (from $GOROOT)
	/root/go/src/github.com/manifoldco/torus-cli (from $GOPATH)
make: *** [Makefile:77: binary] Error 1

It seems if I try and build with the permissions I need to write to /usr/local/go, I lose the environment variables pointing to my GOPATH.

Finally, if I install go at ~/go instead of /usr/local/go, then I have write permissions when I build, and don't have any issues.

So while I did find a solution that let me build the code, IDK if it is required to build torus-cli as a user that has write permissions in GOROOT or not.

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

1 participant