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

Mac install fails with "/bin/dep: permission denied" #2662

Closed
4 tasks
hernanmd opened this issue Nov 1, 2018 · 9 comments
Closed
4 tasks

Mac install fails with "/bin/dep: permission denied" #2662

hernanmd opened this issue Nov 1, 2018 · 9 comments

Comments

@hernanmd
Copy link

hernanmd commented Nov 1, 2018

Summary of Bug

Installation on MacOS High Sierra 10.3.6 fails following exactly the steps in the install guide.

$ go version
go1.11.1 darwin/amd64

My environment:

$ cat $HOME/.bash_profile
export GOPATH=$HOME/go
export GOBIN=$GPOPATH/bin
export PATH=$PATH:$GOBIN

Possibly related to #2469

Steps to Reproduce

Followed https://cosmos.network/docs/getting-started/installation.html#install-cosmos-sdk

$ make get_tools && make get_vendor_deps && make install
--> Installing tools
./scripts/get_tools.sh
--> Installing golang/dep (22125cfaa6ddc71e145b1535d4b7ee9744fefff2)...
~/go/src/github.com/golang/dep ~/go/src/github.com
go install github.com/golang/dep/cmd/dep: open /bin/dep: permission denied
make: *** [get_tools] Error 1

After installing "dep", the same error occurs. Trying with sudo fails to find the $GOPATH environment variable although is actually set.

