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

Compiling from source not working #138

Closed
ceiroa opened this issue Feb 17, 2015 · 9 comments
Closed

Compiling from source not working #138

ceiroa opened this issue Feb 17, 2015 · 9 comments

Comments

@ceiroa
Copy link

ceiroa commented Feb 17, 2015

Running go get -u github.com/heroku/force produces an error:

github.com/ddollar/config/windows.go:8: (*Config).homeDirectory redeclared in this block
    previous declaration at github.com/ddollar/config/posix.go:9

screen shot 2015-02-17 at 5 38 38 pm

@dcarroll
Copy link
Contributor

This is typically a configuration error related to GOPATH.

Type the following into your terminal window:

go env

You should get something similar to this:

GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/dcarroll/go:/Users/dcarroll/Documents/Projects/goforce/mergeplace/force"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"

Give a try and post what you get.

@ceiroa
Copy link
Author

ceiroa commented Feb 18, 2015

Thanks for the reply, @dcarroll. I thought my env was properly set up. This is how it looks:

GOARCH="386"
GOBIN=""
GOCHAR="8"
GOEXE=""
GOHOSTARCH="386"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/ceiroa/goprojects"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_386"
CC="gcc"
GOGCCFLAGS="-fPIC -m32 -pthread -fmessage-length=0 -fno-common"
CXX="g++"
CGO_ENABLED="1"

@dcarroll
Copy link
Contributor

Are you doing go get from the gopath folder?

@ceiroa
Copy link
Author

ceiroa commented Feb 18, 2015

Yes. Though I see that github.com/ddollar/config hasn't change for a while. Initially I thought there might be a problem with the dependencies, but it might just be my environment. Feel free to close this issue if you cannot reproduce it.

@ceiroa
Copy link
Author

ceiroa commented Feb 19, 2015

I was able to compile it once with go get -u github.com/heroku/force after completely wiping out the github.com/ddollar/config project from the pkg and src directories. It seems like once you have the source code there, you get the error.

The error itself makes sense, as a function with the same signature and in the same package is declared twice (once in windows.go and once in posix.go).

For reference, this seems to be the same issue reported at #130.

@dcarroll
Copy link
Contributor

Here is a link to the go get command to understand why -u solved this issue.

https://golang.org/cmd/go/#hdr-Download_and_install_packages_and_dependencies

As to the fact that the error makes sense, this link should illustrate that this is a valid approach to go.

http://golang.org/pkg/go/build/#hdr-Build_Constraints

@mikeburr
Copy link

If I read http://golang.org/pkg/go/build/#hdr-Build_Constraints correctly, the problem is that the file is named "windows.go" but implicit build constraints only kick in when the os/arch is preceded by an underscore:

$ pwd
/Users/mburr/go/src/github.com/ddollar/config
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

nothing to commit, working directory clean
$ go get .

github.com/ddollar/config

./windows.go:8: (*Config).homeDirectory redeclared in this block
previous declaration at ./posix.go:9
$ mv windows.go _windows.go
$ go get .
$

@ccotofana
Copy link
Contributor

I ran into the same issue trying to build from source. I resolved it by removing "windows.go" from the project, as suggested by another commenter. I am building on MacOS.

@dcarroll
Copy link
Contributor

A better solution is to add the build constraint

// +build windows

On Thu, Aug 13, 2015 at 11:14 AM, ccotofana notifications@github.com
wrote:

I ran into the same issue trying to build from source. I resolved it by
removing "windows.go" from the project, as suggested by another commenter.
I am building on MacOS.


Reply to this email directly or view it on GitHub
#138 (comment).

Thanks,
Dave

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