$ sudo make get_tools && make get_vendor_deps && make install
--> Installing tools
./scripts/get_tools.sh
please set GOPATH (https://github.com/golang/go/wiki/SettingGOPATH)
make: *** [get_tools] Error 1
titan:cosmos-sdk mvs$ env | grep -i GO
GOBIN=/bin
OLDPWD=/Users/mvs/go/src/github.com/cosmos
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/opt/local/bin:/opt/local/sbin:/bin
PWD=/Users/mvs/go/src/github.com/cosmos/cosmos-sdk
GOPATH=/Users/mvs/go

$ dep version
dep:
version : v0.5.0
build date : 2018-07-26
git hash : 224a564
go version : go1.10.3
go compiler : gc
platform : darwin/amd64
features : ImportDuringSolve=false


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@alexanderbez
Copy link
Contributor

I'm confused. Did you have to install dep manually?

@alexanderbez
Copy link
Contributor

@ValarDragon why aren't we just go installing things like dep?

@hernanmd
Copy link
Author

hernanmd commented Nov 4, 2018

I'm confused. Did you have to install dep manually?

Yes, I had to instal dep manually. I just installed Go by downloading the .pkg from here: https://golang.org/dl/ which is the official docs as suggested. No dep was installed, it was supposed to be included with the Go pkg?

@alexanderbez
Copy link
Contributor

I see. I don't quite understand our tools setup scripts. It's a bit convoluted to me. Would like @ValarDragon input here as maybe he can explain.

@jackzampolin
Copy link
Member

Related: #2672

@ValarDragon
Copy link
Contributor

ValarDragon commented Nov 5, 2018

@alexanderbez We are go installing it in make get_tools. We pull the repo, checkout the commit, and then go install.

./scripts/get_tools.sh
--> Installing golang/dep (22125cfaa6ddc71e145b1535d4b7ee9744fefff2)...
~/go/src/github.com/golang/dep ~/go/src/github.com
go install github.com/golang/dep/cmd/dep: open /bin/dep: permission denied

Its installing to /bin, so I think this is an issue with not having the $GOPATH$ and $GOBIN$ set

@alexanderbez
Copy link
Contributor

Ahhh figured so. Thanks!

@hernanmd mind double checking your environment setup?

@hernanmd
Copy link
Author

hernanmd commented Nov 7, 2018

I debugged the get_tools.sh script a little bit. Here is what I found.

Commenting the line

if [ ! -z ${subdir+x} ]; then cd "$subdir" || exit 1; fi && \

makes the go installer actually finds "dep" however failing at subsequent tool installation, which produces the output:

$ make get_tools && make get_vendor_deps && make install                                                                                  
--> Installing tools                                                                                                                                          
./scripts/get_tools.sh                                                                                                                                        
+ '[' -z /Users/mvs/go ']'                                                                                                                                    
+ '[' -z /bin ']'                                                                                                                                             
+ mkdir -p /Users/mvs/go/src/github.com                                                                                                                       
+ cd /Users/mvs/go/src/github.com                                                                                                                             
+ installFromGithub golang/dep 22125cfaa6ddc71e145b1535d4b7ee9744fefff2 cmd/dep                                                                               
+ repo=golang/dep                                                                                                                                             
+ commit=22125cfaa6ddc71e145b1535d4b7ee9744fefff2                                                                                                             
+ subdir=cmd/dep                                                                                                                                              
+ echo '--> Installing golang/dep (22125cfaa6ddc71e145b1535d4b7ee9744fefff2)...'                                                                              
--> Installing golang/dep (22125cfaa6ddc71e145b1535d4b7ee9744fefff2)...                                                                                       
+ '[' '!' -d golang/dep ']'                                                                                                                                   
+ '[' '!' -z x ']'                                                                                                                                            
+ '[' '!' -d golang/dep/cmd/dep ']'                                                                                                                           
+ pushd golang/dep                                                                                                                                            
~/go/src/github.com/golang/dep ~/go/src/github.com                                                                                                            
+ git fetch origin                                                                                                                                            
+ git checkout -q 22125cfaa6ddc71e145b1535d4b7ee9744fefff2                                                                                                    
+ go install                                                                                                     
+ '[' '!' -z cmd/dep ']'                                                                                                                                      
+ cd -                                                                                                                                                        
/Users/mvs/go/src/github.com                                                                                                                                  
+ popd                                                                                                                                                        
~/go/src/github.com                                                                                                                                           
+ echo '--> Done'                                                                                                                                             
--> Done                                                                                                                                                      
+ echo ''           

+ installFromGithub alecthomas/gometalinter 17a7ffa42374937bfecabfb8d2efbd4db0c26741                                                                          
+ repo=alecthomas/gometalinter                                                                                                                                
+ commit=17a7ffa42374937bfecabfb8d2efbd4db0c26741                                                                                                             
+ subdir=                                                                                                                                                     
+ echo '--> Installing alecthomas/gometalinter (17a7ffa42374937bfecabfb8d2efbd4db0c26741)...'                                                                 
--> Installing alecthomas/gometalinter (17a7ffa42374937bfecabfb8d2efbd4db0c26741)...                                                                          
+ '[' '!' -d alecthomas/gometalinter ']'                                                                                                                      
+ mkdir -p alecthomas/gometalinter                                                                                                                            
+ git clone https://github.com/alecthomas/gometalinter.git alecthomas/gometalinter
Cloning into 'alecthomas/gometalinter'...
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4438 (delta 0), reu
sed 0 (delta 0), pack-reused 4434
Receiving objects: 100% (4438/4438), 5.49 MiB | 698.00 KiB/s, done.
Resolving deltas: 100% (1648/1648), done.
+ '[' '!' -z x ']'
+ '[' '!' -d alecthomas/gometalinter/ ']'
+ pushd alecthomas/gometalinter
~/go/src/github.com/alecthomas/gometalinter ~/go/src/github.com
+ git fetch origin
+ git checkout -q 17a7ffa42374937bfecabfb8d2efbd4db0c26741
+ go install
go install github.com/alecthomas/gometalinter: open /bin/gometalinter: permission denied
+ exit 1
make: *** [get_tools] Error 1

Sorry I cannot help more, I am learning Go myself now.

@alexanderbez
Copy link
Contributor

alexanderbez commented Nov 7, 2018

This is a problem with your Golang environment. get_tools functions as it's supposed to. For example:

  1. Run a proper golang container: docker run --name test -it golang:1.11 bash
  2. Get Cosmos-SDK: go get -u github.com/cosmos/cosmos-sdk && cd $GOPATH/src/github.com/cosmos/cosmos-sdk/
  3. Install the tools: make get_tools.

Everything works as is. I will be closing this issue shortly 👍

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

4 participants